TreeDragSourceIF

Description GTK+ supports Drag-and-Drop in tree views with a high-level and a low-level API. The low-level API consists of the GTK+ DND API, augmented by some treeview utility functions: gtk_tree_view_set_drag_dest_row(), gtk_tree_view_get_drag_dest_row(), gtk_tree_view_get_dest_row_at_pos(), gtk_tree_view_create_row_drag_icon(), gtk_tree_set_row_drag_data() and gtk_tree_get_row_drag_data(). This API leaves a lot of flexibility, but nothing is done automatically, and implementing advanced features like hover-to-open-rows or autoscrolling on top of this API is a lot of work. On the other hand, if you write to the high-level API, then all the bookkeeping of rows is done for you, as well as things like hover-to-open and auto-scroll, but your models have to implement the GtkTreeDragSource and GtkTreeDragDest interfaces.

Members

Functions

dragDataDelete
int dragDataDelete(TreePath path)

Asks the GtkTreeDragSource to delete the row at path, because it was moved somewhere else via drag-and-drop. Returns FALSE if the deletion fails because path no longer exists, or for some model-specific reason. Should robustly handle a path no longer found in the model!

dragDataGet
int dragDataGet(TreePath path, GtkSelectionData* selectionData)

Asks the GtkTreeDragSource to fill in selection_data with a representation of the row at path. selection_data->target gives the required type of the data. Should robustly handle a path no longer found in the model!

getStruct
void* getStruct()

the main Gtk struct as a void*

getTreeDragSourceTStruct
GtkTreeDragSource* getTreeDragSourceTStruct()
Undocumented in source.
rowDraggable
int rowDraggable(TreePath path)

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.

Static functions

getRowDragData
int getRowDragData(GtkSelectionData* selectionData, TreeModelIF treeModel, TreePath path)

Obtains a tree_model and path from selection data of target type GTK_TREE_MODEL_ROW. Normally called from a drag_data_received handler. This function can only be used if selection_data originates from the same process that's calling this function, because a pointer to the tree model is being passed around. If you aren't in the same process, then you'll get memory corruption. In the GtkTreeDragDest drag_data_received handler, you can assume that selection data of type GTK_TREE_MODEL_ROW is in from the current process. The returned path must be freed with gtk_tree_path_free().

setRowDragData
int setRowDragData(GtkSelectionData* selectionData, TreeModelIF treeModel, TreePath path)

Sets selection data of target type GTK_TREE_MODEL_ROW. Normally used in a drag_data_get handler.

Meta