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