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  = GtkBox.html
27  * outPack = gtk
28  * outFile = Box
29  * strct   = GtkBox
30  * realStrct=
31  * ctorStrct=
32  * clss    = Box
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * 	- OrientableIF
40  * prefixes:
41  * 	- gtk_box_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- gtk.Widget
48  * 	- gtk.OrientableIF
49  * 	- gtk.OrientableT
50  * structWrap:
51  * 	- GtkWidget* -> Widget
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module gtk.Box;
58 
59 public  import gtkc.gtktypes;
60 
61 private import gtkc.gtk;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 
66 private import gtk.Widget;
67 private import gtk.OrientableIF;
68 private import gtk.OrientableT;
69 
70 
71 
72 private import gtk.Container;
73 
74 /**
75  * The GtkBox widget organizes child widgets into a rectangular area.
76  *
77  * The rectangular area of a GtkBox is organized into either a single row
78  * or a single column of child widgets depending upon the orientation.
79  * Thus, all children of a GtkBox are allocated one dimension in common,
80  * which is the height of a row, or the width of a column.
81  *
82  * GtkBox uses a notion of packing. Packing refers
83  * to adding widgets with reference to a particular position in a
84  * GtkContainer. For a GtkBox, there are two reference positions: the
85  * start and the end of the box.
86  * For a vertical GtkBox, the start is defined as the top of the box and
87  * the end is defined as the bottom. For a horizontal GtkBox the start
88  * is defined as the left side and the end is defined as the right side.
89  *
90  * Use repeated calls to gtk_box_pack_start() to pack widgets into a
91  * GtkBox from start to end. Use gtk_box_pack_end() to add widgets from
92  * end to start. You may intersperse these calls and add widgets from
93  * both ends of the same GtkBox.
94  *
95  * Because GtkBox is a GtkContainer, you may also use gtk_container_add()
96  * to insert widgets into the box, and they will be packed with the default
97  * values for "expand" and "fill". Use gtk_container_remove()
98  * to remove widgets from the GtkBox.
99  *
100  * Use gtk_box_set_homogeneous() to specify whether or not all children
101  * of the GtkBox are forced to get the same amount of space.
102  *
103  * Use gtk_box_set_spacing() to determine how much space will be
104  * minimally placed between all children in the GtkBox. Note that
105  * spacing is added between the children, while
106  * padding added by gtk_box_pack_start() or gtk_box_pack_end() is added
107  * on either side of the widget it belongs to.
108  *
109  * Use gtk_box_reorder_child() to move a GtkBox child to a different
110  * place in the box.
111  *
112  * Use gtk_box_set_child_packing() to reset the "expand",
113  * "fill" and "padding" child properties.
114  * Use gtk_box_query_child_packing() to query these fields.
115  *
116  * Note
117  *
118  * Note that a single-row or single-column GtkGrid provides exactly
119  * the same functionality as GtkBox.
120  */
121 public class Box : Container, OrientableIF
122 {
123 	
124 	/** the main Gtk struct */
125 	protected GtkBox* gtkBox;
126 	
127 	
128 	public GtkBox* getBoxStruct()
129 	{
130 		return gtkBox;
131 	}
132 	
133 	
134 	/** the main Gtk struct as a void* */
135 	protected override void* getStruct()
136 	{
137 		return cast(void*)gtkBox;
138 	}
139 	
140 	/**
141 	 * Sets our main struct and passes it to the parent class
142 	 */
143 	public this (GtkBox* gtkBox)
144 	{
145 		super(cast(GtkContainer*)gtkBox);
146 		this.gtkBox = gtkBox;
147 	}
148 	
149 	protected override void setStruct(GObject* obj)
150 	{
151 		super.setStruct(obj);
152 		gtkBox = cast(GtkBox*)obj;
153 	}
154 	
155 	// add the Orientable capabilities
156 	mixin OrientableT!(GtkBox);
157 	
158 	/**
159 	 */
160 	
161 	/**
162 	 * Creates a new GtkBox.
163 	 * Params:
164 	 * orientation = the box's orientation.
165 	 * spacing = the number of pixels to place by default between children.
166 	 * Throws: ConstructionException GTK+ fails to create the object.
167 	 */
168 	public this (GtkOrientation orientation, int spacing)
169 	{
170 		// GtkWidget * gtk_box_new (GtkOrientation orientation,  gint spacing);
171 		auto p = gtk_box_new(orientation, spacing);
172 		if(p is null)
173 		{
174 			throw new ConstructionException("null returned by gtk_box_new(orientation, spacing)");
175 		}
176 		this(cast(GtkBox*) p);
177 	}
178 	
179 	/**
180 	 * Adds child to box, packed with reference to the start of box.
181 	 * The child is packed after any other child packed with reference
182 	 * to the start of box.
183 	 * Params:
184 	 * child = the GtkWidget to be added to box
185 	 * expand = TRUE if the new child is to be given extra space allocated
186 	 * to box. The extra space will be divided evenly between all children
187 	 * that use this option
188 	 * fill = TRUE if space given to child by the expand option is
189 	 * actually allocated to child, rather than just padding it. This
190 	 * parameter has no effect if expand is set to FALSE. A child is
191 	 * always allocated the full height of a horizontal GtkBox and the full width
192 	 * of a vertical GtkBox. This option affects the other dimension
193 	 * padding = extra space in pixels to put between this child and its
194 	 * neighbors, over and above the global amount specified by
195 	 * "spacing" property. If child is a widget at one of the
196 	 * reference ends of box, then padding pixels are also put between
197 	 * child and the reference edge of box
198 	 */
199 	public void packStart(Widget child, int expand, int fill, uint padding)
200 	{
201 		// void gtk_box_pack_start (GtkBox *box,  GtkWidget *child,  gboolean expand,  gboolean fill,  guint padding);
202 		gtk_box_pack_start(gtkBox, (child is null) ? null : child.getWidgetStruct(), expand, fill, padding);
203 	}
204 	
205 	/**
206 	 * Adds child to box, packed with reference to the end of box.
207 	 * The child is packed after (away from end of) any other child
208 	 * packed with reference to the end of box.
209 	 * Params:
210 	 * child = the GtkWidget to be added to box
211 	 * expand = TRUE if the new child is to be given extra space allocated
212 	 * to box. The extra space will be divided evenly between all children
213 	 * of box that use this option
214 	 * fill = TRUE if space given to child by the expand option is
215 	 * actually allocated to child, rather than just padding it. This
216 	 * parameter has no effect if expand is set to FALSE. A child is
217 	 * always allocated the full height of a horizontal GtkBox and the full width
218 	 * of a vertical GtkBox. This option affects the other dimension
219 	 * padding = extra space in pixels to put between this child and its
220 	 * neighbors, over and above the global amount specified by
221 	 * "spacing" property. If child is a widget at one of the
222 	 * reference ends of box, then padding pixels are also put between
223 	 * child and the reference edge of box
224 	 */
225 	public void packEnd(Widget child, int expand, int fill, uint padding)
226 	{
227 		// void gtk_box_pack_end (GtkBox *box,  GtkWidget *child,  gboolean expand,  gboolean fill,  guint padding);
228 		gtk_box_pack_end(gtkBox, (child is null) ? null : child.getWidgetStruct(), expand, fill, padding);
229 	}
230 	
231 	/**
232 	 * Returns whether the box is homogeneous (all children are the
233 	 * same size). See gtk_box_set_homogeneous().
234 	 * Returns: TRUE if the box is homogeneous.
235 	 */
236 	public int getHomogeneous()
237 	{
238 		// gboolean gtk_box_get_homogeneous (GtkBox *box);
239 		return gtk_box_get_homogeneous(gtkBox);
240 	}
241 	
242 	/**
243 	 * Sets the "homogeneous" property of box, controlling
244 	 * whether or not all children of box are given equal space
245 	 * in the box.
246 	 * Params:
247 	 * homogeneous = a boolean value, TRUE to create equal allotments,
248 	 * FALSE for variable allotments
249 	 */
250 	public void setHomogeneous(int homogeneous)
251 	{
252 		// void gtk_box_set_homogeneous (GtkBox *box,  gboolean homogeneous);
253 		gtk_box_set_homogeneous(gtkBox, homogeneous);
254 	}
255 	
256 	/**
257 	 * Gets the value set by gtk_box_set_spacing().
258 	 * Returns: spacing between children
259 	 */
260 	public int getSpacing()
261 	{
262 		// gint gtk_box_get_spacing (GtkBox *box);
263 		return gtk_box_get_spacing(gtkBox);
264 	}
265 	
266 	/**
267 	 * Sets the "spacing" property of box, which is the
268 	 * number of pixels to place between children of box.
269 	 * Params:
270 	 * spacing = the number of pixels to put between children
271 	 */
272 	public void setSpacing(int spacing)
273 	{
274 		// void gtk_box_set_spacing (GtkBox *box,  gint spacing);
275 		gtk_box_set_spacing(gtkBox, spacing);
276 	}
277 	
278 	/**
279 	 * Moves child to a new position in the list of box children.
280 	 * The list is the children field of
281 	 * GtkBox, and contains both widgets packed GTK_PACK_START
282 	 * as well as widgets packed GTK_PACK_END, in the order that these
283 	 * widgets were added to box.
284 	 * A widget's position in the box children list determines where
285 	 * the widget is packed into box. A child widget at some position
286 	 * in the list will be packed just after all other widgets of the
287 	 * same packing type that appear earlier in the list.
288 	 * Params:
289 	 * child = the GtkWidget to move
290 	 * position = the new position for child in the list of children
291 	 * of box, starting from 0. If negative, indicates the end of
292 	 * the list
293 	 */
294 	public void reorderChild(Widget child, int position)
295 	{
296 		// void gtk_box_reorder_child (GtkBox *box,  GtkWidget *child,  gint position);
297 		gtk_box_reorder_child(gtkBox, (child is null) ? null : child.getWidgetStruct(), position);
298 	}
299 	
300 	/**
301 	 * Obtains information about how child is packed into box.
302 	 * Params:
303 	 * child = the GtkWidget of the child to query
304 	 * expand = pointer to return location for "expand" child
305 	 * property. [out]
306 	 * fill = pointer to return location for "fill" child
307 	 * property. [out]
308 	 * padding = pointer to return location for "padding"
309 	 * child property. [out]
310 	 * packType = pointer to return location for "pack-type"
311 	 * child property. [out]
312 	 */
313 	public void queryChildPacking(Widget child, out int expand, out int fill, out uint padding, out GtkPackType packType)
314 	{
315 		// void gtk_box_query_child_packing (GtkBox *box,  GtkWidget *child,  gboolean *expand,  gboolean *fill,  guint *padding,  GtkPackType *pack_type);
316 		gtk_box_query_child_packing(gtkBox, (child is null) ? null : child.getWidgetStruct(), &expand, &fill, &padding, &packType);
317 	}
318 	
319 	/**
320 	 * Sets the way child is packed into box.
321 	 * Params:
322 	 * child = the GtkWidget of the child to set
323 	 * expand = the new value of the "expand" child property
324 	 * fill = the new value of the "fill" child property
325 	 * padding = the new value of the "padding" child property
326 	 * packType = the new value of the "pack-type" child property
327 	 */
328 	public void setChildPacking(Widget child, int expand, int fill, uint padding, GtkPackType packType)
329 	{
330 		// void gtk_box_set_child_packing (GtkBox *box,  GtkWidget *child,  gboolean expand,  gboolean fill,  guint padding,  GtkPackType pack_type);
331 		gtk_box_set_child_packing(gtkBox, (child is null) ? null : child.getWidgetStruct(), expand, fill, padding, packType);
332 	}
333 	
334 	/**
335 	 * Gets the value set by gtk_box_set_baseline_position().
336 	 * Returns: the baseline position Since 3.10
337 	 */
338 	public GtkBaselinePosition getBaselinePosition()
339 	{
340 		// GtkBaselinePosition gtk_box_get_baseline_position (GtkBox *box);
341 		return gtk_box_get_baseline_position(gtkBox);
342 	}
343 	
344 	/**
345 	 * Sets the baseline position of a box. This affects
346 	 * only horizontal boxes with at least one baseline aligned
347 	 * child. If there is more vertical space availible than requested,
348 	 * and the baseline is not allocated by the parent then
349 	 * position is used to allocate the baseline wrt the
350 	 * extra space available.
351 	 * Params:
352 	 * position = a GtkBaselinePosition
353 	 * Since 3.10
354 	 */
355 	public void setBaselinePosition(GtkBaselinePosition position)
356 	{
357 		// void gtk_box_set_baseline_position (GtkBox *box,  GtkBaselinePosition position);
358 		gtk_box_set_baseline_position(gtkBox, position);
359 	}
360 }