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.FlattenListModel; 26 27 private import gio.ListModelIF; 28 private import gio.ListModelT; 29 private import glib.ConstructionException; 30 private import gobject.ObjectG; 31 private import gtk.c.functions; 32 public import gtk.c.types; 33 34 35 /** 36 * `GtkFlattenListModel` is a list model that concatenates other list models. 37 * 38 * `GtkFlattenListModel` takes a list model containing list models, 39 * and flattens it into a single model. 40 */ 41 public class FlattenListModel : ObjectG, ListModelIF 42 { 43 /** the main Gtk struct */ 44 protected GtkFlattenListModel* gtkFlattenListModel; 45 46 /** Get the main Gtk struct */ 47 public GtkFlattenListModel* getFlattenListModelStruct(bool transferOwnership = false) 48 { 49 if (transferOwnership) 50 ownedRef = false; 51 return gtkFlattenListModel; 52 } 53 54 /** the main Gtk struct as a void* */ 55 protected override void* getStruct() 56 { 57 return cast(void*)gtkFlattenListModel; 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (GtkFlattenListModel* gtkFlattenListModel, bool ownedRef = false) 64 { 65 this.gtkFlattenListModel = gtkFlattenListModel; 66 super(cast(GObject*)gtkFlattenListModel, ownedRef); 67 } 68 69 // add the ListModel capabilities 70 mixin ListModelT!(GtkFlattenListModel); 71 72 73 /** */ 74 public static GType getType() 75 { 76 return gtk_flatten_list_model_get_type(); 77 } 78 79 /** 80 * Creates a new `GtkFlattenListModel` that flattens @list. 81 * 82 * Params: 83 * model = the model to be flattened 84 * 85 * Returns: a new `GtkFlattenListModel` 86 * 87 * Throws: ConstructionException GTK+ fails to create the object. 88 */ 89 public this(ListModelIF model) 90 { 91 auto __p = gtk_flatten_list_model_new((model is null) ? null : model.getListModelStruct()); 92 93 if(__p is null) 94 { 95 throw new ConstructionException("null returned by new"); 96 } 97 98 this(cast(GtkFlattenListModel*) __p, true); 99 } 100 101 /** 102 * Gets the model set via gtk_flatten_list_model_set_model(). 103 * 104 * Returns: The model flattened by @self 105 */ 106 public ListModelIF getModel() 107 { 108 auto __p = gtk_flatten_list_model_get_model(gtkFlattenListModel); 109 110 if(__p is null) 111 { 112 return null; 113 } 114 115 return ObjectG.getDObject!(ListModelIF)(cast(GListModel*) __p); 116 } 117 118 /** 119 * Returns the model containing the item at the given position. 120 * 121 * Params: 122 * position = a position 123 * 124 * Returns: the model containing the item at @position 125 */ 126 public ListModelIF getModelForItem(uint position) 127 { 128 auto __p = gtk_flatten_list_model_get_model_for_item(gtkFlattenListModel, position); 129 130 if(__p is null) 131 { 132 return null; 133 } 134 135 return ObjectG.getDObject!(ListModelIF)(cast(GListModel*) __p); 136 } 137 138 /** 139 * Sets a new model to be flattened. 140 * 141 * Params: 142 * model = the new model or %NULL 143 */ 144 public void setModel(ListModelIF model) 145 { 146 gtk_flatten_list_model_set_model(gtkFlattenListModel, (model is null) ? null : model.getListModelStruct()); 147 } 148 }