Re: Drag and drop to/from GtkTreeView



On Sun, 2002-05-12 at 23:44, Taura Milana wrote:
On 2002.05.12 06:39 Renaud Chaillat wrote:

The long question follows :-)
By looking at the GtkTreeStore example, it made sense to implement 
GtkTreeDragDestIFace and GtkTreeDragSourceIFace in my own tree model.
Fine, and all works, except one little thing: there's no more 
"info" parameter in drag-data-get and drag-data-received handlers 
signatures. How can we format the data to export if we don't know 
the target ?

    Does the widget have the pointer motion mask set? It might
not be checking for motion events at all. Next you should take
a look at the updated GTK DND tutorial which now covers drag
motion.


Actually I think I've found an answer, but thanks anyway for replying
:-)

I took a closer look at the code, found a few interesting functions 
in gtktreeview.c, that lead me to gtktreednd.c, which has a very
interesting comment about GtkSelectionData : there's a "target" field, 
a GdkAtom that indicates the target format...

My old code with gtkctree used the "info" parameter in dnd signals
handlers to know this target format, using a simple switch on this int.
Now I'll go with elsif, and use a few gdk_atom_intern () calls.

This way I can do what I wanted: implement the GtkTreeDragDestIFace 
interface in my own GtkTreeModel, which I find cleaner (more object 
oriented maybe) than connect external signal handlers on the view and
block signals to override default gtktreeview dnd handlers.

It's odd that the gtktreednd.c comments do not figure yet in the 
gtk 2.0 api generated documentation. It's really useful :-)

Best regards,
Renaud




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