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 module gtk.TreeDragSourceIF; 26 27 private import gobject.ObjectG; 28 private import gtk.SelectionData; 29 private import gtk.TreeModelIF; 30 private import gtk.TreePath; 31 private import gtk.c.functions; 32 public import gtk.c.types; 33 public import gtkc.gtktypes; 34 35 36 /** */ 37 public interface TreeDragSourceIF{ 38 /** Get the main Gtk struct */ 39 public GtkTreeDragSource* getTreeDragSourceStruct(bool transferOwnership = false); 40 41 /** the main Gtk struct as a void* */ 42 protected void* getStruct(); 43 44 45 /** */ 46 public static GType getType() 47 { 48 return gtk_tree_drag_source_get_type(); 49 } 50 51 /** 52 * Asks the #GtkTreeDragSource to delete the row at @path, because 53 * it was moved somewhere else via drag-and-drop. Returns %FALSE 54 * if the deletion fails because @path no longer exists, or for 55 * some model-specific reason. Should robustly handle a @path no 56 * longer found in the model! 57 * 58 * Params: 59 * path = row that was being dragged 60 * 61 * Returns: %TRUE if the row was successfully deleted 62 */ 63 public bool dragDataDelete(TreePath path); 64 65 /** 66 * Asks the #GtkTreeDragSource to fill in @selection_data with a 67 * representation of the row at @path. @selection_data->target gives 68 * the required type of the data. Should robustly handle a @path no 69 * longer found in the model! 70 * 71 * Params: 72 * path = row that was dragged 73 * selectionData = a #GtkSelectionData to fill with data 74 * from the dragged row 75 * 76 * Returns: %TRUE if data of the required type was provided 77 */ 78 public bool dragDataGet(TreePath path, SelectionData selectionData); 79 80 /** 81 * Asks the #GtkTreeDragSource whether a particular row can be used as 82 * the source of a DND operation. If the source doesn’t implement 83 * this interface, the row is assumed draggable. 84 * 85 * Params: 86 * path = row on which user is initiating a drag 87 * 88 * Returns: %TRUE if the row can be dragged 89 */ 90 public bool rowDraggable(TreePath path); 91 92 /** 93 * Obtains a @tree_model and @path from selection data of target type 94 * %GTK_TREE_MODEL_ROW. Normally called from a drag_data_received handler. 95 * This function can only be used if @selection_data originates from the same 96 * process that’s calling this function, because a pointer to the tree model 97 * is being passed around. If you aren’t in the same process, then you'll 98 * get memory corruption. In the #GtkTreeDragDest drag_data_received handler, 99 * you can assume that selection data of type %GTK_TREE_MODEL_ROW is 100 * in from the current process. The returned path must be freed with 101 * gtk_tree_path_free(). 102 * 103 * Params: 104 * selectionData = a #GtkSelectionData 105 * treeModel = a #GtkTreeModel 106 * path = row in @tree_model 107 * 108 * Returns: %TRUE if @selection_data had target type %GTK_TREE_MODEL_ROW and 109 * is otherwise valid 110 */ 111 public static bool getRowDragData(SelectionData selectionData, out TreeModelIF treeModel, out TreePath path) 112 { 113 GtkTreeModel* outtreeModel = null; 114 GtkTreePath* outpath = null; 115 116 auto p = gtk_tree_get_row_drag_data((selectionData is null) ? null : selectionData.getSelectionDataStruct(), &outtreeModel, &outpath) != 0; 117 118 treeModel = ObjectG.getDObject!(TreeModelIF)(outtreeModel); 119 path = ObjectG.getDObject!(TreePath)(outpath); 120 121 return p; 122 } 123 124 /** 125 * Sets selection data of target type %GTK_TREE_MODEL_ROW. Normally used 126 * in a drag_data_get handler. 127 * 128 * Params: 129 * selectionData = some #GtkSelectionData 130 * treeModel = a #GtkTreeModel 131 * path = a row in @tree_model 132 * 133 * Returns: %TRUE if the #GtkSelectionData had the proper target type to allow us to set a tree row 134 */ 135 public static bool setRowDragData(SelectionData selectionData, TreeModelIF treeModel, TreePath path) 136 { 137 return gtk_tree_set_row_drag_data((selectionData is null) ? null : selectionData.getSelectionDataStruct(), (treeModel is null) ? null : treeModel.getTreeModelStruct(), (path is null) ? null : path.getTreePathStruct()) != 0; 138 } 139 }