diff options
author | Owen Taylor <otaylor@redhat.com> | 2001-11-06 19:10:03 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2001-11-06 19:10:03 +0000 |
commit | 57479a86be71dfac361633838c8129267a278233 (patch) | |
tree | bea7db92dfed63a68122f5ad4a390b21bb68d3ad /gtk/gtktreednd.c | |
parent | 9bb17278c47fe892962494ab6e942c7a103c598f (diff) | |
download | gtk+-57479a86be71dfac361633838c8129267a278233.tar.gz |
Add row_draggable() vfunc, and wrapper function.
Mon Nov 5 22:34:29 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtktreednd.[ch] (struct _GtkTreeDragSourceIface):
Add row_draggable() vfunc, and wrapper function.
* gtk/gtktreednd.[ch] (struct _GtkTreeDragDestIface): Make
row_drop_possible take a GtkSelectionData, rather than
model/row pair.
* gtk/gtktreestore.c gtk/gtkliststore.c: Update for
new DND interfaces.
* gtk/gtktreeview.[ch]: Remove the row_draggable_func
location_dropable_func from gtk_tree_view_set_rows_drag_source/dest.
and rename them to enable_model_drag_source/dest.
* gtk/treeviewcolumn.c: Add DND of columns between rows.
Still can't drop _to_ the left tree, but other places
work.
* gtk/gtktreeview.c (unset_reorderable): Unset the
reorderable property if unset/enable_model_drag_source/dest
are called manually.
* gtk/gtktreestore.c (gtk_tree_store_row_drop_possible):
Correct for change in depth count handling.
* gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon):
Pass in a expose area to gtk_tree_view_column_cell_render()
Diffstat (limited to 'gtk/gtktreednd.c')
-rw-r--r-- | gtk/gtktreednd.c | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/gtk/gtktreednd.c b/gtk/gtktreednd.c index 8f1cd7b3af..22873b126a 100644 --- a/gtk/gtktreednd.c +++ b/gtk/gtktreednd.c @@ -73,6 +73,31 @@ gtk_tree_drag_dest_get_type (void) return our_type; } +/** + * gtk_tree_drag_source_row_draggable: + * @drag_source: a #GtkTreeDragSource + * @path: row on which user is initiating a drag + * + * Asks the #GtkTreeDragSource whether a particular row can be used as + * the source of a DND operation. If the source doesn't implement + * this interface, the row is assumed draggable. + * + * Return value: %TRUE if the row can be dragged + **/ +gboolean +gtk_tree_drag_source_row_draggable (GtkTreeDragSource *drag_source, + GtkTreePath *path) +{ + GtkTreeDragSourceIface *iface = GTK_TREE_DRAG_SOURCE_GET_IFACE (drag_source); + + g_return_val_if_fail (path != NULL, FALSE); + + if (iface->row_draggable) + return (* iface->row_draggable) (drag_source, path); + else + return TRUE; +} + /** * gtk_tree_drag_source_drag_data_delete: @@ -159,13 +184,12 @@ gtk_tree_drag_dest_drag_data_received (GtkTreeDragDest *drag_dest, /** * gtk_tree_drag_dest_drop_possible: * @drag_dest: a #GtkTreeDragDest - * @src_model: #GtkTreeModel being dragged from - * @src_path: row being dragged * @dest_path: destination row + * @selection_data: the data being dragged * * Determines whether a drop is possible before the given @dest_path, - * at the same depth as @dest_path. i.e., can we drop @src_model such - * that it now resides at @dest_path. @dest_path does not have to + * at the same depth as @dest_path. i.e., can we drop the data in + * @selection_data at that location. @dest_path does not have to * exist; the return value will almost certainly be %FALSE if the * parent of @dest_path doesn't exist, though. * @@ -173,18 +197,16 @@ gtk_tree_drag_dest_drag_data_received (GtkTreeDragDest *drag_dest, **/ gboolean gtk_tree_drag_dest_row_drop_possible (GtkTreeDragDest *drag_dest, - GtkTreeModel *src_model, - GtkTreePath *src_path, - GtkTreePath *dest_path) + GtkTreePath *dest_path, + GtkSelectionData *selection_data) { GtkTreeDragDestIface *iface = GTK_TREE_DRAG_DEST_GET_IFACE (drag_dest); g_return_val_if_fail (iface->row_drop_possible != NULL, FALSE); - g_return_val_if_fail (GTK_IS_TREE_MODEL (src_model), FALSE); - g_return_val_if_fail (src_path != NULL, FALSE); + g_return_val_if_fail (selection_data != NULL, FALSE); g_return_val_if_fail (dest_path != NULL, FALSE); - return (* iface->row_drop_possible) (drag_dest, src_model, src_path, dest_path); + return (* iface->row_drop_possible) (drag_dest, dest_path, selection_data); } typedef struct _TreeRowData TreeRowData; |