1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 /* 25 * Conversion parameters: 26 * inFile = gtk-GtkTreeView-drag-and-drop.html 27 * outPack = gtk 28 * outFile = TreeDragSourceIF 29 * strct = GtkTreeDragSource 30 * realStrct= 31 * ctorStrct= 32 * clss = TreeDragSourceT 33 * interf = TreeDragSourceIF 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_tree_drag_source_ 41 * - gtk_tree_ 42 * omit structs: 43 * omit prefixes: 44 * - gtk_tree_drag_dest_ 45 * omit code: 46 * omit signals: 47 * imports: 48 * - gtk.TreePath 49 * - gtk.TreeModelIF 50 * - gtk.TreeModel 51 * structWrap: 52 * - GtkTreeModel* -> TreeModelIF 53 * - GtkTreePath* -> TreePath 54 * module aliases: 55 * local aliases: 56 * overrides: 57 */ 58 59 module gtk.TreeDragSourceIF; 60 61 public import gtkc.gtktypes; 62 63 private import gtkc.gtk; 64 private import glib.ConstructionException; 65 private import gobject.ObjectG; 66 67 68 private import gtk.TreePath; 69 private import gtk.TreeModelIF; 70 private import gtk.TreeModel; 71 72 73 74 75 /** 76 * Description 77 * GTK+ supports Drag-and-Drop in tree views with a high-level and a low-level 78 * API. 79 * The low-level API consists of the GTK+ DND API, augmented by some treeview 80 * utility functions: gtk_tree_view_set_drag_dest_row(), 81 * gtk_tree_view_get_drag_dest_row(), gtk_tree_view_get_dest_row_at_pos(), 82 * gtk_tree_view_create_row_drag_icon(), gtk_tree_set_row_drag_data() and 83 * gtk_tree_get_row_drag_data(). This API leaves a lot of flexibility, but 84 * nothing is done automatically, and implementing advanced features like 85 * hover-to-open-rows or autoscrolling on top of this API is a lot of work. 86 * On the other hand, if you write to the high-level API, then all the 87 * bookkeeping of rows is done for you, as well as things like hover-to-open 88 * and auto-scroll, but your models have to implement the 89 * GtkTreeDragSource and GtkTreeDragDest interfaces. 90 */ 91 public interface TreeDragSourceIF 92 { 93 94 95 public GtkTreeDragSource* getTreeDragSourceTStruct(); 96 97 /** the main Gtk struct as a void* */ 98 protected void* getStruct(); 99 100 101 /** 102 */ 103 104 /** 105 * Asks the GtkTreeDragSource to delete the row at path, because 106 * it was moved somewhere else via drag-and-drop. Returns FALSE 107 * if the deletion fails because path no longer exists, or for 108 * some model-specific reason. Should robustly handle a path no 109 * longer found in the model! 110 * Params: 111 * path = row that was being dragged 112 * Returns: TRUE if the row was successfully deleted 113 */ 114 public int dragDataDelete(TreePath path); 115 116 /** 117 * Asks the GtkTreeDragSource to fill in selection_data with a 118 * representation of the row at path. selection_data->target gives 119 * the required type of the data. Should robustly handle a path no 120 * longer found in the model! 121 * Params: 122 * path = row that was dragged 123 * selectionData = a GtkSelectionData to fill with data 124 * from the dragged row. [out] 125 * Returns: TRUE if data of the required type was provided 126 */ 127 public int dragDataGet(TreePath path, GtkSelectionData* selectionData); 128 129 /** 130 * Asks the GtkTreeDragSource whether a particular row can be used as 131 * the source of a DND operation. If the source doesn't implement 132 * this interface, the row is assumed draggable. 133 * Params: 134 * path = row on which user is initiating a drag 135 * Returns: TRUE if the row can be dragged 136 */ 137 public int rowDraggable(TreePath path); 138 139 /** 140 * Sets selection data of target type GTK_TREE_MODEL_ROW. Normally used 141 * in a drag_data_get handler. 142 * Params: 143 * selectionData = some GtkSelectionData 144 * treeModel = a GtkTreeModel 145 * path = a row in tree_model 146 * Returns: TRUE if the GtkSelectionData had the proper target type to allow us to set a tree row 147 */ 148 public static int setRowDragData(GtkSelectionData* selectionData, TreeModelIF treeModel, TreePath path); 149 150 /** 151 * Obtains a tree_model and path from selection data of target type 152 * GTK_TREE_MODEL_ROW. Normally called from a drag_data_received handler. 153 * This function can only be used if selection_data originates from the same 154 * process that's calling this function, because a pointer to the tree model 155 * is being passed around. If you aren't in the same process, then you'll 156 * get memory corruption. In the GtkTreeDragDest drag_data_received handler, 157 * you can assume that selection data of type GTK_TREE_MODEL_ROW is 158 * in from the current process. The returned path must be freed with 159 * gtk_tree_path_free(). 160 * Params: 161 * selectionData = a GtkSelectionData 162 * treeModel = a GtkTreeModel. [out] 163 * path = row in tree_model. [out] 164 * Returns: TRUE if selection_data had target type GTK_TREE_MODEL_ROW and is otherwise valid 165 */ 166 public static int getRowDragData(GtkSelectionData* selectionData, out TreeModelIF treeModel, out TreePath path); 167 }