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.ToolItemGroup;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gtk.Container;
31 private import gtk.ToolItem;
32 private import gtk.ToolShellIF;
33 private import gtk.ToolShellT;
34 private import gtk.Widget;
35 private import gtk.c.functions;
36 public  import gtk.c.types;
37 public  import gtkc.gtktypes;
38 
39 
40 /**
41  * A #GtkToolItemGroup is used together with #GtkToolPalette to add
42  * #GtkToolItems to a palette like container with different
43  * categories and drag and drop support.
44  * 
45  * # CSS nodes
46  * 
47  * GtkToolItemGroup has a single CSS node named toolitemgroup.
48  *
49  * Since: 2.20
50  */
51 public class ToolItemGroup : Container, ToolShellIF
52 {
53 	/** the main Gtk struct */
54 	protected GtkToolItemGroup* gtkToolItemGroup;
55 
56 	/** Get the main Gtk struct */
57 	public GtkToolItemGroup* getToolItemGroupStruct(bool transferOwnership = false)
58 	{
59 		if (transferOwnership)
60 			ownedRef = false;
61 		return gtkToolItemGroup;
62 	}
63 
64 	/** the main Gtk struct as a void* */
65 	protected override void* getStruct()
66 	{
67 		return cast(void*)gtkToolItemGroup;
68 	}
69 
70 	/**
71 	 * Sets our main struct and passes it to the parent class.
72 	 */
73 	public this (GtkToolItemGroup* gtkToolItemGroup, bool ownedRef = false)
74 	{
75 		this.gtkToolItemGroup = gtkToolItemGroup;
76 		super(cast(GtkContainer*)gtkToolItemGroup, ownedRef);
77 	}
78 
79 	// add the ToolShell capabilities
80 	mixin ToolShellT!(GtkToolItemGroup);
81 
82 	/**
83 	 * Retrieves the current orientation for the tool shell. Tool items must not
84 	 * call this function directly, but rely on gtk_tool_item_get_orientation()
85 	 * instead.
86 	 * Since 2.14
87 	 * Returns: the current orientation of shell
88 	 */
89 	public GtkOrientation getOrientation()
90 	{
91 		return gtk_tool_shell_get_orientation(getToolShellStruct());
92 	}
93 
94 	/**
95 	 */
96 
97 	/** */
98 	public static GType getType()
99 	{
100 		return gtk_tool_item_group_get_type();
101 	}
102 
103 	/**
104 	 * Creates a new tool item group with label @label.
105 	 *
106 	 * Params:
107 	 *     label = the label of the new group
108 	 *
109 	 * Returns: a new #GtkToolItemGroup.
110 	 *
111 	 * Since: 2.20
112 	 *
113 	 * Throws: ConstructionException GTK+ fails to create the object.
114 	 */
115 	public this(string label)
116 	{
117 		auto p = gtk_tool_item_group_new(Str.toStringz(label));
118 
119 		if(p is null)
120 		{
121 			throw new ConstructionException("null returned by new");
122 		}
123 
124 		this(cast(GtkToolItemGroup*) p);
125 	}
126 
127 	/**
128 	 * Gets whether @group is collapsed or expanded.
129 	 *
130 	 * Returns: %TRUE if @group is collapsed, %FALSE if it is expanded
131 	 *
132 	 * Since: 2.20
133 	 */
134 	public bool getCollapsed()
135 	{
136 		return gtk_tool_item_group_get_collapsed(gtkToolItemGroup) != 0;
137 	}
138 
139 	/**
140 	 * Gets the tool item at position (x, y).
141 	 *
142 	 * Params:
143 	 *     x = the x position
144 	 *     y = the y position
145 	 *
146 	 * Returns: the #GtkToolItem at position (x, y)
147 	 *
148 	 * Since: 2.20
149 	 */
150 	public ToolItem getDropItem(int x, int y)
151 	{
152 		auto p = gtk_tool_item_group_get_drop_item(gtkToolItemGroup, x, y);
153 
154 		if(p is null)
155 		{
156 			return null;
157 		}
158 
159 		return ObjectG.getDObject!(ToolItem)(cast(GtkToolItem*) p);
160 	}
161 
162 	/**
163 	 * Gets the ellipsization mode of @group.
164 	 *
165 	 * Returns: the #PangoEllipsizeMode of @group
166 	 *
167 	 * Since: 2.20
168 	 */
169 	public PangoEllipsizeMode getEllipsize()
170 	{
171 		return gtk_tool_item_group_get_ellipsize(gtkToolItemGroup);
172 	}
173 
174 	/**
175 	 * Gets the relief mode of the header button of @group.
176 	 *
177 	 * Returns: the #GtkReliefStyle
178 	 *
179 	 * Since: 2.20
180 	 */
181 	public GtkReliefStyle getHeaderRelief()
182 	{
183 		return gtk_tool_item_group_get_header_relief(gtkToolItemGroup);
184 	}
185 
186 	/**
187 	 * Gets the position of @item in @group as index.
188 	 *
189 	 * Params:
190 	 *     item = a #GtkToolItem
191 	 *
192 	 * Returns: the index of @item in @group or -1 if @item is no child of @group
193 	 *
194 	 * Since: 2.20
195 	 */
196 	public int getItemPosition(ToolItem item)
197 	{
198 		return gtk_tool_item_group_get_item_position(gtkToolItemGroup, (item is null) ? null : item.getToolItemStruct());
199 	}
200 
201 	/**
202 	 * Gets the label of @group.
203 	 *
204 	 * Returns: the label of @group. The label is an internal string of @group
205 	 *     and must not be modified. Note that %NULL is returned if a custom
206 	 *     label has been set with gtk_tool_item_group_set_label_widget()
207 	 *
208 	 * Since: 2.20
209 	 */
210 	public string getLabel()
211 	{
212 		return Str.toString(gtk_tool_item_group_get_label(gtkToolItemGroup));
213 	}
214 
215 	/**
216 	 * Gets the label widget of @group.
217 	 * See gtk_tool_item_group_set_label_widget().
218 	 *
219 	 * Returns: the label widget of @group
220 	 *
221 	 * Since: 2.20
222 	 */
223 	public Widget getLabelWidget()
224 	{
225 		auto p = gtk_tool_item_group_get_label_widget(gtkToolItemGroup);
226 
227 		if(p is null)
228 		{
229 			return null;
230 		}
231 
232 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
233 	}
234 
235 	/**
236 	 * Gets the number of tool items in @group.
237 	 *
238 	 * Returns: the number of tool items in @group
239 	 *
240 	 * Since: 2.20
241 	 */
242 	public uint getNItems()
243 	{
244 		return gtk_tool_item_group_get_n_items(gtkToolItemGroup);
245 	}
246 
247 	/**
248 	 * Gets the tool item at @index in group.
249 	 *
250 	 * Params:
251 	 *     index = the index
252 	 *
253 	 * Returns: the #GtkToolItem at index
254 	 *
255 	 * Since: 2.20
256 	 */
257 	public ToolItem getNthItem(uint index)
258 	{
259 		auto p = gtk_tool_item_group_get_nth_item(gtkToolItemGroup, index);
260 
261 		if(p is null)
262 		{
263 			return null;
264 		}
265 
266 		return ObjectG.getDObject!(ToolItem)(cast(GtkToolItem*) p);
267 	}
268 
269 	/**
270 	 * Inserts @item at @position in the list of children of @group.
271 	 *
272 	 * Params:
273 	 *     item = the #GtkToolItem to insert into @group
274 	 *     position = the position of @item in @group, starting with 0.
275 	 *         The position -1 means end of list.
276 	 *
277 	 * Since: 2.20
278 	 */
279 	public void insert(ToolItem item, int position)
280 	{
281 		gtk_tool_item_group_insert(gtkToolItemGroup, (item is null) ? null : item.getToolItemStruct(), position);
282 	}
283 
284 	/**
285 	 * Sets whether the @group should be collapsed or expanded.
286 	 *
287 	 * Params:
288 	 *     collapsed = whether the @group should be collapsed or expanded
289 	 *
290 	 * Since: 2.20
291 	 */
292 	public void setCollapsed(bool collapsed)
293 	{
294 		gtk_tool_item_group_set_collapsed(gtkToolItemGroup, collapsed);
295 	}
296 
297 	/**
298 	 * Sets the ellipsization mode which should be used by labels in @group.
299 	 *
300 	 * Params:
301 	 *     ellipsize = the #PangoEllipsizeMode labels in @group should use
302 	 *
303 	 * Since: 2.20
304 	 */
305 	public void setEllipsize(PangoEllipsizeMode ellipsize)
306 	{
307 		gtk_tool_item_group_set_ellipsize(gtkToolItemGroup, ellipsize);
308 	}
309 
310 	/**
311 	 * Set the button relief of the group header.
312 	 * See gtk_button_set_relief() for details.
313 	 *
314 	 * Params:
315 	 *     style = the #GtkReliefStyle
316 	 *
317 	 * Since: 2.20
318 	 */
319 	public void setHeaderRelief(GtkReliefStyle style)
320 	{
321 		gtk_tool_item_group_set_header_relief(gtkToolItemGroup, style);
322 	}
323 
324 	/**
325 	 * Sets the position of @item in the list of children of @group.
326 	 *
327 	 * Params:
328 	 *     item = the #GtkToolItem to move to a new position, should
329 	 *         be a child of @group.
330 	 *     position = the new position of @item in @group, starting with 0.
331 	 *         The position -1 means end of list.
332 	 *
333 	 * Since: 2.20
334 	 */
335 	public void setItemPosition(ToolItem item, int position)
336 	{
337 		gtk_tool_item_group_set_item_position(gtkToolItemGroup, (item is null) ? null : item.getToolItemStruct(), position);
338 	}
339 
340 	/**
341 	 * Sets the label of the tool item group. The label is displayed in the header
342 	 * of the group.
343 	 *
344 	 * Params:
345 	 *     label = the new human-readable label of of the group
346 	 *
347 	 * Since: 2.20
348 	 */
349 	public void setLabel(string label)
350 	{
351 		gtk_tool_item_group_set_label(gtkToolItemGroup, Str.toStringz(label));
352 	}
353 
354 	/**
355 	 * Sets the label of the tool item group.
356 	 * The label widget is displayed in the header of the group, in place
357 	 * of the usual label.
358 	 *
359 	 * Params:
360 	 *     labelWidget = the widget to be displayed in place of the usual label
361 	 *
362 	 * Since: 2.20
363 	 */
364 	public void setLabelWidget(Widget labelWidget)
365 	{
366 		gtk_tool_item_group_set_label_widget(gtkToolItemGroup, (labelWidget is null) ? null : labelWidget.getWidgetStruct());
367 	}
368 }