CList title Drag N Drop



I have attached a compilable file that demonstrates my problem, and would like
some input from the list... First, some background...

I am attempting to impliment dragable CList columns, so that a user can
re-arrange the columns via clicking on the column title and dragging it to a
new position.

I am doing my best to avoid directly accessing the CList structure, so, since
the GtkCList api doesn't expose the column title "button" widget, I instead
pack a GtkEventBox into the column title button with
gtk_clist_set_column_widget()... I then use gtk_drag_source_set() and
gtk_drag_dest_set() on the GtkEventBox.

I also need to trap the GtkCList's "click-column" signal, as I need to re-sort
the CList based on a column click.

Herein lies my problem.  If the CList has focus, the click-column signal gets
emitted when the user clicks the title to initiate a drag...  If the CList does
not have focus (for example, if the user has just dragged a column and so the
GtkEventBox now has focus) no "click-column" signal is emitted.

In the test program, simply click anywhere in the empty CList to reset the
focus, and you will notice that the "click-column" signal is emitted for the
first drag operation, but not additional drags.

Of course, a NON-drag event always causes the "click-column" signal to be
emitted, because I don't trap any "button-press-event" signals on the event
box.

The desired behavior is for the "click-column" signal to ONLY be emitted if it
is truely a column click, and it should be either blocked or ignored if it is a
"drag" instead of a click.

This may sound a bit complex, but I think if you run the program you will see
what I am talking about.

I have tried attaching to the "button-press-event" signal on the GtkEventBox,
instead of the "click-column" signal on the GtkCList, and this causes an event
every time a drag is initiated. (As Gtk sees the buttonpress and sends a
signal, and THEN deals with the fact that its also a drag)

Any ideas as to how I could block "click-column" signals if it turns out to be
a drag event instead of a simple mouse click would be greatly appreciated.

As a secondary question, you may notice that the clist labels look a little
wierd (depending on your Gtk theme)  Of course.  A GtkEventBox looks different
than a GtkButton (which is what the CList column title is)  I would like to
have my EventBox enherit the GtkStyle of the button, but do not know how to get
at it without directly accessing the GtkCList structure (A big NO NO)  Any
ideas here would also be appreciated...

-Count Zero

czdnd.c



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]