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  * Conversion parameters:
26  * inFile  = 
27  * outPack = gtk
28  * outFile = ListBoxRow
29  * strct   = GtkListBoxRow
30  * realStrct=
31  * ctorStrct=
32  * clss    = ListBoxRow
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_list_box_row_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * 	- activate-cursor-row
46  * 	- move-cursor
47  * 	- row-activated
48  * 	- row-selected
49  * 	- toggle-cursor-row
50  * imports:
51  * 	- gtk.Widget
52  * structWrap:
53  * 	- GtkWidget* -> Widget
54  * module aliases:
55  * local aliases:
56  * overrides:
57  */
58 
59 module gtk.ListBoxRow;
60 
61 public  import gtkc.gtktypes;
62 
63 private import gtkc.gtk;
64 private import glib.ConstructionException;
65 private import gobject.ObjectG;
66 
67 private import gobject.Signals;
68 public  import gtkc.gdktypes;
69 private import gtk.Widget;
70 
71 
72 
73 /**
74  * A GtkListBox is a vertical container that contains GtkListBoxRow
75  * children. These rows can by dynamically sorted and filtered, and
76  * headers can be added dynamically depending on the row content.
77  * It also allows keyboard and mouse navigation and selection like
78  * a typical list.
79  *
80  * Using GtkListBox is often an alternative to GtkTreeView, especially
81  * when the list contents has a more complicated layout than what is allowed
82  * by a GtkCellRenderer, or when the contents is interactive (i.e. has a
83  * button in it).
84  *
85  * Although a GtkListBox must have only GtkListBoxRow children you can
86  * add any kind of widget to it via gtk_container_add(), and a GtkListBoxRow
87  * widget will automatically be inserted between the list and the widget.
88  *
89  * The GtkListBox widget was added in GTK+ 3.10.
90  */
91 public class ListBoxRow
92 {
93 	
94 	/** the main Gtk struct */
95 	protected GtkListBoxRow* gtkListBoxRow;
96 	
97 	
98 	/** Get the main Gtk struct */
99 	public GtkListBoxRow* getListBoxRowStruct()
100 	{
101 		return gtkListBoxRow;
102 	}
103 	
104 	
105 	/** the main Gtk struct as a void* */
106 	protected void* getStruct()
107 	{
108 		return cast(void*)gtkListBoxRow;
109 	}
110 	
111 	/**
112 	 * Sets our main struct and passes it to the parent class
113 	 */
114 	public this (GtkListBoxRow* gtkListBoxRow)
115 	{
116 		this.gtkListBoxRow = gtkListBoxRow;
117 	}
118 	
119 	/**
120 	 */
121 	int[string] connectedSignals;
122 	
123 	void delegate(ListBoxRow)[] onActivateListeners;
124 	/**
125 	 * See Also
126 	 * GtkScrolledWindow
127 	 */
128 	void addOnActivate(void delegate(ListBoxRow) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
129 	{
130 		if ( !("activate" in connectedSignals) )
131 		{
132 			Signals.connectData(
133 			getStruct(),
134 			"activate",
135 			cast(GCallback)&callBackActivate,
136 			cast(void*)this,
137 			null,
138 			connectFlags);
139 			connectedSignals["activate"] = 1;
140 		}
141 		onActivateListeners ~= dlg;
142 	}
143 	extern(C) static void callBackActivate(GtkListBoxRow* listboxrowStruct, ListBoxRow _listBoxRow)
144 	{
145 		foreach ( void delegate(ListBoxRow) dlg ; _listBoxRow.onActivateListeners )
146 		{
147 			dlg(_listBoxRow);
148 		}
149 	}
150 	
151 	
152 	/**
153 	 * Creates a new GtkListBoxRow, to be used as a child of a GtkListBox.
154 	 * Throws: ConstructionException GTK+ fails to create the object.
155 	 */
156 	public this ()
157 	{
158 		// GtkWidget * gtk_list_box_row_new (void);
159 		auto p = gtk_list_box_row_new();
160 		if(p is null)
161 		{
162 			throw new ConstructionException("null returned by gtk_list_box_row_new()");
163 		}
164 		this(cast(GtkListBoxRow*) p);
165 	}
166 	
167 	/**
168 	 * Marks row as changed, causing any state that depends on this
169 	 * to be updated. This affects sorting, filtering and headers.
170 	 * Note that calls to this method must be in sync with the data
171 	 * used for the row functions. For instance, if the list is
172 	 * mirroring some external data set, and *two* rows changed in the
173 	 * external data set then when you call gtk_list_box_row_changed()
174 	 * on the first row the sort function must only read the new data
175 	 * for the first of the two changed rows, otherwise the resorting
176 	 * of the rows will be wrong.
177 	 * This generally means that if you don't fully control the data
178 	 * model you have to duplicate the data that affects the listbox
179 	 * row functions into the row widgets themselves. Another alternative
180 	 * is to call gtk_list_box_invalidate_sort() on any model change,
181 	 * but that is more expensive.
182 	 */
183 	public void changed()
184 	{
185 		// void gtk_list_box_row_changed (GtkListBoxRow *row);
186 		gtk_list_box_row_changed(gtkListBoxRow);
187 	}
188 	
189 	/**
190 	 * Returns the current header of the row. This can be used
191 	 * in a GtkListBoxUpdateHeaderFunc to see if there is a header
192 	 * set already, and if so to update the state of it.
193 	 * Returns: the current header, or NULL if none. [transfer none] Since 3.10
194 	 */
195 	public Widget getHeader()
196 	{
197 		// GtkWidget * gtk_list_box_row_get_header (GtkListBoxRow *row);
198 		auto p = gtk_list_box_row_get_header(gtkListBoxRow);
199 		
200 		if(p is null)
201 		{
202 			return null;
203 		}
204 		
205 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
206 	}
207 	
208 	/**
209 	 */
210 	public static GType getType()
211 	{
212 		// GType gtk_list_box_row_get_type (void);
213 		return gtk_list_box_row_get_type();
214 	}
215 	
216 	/**
217 	 * Sets the current header of the row. This is only allowed to be called
218 	 * from a GtkListBoxUpdateHeaderFunc. It will replace any existing
219 	 * header in the row, and be shown in front of the row in the listbox.
220 	 * Params:
221 	 * header = the header, or NULL. [allow-none]
222 	 * Since 3.10
223 	 */
224 	public void setHeader(Widget header)
225 	{
226 		// void gtk_list_box_row_set_header (GtkListBoxRow *row,  GtkWidget *header);
227 		gtk_list_box_row_set_header(gtkListBoxRow, (header is null) ? null : header.getWidgetStruct());
228 	}
229 	
230 	/**
231 	 * Gets the current index of the row in its GtkListBox container.
232 	 * Returns: the index of the row, or -1 if the row is not in a listbox Since 3.10
233 	 */
234 	public int getIndex()
235 	{
236 		// gint gtk_list_box_row_get_index (GtkListBoxRow *row);
237 		return gtk_list_box_row_get_index(gtkListBoxRow);
238 	}
239 }