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 = 27 * outPack = gtk 28 * outFile = TreeDragDestIF 29 * strct = GtkTreeDragDest 30 * realStrct= 31 * ctorStrct= 32 * clss = TreeDragDestT 33 * interf = TreeDragDestIF 34 * class Code: No 35 * interface Code: Yes 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_tree_drag_dest_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - gtk.SelectionData 47 * - gtk.TreeModelIF 48 * - gtk.TreePath 49 * structWrap: 50 * - GtkSelectionData* -> SelectionData 51 * - GtkTreePath* -> TreePath 52 * module aliases: 53 * local aliases: 54 * overrides: 55 */ 56 57 module gtk.TreeDragDestIF; 58 59 public import gtkc.gtktypes; 60 61 private import gtkc.gtk; 62 private import glib.ConstructionException; 63 private import gobject.ObjectG; 64 65 66 private import gtk.SelectionData; 67 private import gtk.TreeModelIF; 68 private import gtk.TreePath; 69 70 71 72 73 /** 74 * GTK+ supports Drag-and-Drop in tree views with a high-level and a low-level 75 * API. 76 * 77 * The low-level API consists of the GTK+ DND API, augmented by some treeview 78 * utility functions: gtk_tree_view_set_drag_dest_row(), 79 * gtk_tree_view_get_drag_dest_row(), gtk_tree_view_get_dest_row_at_pos(), 80 * gtk_tree_view_create_row_drag_icon(), gtk_tree_set_row_drag_data() and 81 * gtk_tree_get_row_drag_data(). This API leaves a lot of flexibility, but 82 * nothing is done automatically, and implementing advanced features like 83 * hover-to-open-rows or autoscrolling on top of this API is a lot of work. 84 * 85 * On the other hand, if you write to the high-level API, then all the 86 * bookkeeping of rows is done for you, as well as things like hover-to-open 87 * and auto-scroll, but your models have to implement the 88 * GtkTreeDragSource and GtkTreeDragDest interfaces. 89 */ 90 public interface TreeDragDestIF 91 { 92 93 94 public GtkTreeDragDest* getTreeDragDestTStruct(); 95 96 /** the main Gtk struct as a void* */ 97 protected void* getStruct(); 98 99 100 /** 101 * Sets selection data of target type GTK_TREE_MODEL_ROW. Normally used 102 * in a drag_data_get handler. 103 * Params: 104 * selectionData = some GtkSelectionData 105 * treeModel = a GtkTreeModel 106 * path = a row in tree_model 107 * Returns: TRUE if the GtkSelectionData had the proper target type to allow us to set a tree row 108 */ 109 public static int setRowDragData(SelectionData selectionData, TreeModelIF treeModel, TreePath path); 110 111 /** 112 * Obtains a tree_model and path from selection data of target type 113 * GTK_TREE_MODEL_ROW. Normally called from a drag_data_received handler. 114 * This function can only be used if selection_data originates from the same 115 * process that's calling this function, because a pointer to the tree model 116 * is being passed around. If you aren't in the same process, then you'll 117 * get memory corruption. In the GtkTreeDragDest drag_data_received handler, 118 * you can assume that selection data of type GTK_TREE_MODEL_ROW is 119 * in from the current process. The returned path must be freed with 120 * gtk_tree_path_free(). 121 * Params: 122 * selectionData = a GtkSelectionData 123 * treeModel = a GtkTreeModel 124 * path = row in tree_model 125 * Returns: TRUE if selection_data had target type GTK_TREE_MODEL_ROW and is otherwise valid 126 */ 127 public static int getRowDragData(SelectionData selectionData, out TreeModelIF treeModel, out TreePath path); 128 129 /** 130 */ 131 132 /** 133 * Asks the GtkTreeDragDest to insert a row before the path dest, 134 * deriving the contents of the row from selection_data. If dest is 135 * outside the tree so that inserting before it is impossible, FALSE 136 * will be returned. Also, FALSE may be returned if the new row is 137 * not created for some model-specific reason. Should robustly handle 138 * a dest no longer found in the model! 139 * Params: 140 * dest = row to drop in front of 141 * selectionData = data to drop 142 * Returns: whether a new row was created before position dest 143 */ 144 public int dragDataReceived(TreePath dest, SelectionData selectionData); 145 146 /** 147 * Determines whether a drop is possible before the given dest_path, 148 * at the same depth as dest_path. i.e., can we drop the data in 149 * selection_data at that location. dest_path does not have to 150 * exist; the return value will almost certainly be FALSE if the 151 * parent of dest_path doesn't exist, though. 152 * Params: 153 * destPath = destination row 154 * selectionData = the data being dragged 155 * Returns: TRUE if a drop is possible before dest_path 156 */ 157 public int rowDropPossible(TreePath destPath, SelectionData selectionData); 158 }