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.TreeIter; 26 27 private import gobject.ObjectG; 28 private import gtk.c.functions; 29 public import gtk.c.types; 30 private import gtkd.Loader; 31 32 33 /** 34 * The #GtkTreeIter is the primary structure 35 * for accessing a #GtkTreeModel. Models are expected to put a unique 36 * integer in the @stamp member, and put 37 * model-specific data in the three @user_data 38 * members. 39 */ 40 public class TreeIter 41 { 42 /** the main Gtk struct */ 43 protected GtkTreeIter* gtkTreeIter; 44 protected bool ownedRef; 45 46 /** Get the main Gtk struct */ 47 public GtkTreeIter* getTreeIterStruct(bool transferOwnership = false) 48 { 49 if (transferOwnership) 50 ownedRef = false; 51 return gtkTreeIter; 52 } 53 54 /** the main Gtk struct as a void* */ 55 protected void* getStruct() 56 { 57 return cast(void*)gtkTreeIter; 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (GtkTreeIter* gtkTreeIter, bool ownedRef = false) 64 { 65 this.gtkTreeIter = gtkTreeIter; 66 this.ownedRef = ownedRef; 67 } 68 69 ~this () 70 { 71 if ( Linker.isLoaded(LIBRARY_GTK) && ownedRef ) 72 gtk_tree_iter_free(gtkTreeIter); 73 } 74 75 76 /** */ 77 public static GType getType() 78 { 79 return gtk_tree_iter_get_type(); 80 } 81 82 /** 83 * Creates a dynamically allocated tree iterator as a copy of @iter. 84 * 85 * This function is not intended for use in applications, 86 * because you can just copy the structs by value 87 * (`GtkTreeIter new_iter = iter;`). 88 * You must free this iter with gtk_tree_iter_free(). 89 * 90 * Returns: a newly-allocated copy of @iter 91 */ 92 public TreeIter copy() 93 { 94 auto __p = gtk_tree_iter_copy(gtkTreeIter); 95 96 if(__p is null) 97 { 98 return null; 99 } 100 101 return ObjectG.getDObject!(TreeIter)(cast(GtkTreeIter*) __p, true); 102 } 103 104 /** 105 * Frees an iterator that has been allocated by gtk_tree_iter_copy(). 106 * 107 * This function is mainly used for language bindings. 108 */ 109 public void free() 110 { 111 gtk_tree_iter_free(gtkTreeIter); 112 ownedRef = false; 113 } 114 }