CTree patch to add conditional drag reordering



Hello.

This is a patch to gtkctree.[ch] to add this function:

void       gtk_ctree_set_drag_compare_func  (GtkCTree     *ctree,
                                            GtkCTreeCompareDragFunc cmp_func);

It allows you to set a compare function to test if a node can be reordered
by dragging. The comparison is passed the node being dragged and the node's
possible new parent and sibling. The basic compare function looks like this:

gint default_drag_compare       (GtkCTree     *clist,
                                 GtkCTreeNode *source_node,
                                 GtkCTreeNode *new_parent,
                                 GtkCTreeNode *new_sibling)
{
       if [tests here]
         return TRUE;
       else
         return FALSE;
}

The only feature missing is changing the pointer as it passes over a new drop
target. If this patch is acceptable to be included in GTK, I can work on adding
the pointer change.

John
--
John Ellis <johne@bellatlantic.net>
http://www.geocities.com/SiliconValley/Haven/5235/

ctree_drag_comp.patch.gz



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