Re: [1.2] Drop on treeitem



On Fri, 2003-06-27 at 06:11, Gabriele Greco wrote:
Owen Taylor wrote:

I'm unable to make Drag'N'Drop work correctly on GtkTreeItem, my drop
routine works OK if called on a clist or on a tree, but I need to know
exactly on WHICH tree item the drop occurs, so I'm trying to setup my
tree calling gtk_drag_dest_set() for EACH treeitem of the tree. I've
read this should work in the 1.2 tutorial:
You won't be able to get it to work. GtkTree violated several
fundamental constraints of the GTK+ widget system, the one
that matters here is that every child widget must be contained
within the bounds of it's parent widget.

I don't know if what I've done is correct, but I've applied a patch I've
found on the net both to GTK 1.2.10 sources and to WIN32 GTK 1.3.0, the
patch is a small modification to gtktree.c and gtktreeitem.c that move
from the treeitem forall call to the tree forall call the treeitem
redraw callback, in this way I can do drag & drop (with visual highlight
too) on arbitrary treeitems.

I'm asking this because I'm actually using this patched GTK since a pair
of days and I don't see problems of any kind, so I don't understand why
a similar patch was not submitted to the official distribution!

This is definitely not correct and will break all sorts of things,
though they may not be obvious. But for example, with this change, 
you'll go over each item of the tree many times when propagating
state changes to the children of the tree.

GtkTree is unfixable. It never worked correctly, and DND isn't it's
only problem.

For a tree widget for GTK+-1.2, GtkCTree is a much better choice.
(Though the only type of DND you'll be able to get working
with GtkCTree is reordering, if I recall correctly.)

But, then again, GTK+-1.2 is dead, and I can't recommend using it
for any purpose other than running old applications that haven't
been ported yet.

Regards,
                                        Owen

diff -p gtk+-1.2.10/gtk/gtktree.c
/home/gabry/projects/gtk+-1.2.10/gtk/gtktree.c
*** gtk+-1.2.10/gtk/gtktree.c   2001-02-26 20:20:07.000000000 +0100
--- /home/gabry/projects/gtk+-1.2.10/gtk/gtktree.c      2003-06-27
11:21:19.000000000 +0200
*************** gtk_tree_forall (GtkContainer *container
*** 541,546 ****
--- 541,550 ----
         children = children->next;

         (* callback) (child, callback_data);
+             // ADDED by GG for DND patch
+       if (include_internals && GTK_TREE_ITEM(child)->subtree)
+           (* callback) (GTK_TREE_ITEM(child)->subtree, callback_data);
+
       }
   }

diff -p gtk+-1.2.10/gtk/gtktreeitem.c
/home/gabry/projects/gtk+-1.2.10/gtk/gtktreeitem.c
*** gtk+-1.2.10/gtk/gtktreeitem.c       2001-02-16 21:55:47.000000000 +0100
--- /home/gabry/projects/gtk+-1.2.10/gtk/gtktreeitem.c  2003-06-27
11:22:02.000000000 +0200
*************** gtk_tree_item_forall (GtkContainer *cont
*** 1112,1117 ****
--- 1112,1120 ----

     if (bin->child)
       (* callback) (bin->child, callback_data);
+ #if 0
+   // removed by GG for DnD patch
     if (include_internals && tree_item->subtree)
       (* callback) (tree_item->subtree, callback_data);
+ #endif
   }





_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list






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