2 * This file is part of duit.
4 * duit is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * duit is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with duit; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gtk-GtkTreeView-drag-and-drop.html
27 * outFile = TreeDragSource
28 * strct = GtkTreeDragSource
31 * clss = TreeDragSource
48 * - GtkTreeModel* -> TreeModel
49 * - GtkTreePath* -> TreePath
53 module gtk
.TreeDragSource
;
55 private import gtk
.gtktypes
;
57 private import lib
.gtk
;
59 private import gtk
.TreePath
;
60 private import gtk
.TreeModel
;
64 * GTK+ supports Drag-and-Drop in tree views with a high-level and a low-level
66 * The low-level API consists of the GTK+ DND API, augmented by some treeview
67 * utility functions: gtk_tree_view_set_drag_dest_row(),
68 * gtk_tree_view_get_drag_dest_row(), gtk_tree_view_get_dest_row_at_pos(),
69 * gtk_tree_view_create_row_drag_icon(), gtk_tree_set_row_drag_data() and
70 * gtk_tree_get_row_drag_data(). This API leaves a lot of flexibility, but
71 * nothing is done automatically, and implementing advanced features like
72 * hover-to-open-rows or autoscrolling on top of this API is a lot of work.
73 * On the other hand, if you write to the high-level API, then all the
74 * bookkeeping of rows is done for you, as well as things like hover-to-open
75 * and auto-scroll, but your models have to implement the
76 * GtkTreeDragSource and GtkTreeDragDest interfaces.
78 public class TreeDragSource
81 /** the main Gtk struct */
82 protected GtkTreeDragSource
* gtkTreeDragSource
;
85 public GtkTreeDragSource
* getTreeDragSourceStruct()
87 return gtkTreeDragSource
;
91 /** the main Gtk struct as a void* */
92 protected void* getStruct()
94 return cast(void*)gtkTreeDragSource
;
98 * Sets our main struct and passes it to the parent class
100 public this (GtkTreeDragSource
* gtkTreeDragSource
)
102 this.gtkTreeDragSource
= gtkTreeDragSource
;
111 * Asks the GtkTreeDragSource to delete the row at path, because
112 * it was moved somewhere else via drag-and-drop. Returns FALSE
113 * if the deletion fails because path no longer exists, or for
114 * some model-specific reason. Should robustly handle a path no
115 * longer found in the model!
117 * a GtkTreeDragSource
119 * row that was being dragged
121 * TRUE if the row was successfully deleted
123 public int sourceDragDataDelete(TreePath path
)
125 // gboolean gtk_tree_drag_source_drag_data_delete (GtkTreeDragSource *drag_source, GtkTreePath *path);
126 return gtk_tree_drag_source_drag_data_delete(gtkTreeDragSource
, (path
is null) ?
null : path
.getTreePathStruct());
130 * Asks the GtkTreeDragSource to fill in selection_data with a
131 * representation of the row at path. selection_data->target gives
132 * the required type of the data. Should robustly handle a path no
133 * longer found in the model!
135 * a GtkTreeDragSource
137 * row that was dragged
139 * a GtkSelectionData to fill with data from the dragged row
141 * TRUE if data of the required type was provided
143 public int sourceDragDataGet(TreePath path
, GtkSelectionData
* selectionData
)
145 // gboolean gtk_tree_drag_source_drag_data_get (GtkTreeDragSource *drag_source, GtkTreePath *path, GtkSelectionData *selection_data);
146 return gtk_tree_drag_source_drag_data_get(gtkTreeDragSource
, (path
is null) ?
null : path
.getTreePathStruct(), selectionData
);
150 * Asks the GtkTreeDragSource whether a particular row can be used as
151 * the source of a DND operation. If the source doesn't implement
152 * this interface, the row is assumed draggable.
154 * a GtkTreeDragSource
156 * row on which user is initiating a drag
158 * TRUE if the row can be dragged
160 public int sourceRowDraggable(TreePath path
)
162 // gboolean gtk_tree_drag_source_row_draggable (GtkTreeDragSource *drag_source, GtkTreePath *path);
163 return gtk_tree_drag_source_row_draggable(gtkTreeDragSource
, (path
is null) ?
null : path
.getTreePathStruct());
169 * Asks the GtkTreeDragDest to insert a row before the path dest,
170 * deriving the contents of the row from selection_data. If dest is
171 * outside the tree so that inserting before it is impossible, FALSE
172 * will be returned. Also, FALSE may be returned if the new row is
173 * not created for some model-specific reason. Should robustly handle
174 * a dest no longer found in the model!
178 * row to drop in front of
182 * whether a new row was created before position dest
184 public static int destDragDataReceived(GtkTreeDragDest
* dragDest
, TreePath dest
, GtkSelectionData
* selectionData
)
186 // gboolean gtk_tree_drag_dest_drag_data_received (GtkTreeDragDest *drag_dest, GtkTreePath *dest, GtkSelectionData *selection_data);
187 return gtk_tree_drag_dest_drag_data_received(dragDest
, (dest
is null) ?
null : dest
.getTreePathStruct(), selectionData
);
191 * Determines whether a drop is possible before the given dest_path,
192 * at the same depth as dest_path. i.e., can we drop the data in
193 * selection_data at that location. dest_path does not have to
194 * exist; the return value will almost certainly be FALSE if the
195 * parent of dest_path doesn't exist, though.
201 * the data being dragged
203 * TRUE if a drop is possible before dest_path
205 public static int destRowDropPossible(GtkTreeDragDest
* dragDest
, TreePath destPath
, GtkSelectionData
* selectionData
)
207 // gboolean gtk_tree_drag_dest_row_drop_possible (GtkTreeDragDest *drag_dest, GtkTreePath *dest_path, GtkSelectionData *selection_data);
208 return gtk_tree_drag_dest_row_drop_possible(dragDest
, (destPath
is null) ?
null : destPath
.getTreePathStruct(), selectionData
);
212 * Sets selection data of target type GTK_TREE_MODEL_ROW. Normally used
213 * in a drag_data_get handler.
215 * some GtkSelectionData
219 * a row in tree_model
221 * TRUE if the GtkSelectionData had the proper target type to allow us to set a tree row
223 public static int treeSetRowDragData(GtkSelectionData
* selectionData
, TreeModel treeModel
, TreePath path
)
225 // gboolean gtk_tree_set_row_drag_data (GtkSelectionData *selection_data, GtkTreeModel *tree_model, GtkTreePath *path);
226 return gtk_tree_set_row_drag_data(selectionData
, (treeModel
is null) ?
null : treeModel
.getTreeModelStruct(), (path
is null) ?
null : path
.getTreePathStruct());
230 * Obtains a tree_model and path from selection data of target type
231 * GTK_TREE_MODEL_ROW. Normally called from a drag_data_received handler.
232 * This function can only be used if selection_data originates from the same
233 * process that's calling this function, because a pointer to the tree model
234 * is being passed around. If you aren't in the same process, then you'll
235 * get memory corruption. In the GtkTreeDragDest drag_data_received handler,
236 * you can assume that selection data of type GTK_TREE_MODEL_ROW is
237 * in from the current process. The returned path must be freed with
238 * gtk_tree_path_free().
246 * TRUE if selection_data had target type GTK_TREE_MODEL_ROW and
249 public static int treeGetRowDragData(GtkSelectionData
* selectionData
, GtkTreeModel
** treeModel
, GtkTreePath
** path
)
251 // gboolean gtk_tree_get_row_drag_data (GtkSelectionData *selection_data, GtkTreeModel **tree_model, GtkTreePath **path);
252 return gtk_tree_get_row_drag_data(selectionData
, treeModel
, path
);