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 change21 // find conversion definition on APILookup.txt22 // implement new conversion functionalities on the wrap.utils pakage23 24 25 modulegtk.ListBoxRow;
26 27 privateimportglib.ConstructionException;
28 privateimportgobject.ObjectG;
29 privateimportgobject.Signals;
30 privateimportgtk.ActionableIF;
31 privateimportgtk.ActionableT;
32 privateimportgtk.Widget;
33 privateimportgtk.c.functions;
34 publicimportgtk.c.types;
35 privateimportstd.algorithm;
36 37 38 /**
39 * `GtkListBoxRow` is the kind of widget that can be added to a `GtkListBox`.
40 */41 publicclassListBoxRow : Widget, ActionableIF42 {
43 /** the main Gtk struct */44 protectedGtkListBoxRow* gtkListBoxRow;
45 46 /** Get the main Gtk struct */47 publicGtkListBoxRow* getListBoxRowStruct(booltransferOwnership = false)
48 {
49 if (transferOwnership)
50 ownedRef = false;
51 returngtkListBoxRow;
52 }
53 54 /** the main Gtk struct as a void* */55 protectedoverridevoid* getStruct()
56 {
57 returncast(void*)gtkListBoxRow;
58 }
59 60 /**
61 * Sets our main struct and passes it to the parent class.
62 */63 publicthis (GtkListBoxRow* gtkListBoxRow, boolownedRef = false)
64 {
65 this.gtkListBoxRow = gtkListBoxRow;
66 super(cast(GtkWidget*)gtkListBoxRow, ownedRef);
67 }
68 69 // add the Actionable capabilities70 mixinActionableT!(GtkListBoxRow);
71 72 73 /** */74 publicstaticGTypegetType()
75 {
76 returngtk_list_box_row_get_type();
77 }
78 79 /**
80 * Creates a new `GtkListBoxRow`.
81 *
82 * Returns: a new `GtkListBoxRow`
83 *
84 * Throws: ConstructionException GTK+ fails to create the object.
85 */86 publicthis()
87 {
88 auto__p = gtk_list_box_row_new();
89 90 if(__pisnull)
91 {
92 thrownewConstructionException("null returned by new");
93 }
94 95 this(cast(GtkListBoxRow*) __p);
96 }
97 98 /**
99 * Marks @row as changed, causing any state that depends on this
100 * to be updated.
101 *
102 * This affects sorting, filtering and headers.
103 *
104 * Note that calls to this method must be in sync with the data
105 * used for the row functions. For instance, if the list is
106 * mirroring some external data set, and *two* rows changed in the
107 * external data set then when you call gtk_list_box_row_changed()
108 * on the first row the sort function must only read the new data
109 * for the first of the two changed rows, otherwise the resorting
110 * of the rows will be wrong.
111 *
112 * This generally means that if you don’t fully control the data
113 * model you have to duplicate the data that affects the listbox
114 * row functions into the row widgets themselves. Another alternative
115 * is to call [method@Gtk.ListBox.invalidate_sort] on any model change,
116 * but that is more expensive.
117 */118 publicvoidchanged()
119 {
120 gtk_list_box_row_changed(gtkListBoxRow);
121 }
122 123 /**
124 * Gets whether the row is activatable.
125 *
126 * Returns: %TRUE if the row is activatable
127 */128 publicboolgetActivatable()
129 {
130 returngtk_list_box_row_get_activatable(gtkListBoxRow) != 0;
131 }
132 133 /**
134 * Gets the child widget of @row.
135 *
136 * Returns: the child widget of @row
137 */138 publicWidgetgetChild()
139 {
140 auto__p = gtk_list_box_row_get_child(gtkListBoxRow);
141 142 if(__pisnull)
143 {
144 returnnull;
145 }
146 147 returnObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
148 }
149 150 /**
151 * Returns the current header of the @row.
152 *
153 * This can be used
154 * in a [callback@Gtk.ListBoxUpdateHeaderFunc] to see if
155 * there is a header set already, and if so to update
156 * the state of it.
157 *
158 * Returns: the current header, or %NULL if none
159 */160 publicWidgetgetHeader()
161 {
162 auto__p = gtk_list_box_row_get_header(gtkListBoxRow);
163 164 if(__pisnull)
165 {
166 returnnull;
167 }
168 169 returnObjectG.getDObject!(Widget)(cast(GtkWidget*) __p);
170 }
171 172 /**
173 * Gets the current index of the @row in its `GtkListBox` container.
174 *
175 * Returns: the index of the @row, or -1 if the @row is not in a listbox
176 */177 publicintgetIndex()
178 {
179 returngtk_list_box_row_get_index(gtkListBoxRow);
180 }
181 182 /**
183 * Gets whether the row can be selected.
184 *
185 * Returns: %TRUE if the row is selectable
186 */187 publicboolgetSelectable()
188 {
189 returngtk_list_box_row_get_selectable(gtkListBoxRow) != 0;
190 }
191 192 /**
193 * Returns whether the child is currently selected in its
194 * `GtkListBox` container.
195 *
196 * Returns: %TRUE if @row is selected
197 */198 publicboolisSelected()
199 {
200 returngtk_list_box_row_is_selected(gtkListBoxRow) != 0;
201 }
202 203 /**
204 * Set whether the row is activatable.
205 *
206 * Params:
207 * activatable = %TRUE to mark the row as activatable
208 */209 publicvoidsetActivatable(boolactivatable)
210 {
211 gtk_list_box_row_set_activatable(gtkListBoxRow, activatable);
212 }
213 214 /**
215 * Sets the child widget of @self.
216 *
217 * Params:
218 * child = the child widget
219 */220 publicvoidsetChild(Widgetchild)
221 {
222 gtk_list_box_row_set_child(gtkListBoxRow, (childisnull) ? null : child.getWidgetStruct());
223 }
224 225 /**
226 * Sets the current header of the @row.
227 *
228 * This is only allowed to be called
229 * from a [callback@Gtk.ListBoxUpdateHeaderFunc].
230 * It will replace any existing header in the row,
231 * and be shown in front of the row in the listbox.
232 *
233 * Params:
234 * header = the header, or %NULL
235 */236 publicvoidsetHeader(Widgetheader)
237 {
238 gtk_list_box_row_set_header(gtkListBoxRow, (headerisnull) ? null : header.getWidgetStruct());
239 }
240 241 /**
242 * Set whether the row can be selected.
243 *
244 * Params:
245 * selectable = %TRUE to mark the row as selectable
246 */247 publicvoidsetSelectable(boolselectable)
248 {
249 gtk_list_box_row_set_selectable(gtkListBoxRow, selectable);
250 }
251 252 /**
253 * This is a keybinding signal, which will cause this row to be activated.
254 *
255 * If you want to be notified when the user activates a row (by key or not),
256 * use the [signal@Gtk.ListBox::row-activated] signal on the row’s parent
257 * `GtkListBox`.
258 */259 gulongaddOnActivate(voiddelegate(ListBoxRow) dlg, ConnectFlagsconnectFlags=cast(ConnectFlags)0)
260 {
261 returnSignals.connect(this, "activate", dlg, connectFlags ^ ConnectFlags.SWAPPED);
262 }
263 }