X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtktreednd.c;h=d65cdc09737beb6c33162c1d6b54593aada74b79;hb=1708ae3f1a962d3bbfcc0e673c5fa9f629d16eae;hp=7e079457e975de1bf1813b43f04333bbd63c157c;hpb=d97cdbdf53832729141b3b66de00f770b44e3390;p=~andy%2Fgtk diff --git a/gtk/gtktreednd.c b/gtk/gtktreednd.c index 7e079457e..d65cdc097 100644 --- a/gtk/gtktreednd.c +++ b/gtk/gtktreednd.c @@ -12,16 +12,37 @@ * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * License along with this library. If not, see . */ #include "config.h" #include #include "gtktreednd.h" #include "gtkintl.h" -#include "gtkalias.h" + + +/** + * SECTION:gtktreednd + * @Short_description: Interfaces for drag-and-drop support in GtkTreeView + * @Title: GtkTreeView drag-and-drop + * + * 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. + */ + GType gtk_tree_drag_source_get_type (void) @@ -136,7 +157,8 @@ gtk_tree_drag_source_drag_data_delete (GtkTreeDragSource *drag_source, * gtk_tree_drag_source_drag_data_get: * @drag_source: a #GtkTreeDragSource * @path: row that was dragged - * @selection_data: a #GtkSelectionData to fill with data from the dragged row + * @selection_data: a #GtkSelectionData to fill with data + * from the dragged row * * Asks the #GtkTreeDragSource to fill in @selection_data with a * representation of the row at @path. @selection_data->target gives @@ -250,7 +272,7 @@ gtk_tree_set_row_drag_data (GtkSelectionData *selection_data, g_return_val_if_fail (GTK_IS_TREE_MODEL (tree_model), FALSE); g_return_val_if_fail (path != NULL, FALSE); - if (selection_data->target != gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW")) + if (gtk_selection_data_get_target (selection_data) != gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW")) return FALSE; path_str = gtk_tree_path_to_string (path); @@ -283,8 +305,8 @@ gtk_tree_set_row_drag_data (GtkSelectionData *selection_data, /** * gtk_tree_get_row_drag_data: * @selection_data: a #GtkSelectionData - * @tree_model: a #GtkTreeModel - * @path: row in @tree_model + * @tree_model: (out): a #GtkTreeModel + * @path: (out): row in @tree_model * * Obtains a @tree_model and @path from selection data of target type * %GTK_TREE_MODEL_ROW. Normally called from a drag_data_received handler. @@ -313,14 +335,14 @@ gtk_tree_get_row_drag_data (GtkSelectionData *selection_data, if (path) *path = NULL; - - if (selection_data->target != gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW")) + + if (gtk_selection_data_get_target (selection_data) != gdk_atom_intern_static_string ("GTK_TREE_MODEL_ROW")) return FALSE; - if (selection_data->length < 0) + if (gtk_selection_data_get_length (selection_data) < 0) return FALSE; - trd = (void*) selection_data->data; + trd = (void*) gtk_selection_data_get_data (selection_data); if (tree_model) *tree_model = trd->model; @@ -330,6 +352,3 @@ gtk_tree_get_row_drag_data (GtkSelectionData *selection_data, return TRUE; } - -#define __GTK_TREE_DND_C__ -#include "gtkaliasdef.c"