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.MultiSelection; 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.SelectionModelIF; 32 private import gtk.SelectionModelT; 33 private import gtk.c.functions; 34 public import gtk.c.types; 35 36 37 /** 38 * `GtkMultiSelection` is a `GtkSelectionModel` that allows selecting multiple 39 * elements. 40 */ 41 public class MultiSelection : ObjectG, ListModelIF, SelectionModelIF 42 { 43 /** the main Gtk struct */ 44 protected GtkMultiSelection* gtkMultiSelection; 45 46 /** Get the main Gtk struct */ 47 public GtkMultiSelection* getMultiSelectionStruct(bool transferOwnership = false) 48 { 49 if (transferOwnership) 50 ownedRef = false; 51 return gtkMultiSelection; 52 } 53 54 /** the main Gtk struct as a void* */ 55 protected override void* getStruct() 56 { 57 return cast(void*)gtkMultiSelection; 58 } 59 60 /** 61 * Sets our main struct and passes it to the parent class. 62 */ 63 public this (GtkMultiSelection* gtkMultiSelection, bool ownedRef = false) 64 { 65 this.gtkMultiSelection = gtkMultiSelection; 66 super(cast(GObject*)gtkMultiSelection, ownedRef); 67 } 68 69 // add the ListModel capabilities 70 mixin ListModelT!(GtkMultiSelection); 71 72 // add the SelectionModel capabilities 73 mixin SelectionModelT!(GtkMultiSelection); 74 75 76 /** */ 77 public static GType getType() 78 { 79 return gtk_multi_selection_get_type(); 80 } 81 82 /** 83 * Creates a new selection to handle @model. 84 * 85 * Params: 86 * model = the `GListModel` to manage, or %NULL 87 * 88 * Returns: a new `GtkMultiSelection` 89 * 90 * Throws: ConstructionException GTK+ fails to create the object. 91 */ 92 public this(ListModelIF model) 93 { 94 auto __p = gtk_multi_selection_new((model is null) ? null : model.getListModelStruct()); 95 96 if(__p is null) 97 { 98 throw new ConstructionException("null returned by new"); 99 } 100 101 this(cast(GtkMultiSelection*) __p, true); 102 } 103 104 /** 105 * Returns the underlying model of @self. 106 * 107 * Returns: the underlying model 108 */ 109 public ListModelIF getModel() 110 { 111 auto __p = gtk_multi_selection_get_model(gtkMultiSelection); 112 113 if(__p is null) 114 { 115 return null; 116 } 117 118 return ObjectG.getDObject!(ListModelIF)(cast(GListModel*) __p); 119 } 120 121 /** 122 * Sets the model that @self should wrap. 123 * 124 * If @model is %NULL, @self will be empty. 125 * 126 * Params: 127 * model = A `GListModel` to wrap 128 */ 129 public void setModel(ListModelIF model) 130 { 131 gtk_multi_selection_set_model(gtkMultiSelection, (model is null) ? null : model.getListModelStruct()); 132 } 133 }