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.TreeDragSourceT; 26 27 public import gdk.ContentProvider; 28 public import gobject.ObjectG; 29 public import gtk.TreePath; 30 public import gtk.c.functions; 31 public import gtk.c.types; 32 33 34 /** 35 * Interface for Drag-and-Drop destinations in `GtkTreeView`. 36 */ 37 public template TreeDragSourceT(TStruct) 38 { 39 /** Get the main Gtk struct */ 40 public GtkTreeDragSource* getTreeDragSourceStruct(bool transferOwnership = false) 41 { 42 if (transferOwnership) 43 ownedRef = false; 44 return cast(GtkTreeDragSource*)getStruct(); 45 } 46 47 48 /** 49 * Asks the #GtkTreeDragSource to delete the row at @path, because 50 * it was moved somewhere else via drag-and-drop. Returns %FALSE 51 * if the deletion fails because @path no longer exists, or for 52 * some model-specific reason. Should robustly handle a @path no 53 * longer found in the model! 54 * 55 * Params: 56 * path = row that was being dragged 57 * 58 * Returns: %TRUE if the row was successfully deleted 59 */ 60 public bool dragDataDelete(TreePath path) 61 { 62 return gtk_tree_drag_source_drag_data_delete(getTreeDragSourceStruct(), (path is null) ? null : path.getTreePathStruct()) != 0; 63 } 64 65 /** 66 * Asks the #GtkTreeDragSource to return a #GdkContentProvider representing 67 * the row at @path. Should robustly handle a @path no 68 * longer found in the model! 69 * 70 * Params: 71 * path = row that was dragged 72 * 73 * Returns: a #GdkContentProvider for the 74 * given @path or %NULL if none exists 75 */ 76 public ContentProvider dragDataGet(TreePath path) 77 { 78 auto __p = gtk_tree_drag_source_drag_data_get(getTreeDragSourceStruct(), (path is null) ? null : path.getTreePathStruct()); 79 80 if(__p is null) 81 { 82 return null; 83 } 84 85 return ObjectG.getDObject!(ContentProvider)(cast(GdkContentProvider*) __p, true); 86 } 87 88 /** 89 * Asks the #GtkTreeDragSource whether a particular row can be used as 90 * the source of a DND operation. If the source doesn’t implement 91 * this interface, the row is assumed draggable. 92 * 93 * Params: 94 * path = row on which user is initiating a drag 95 * 96 * Returns: %TRUE if the row can be dragged 97 */ 98 public bool rowDraggable(TreePath path) 99 { 100 return gtk_tree_drag_source_row_draggable(getTreeDragSourceStruct(), (path is null) ? null : path.getTreePathStruct()) != 0; 101 } 102 }