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.NoSelection;
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  * `GtkNoSelection` is a `GtkSelectionModel` that does not allow selecting
39  * anything.
40  * 
41  * This model is meant to be used as a simple wrapper around a `GListModel`
42  * when a `GtkSelectionModel` is required.
43  */
44 public class NoSelection : ObjectG, ListModelIF, SelectionModelIF
45 {
46 	/** the main Gtk struct */
47 	protected GtkNoSelection* gtkNoSelection;
48 
49 	/** Get the main Gtk struct */
50 	public GtkNoSelection* getNoSelectionStruct(bool transferOwnership = false)
51 	{
52 		if (transferOwnership)
53 			ownedRef = false;
54 		return gtkNoSelection;
55 	}
56 
57 	/** the main Gtk struct as a void* */
58 	protected override void* getStruct()
59 	{
60 		return cast(void*)gtkNoSelection;
61 	}
62 
63 	/**
64 	 * Sets our main struct and passes it to the parent class.
65 	 */
66 	public this (GtkNoSelection* gtkNoSelection, bool ownedRef = false)
67 	{
68 		this.gtkNoSelection = gtkNoSelection;
69 		super(cast(GObject*)gtkNoSelection, ownedRef);
70 	}
71 
72 	// add the ListModel capabilities
73 	mixin ListModelT!(GtkNoSelection);
74 
75 	// add the SelectionModel capabilities
76 	mixin SelectionModelT!(GtkNoSelection);
77 
78 
79 	/** */
80 	public static GType getType()
81 	{
82 		return gtk_no_selection_get_type();
83 	}
84 
85 	/**
86 	 * Creates a new selection to handle @model.
87 	 *
88 	 * Params:
89 	 *     model = the `GListModel` to manage, or %NULL
90 	 *
91 	 * Returns: a new `GtkNoSelection`
92 	 *
93 	 * Throws: ConstructionException GTK+ fails to create the object.
94 	 */
95 	public this(ListModelIF model)
96 	{
97 		auto __p = gtk_no_selection_new((model is null) ? null : model.getListModelStruct());
98 
99 		if(__p is null)
100 		{
101 			throw new ConstructionException("null returned by new");
102 		}
103 
104 		this(cast(GtkNoSelection*) __p, true);
105 	}
106 
107 	/**
108 	 * Gets the model that @self is wrapping.
109 	 *
110 	 * Returns: The model being wrapped
111 	 */
112 	public ListModelIF getModel()
113 	{
114 		auto __p = gtk_no_selection_get_model(gtkNoSelection);
115 
116 		if(__p is null)
117 		{
118 			return null;
119 		}
120 
121 		return ObjectG.getDObject!(ListModelIF)(cast(GListModel*) __p);
122 	}
123 
124 	/**
125 	 * Sets the model that @self should wrap.
126 	 *
127 	 * If @model is %NULL, this model will be empty.
128 	 *
129 	 * Params:
130 	 *     model = A `GListModel` to wrap
131 	 */
132 	public void setModel(ListModelIF model)
133 	{
134 		gtk_no_selection_set_model(gtkNoSelection, (model is null) ? null : model.getListModelStruct());
135 	}
136 }