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