alternative to assert
[gtkD.git] / gtkD / src / gtk / Box.d
blobb82315ae1f298caa57d56e3b34665ac8ad449c7c
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = GtkBox.html
26 * outPack = gtk
27 * outFile = Box
28 * strct = GtkBox
29 * realStrct=
30 * ctorStrct=
31 * clss = Box
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_box_
40 * - gtk_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * imports:
45 * - gtk.Widget
46 * structWrap:
47 * - GtkWidget* -> Widget
48 * module aliases:
49 * local aliases:
52 module gtk.Box;
54 version(noAssert)
56 version(Tango)
58 import tango.io.Stdout; // use the tango loging?
62 private import gtkc.gtktypes;
64 private import gtkc.gtk;
67 private import gtk.Widget;
72 /**
73 * Description
74 * GtkBox is an abstract widget which encapsulates functionallity for a
75 * particular kind of container, one that organizes a variable number of
76 * widgets into a rectangular area. GtkBox currently has two derived
77 * classes, GtkHBox and GtkVBox.
78 * The rectangular area of a GtkBox is organized into either a single row
79 * or a single column of child widgets depending upon whether the box is
80 * of type GtkHBox or GtkVBox, respectively. Thus, all children of a
81 * GtkBox are allocated one dimension in common, which is the height of a
82 * row, or the width of a column.
83 * GtkBox uses a notion of packing. Packing refers to
84 * adding widgets with reference to a particular position in a
85 * GtkContainer. For a GtkBox, there are two reference positions: the
86 * start and the end of the box. For a
87 * GtkVBox, the start is defined as the top of the box and the end is
88 * defined as the bottom. For a GtkHBox the start is defined as the
89 * left side and the end is defined as the right side.
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 * Use gtk_box_pack_start_defaults() or gtk_box_pack_end_defaults()
95 * to pack widgets into a GtkBox if you do not need to specify the
96 * expand, fill, or
97 * padding attributes of the child to be
98 * added.
99 * Because GtkBox is a GtkContainer, you may also use
100 * gtk_container_add() to insert widgets into the box, and they will be
101 * packed as if with gtk_box_pack_start_defaults(). Use
102 * gtk_container_remove() to remove widgets from the GtkBox.
103 * Use gtk_box_set_homogeneous() to specify whether or not all children
104 * of the GtkBox are forced to get the same amount of space.
105 * Use gtk_box_set_spacing() to determine how much space will be
106 * minimally placed between all children in the GtkBox.
107 * Use gtk_box_reorder_child() to move a GtkBox child to a different
108 * place in the box.
109 * Use gtk_box_set_child_packing() to reset the
110 * expand, fill,
111 * and padding attributes of any GtkBox child.
112 * Use gtk_box_query_child_packing() to query these fields.
114 private import gtk.Container;
115 public class Box : Container
118 /** the main Gtk struct */
119 protected GtkBox* gtkBox;
122 public GtkBox* getBoxStruct()
124 return gtkBox;
128 /** the main Gtk struct as a void* */
129 protected void* getStruct()
131 return cast(void*)gtkBox;
135 * Sets our main struct and passes it to the parent class
137 public this (GtkBox* gtkBox)
139 version(noAssert)
141 if ( gtkBox is null )
143 int zero = 0;
144 version(Tango)
146 Stdout("struct gtkBox is null on constructor").newline;
148 else
150 printf("struct gtkBox is null on constructor");
152 zero = zero / zero;
155 else
157 assert(gtkBox !is null, "struct gtkBox is null on constructor");
159 super(cast(GtkContainer*)gtkBox);
160 this.gtkBox = gtkBox;
169 * Adds child to box, packed with reference to the start of box. The
170 * child is packed after any other child packed with reference to the
171 * start of box.
172 * box:
173 * a GtkBox.
174 * child:
175 * the GtkWidget to be added to box.
176 * expand:
177 * TRUE if the new child is to be given extra space allocated to
178 * box. The extra space will be divided evenly between all children of
179 * box that use this option.
180 * fill:
181 * TRUE if space given to child by the expand option is
182 * actually allocated to child, rather than just padding it. This
183 * parameter has no effect if expand is set to FALSE. A child is
184 * always allocated the full height of a GtkHBox and the full width of a
185 * GtkVBox. This option affects the other dimension.
186 * padding:
187 * extra space in pixels to put between this child and its
188 * neighbors, over and above the global amount specified by
189 * spacing in GtkBox. If child is a
190 * widget at one of the reference ends of box, then padding pixels are also put
191 * between child and the reference edge of box.
193 public void packStart(Widget child, int expand, int fill, uint padding)
195 // void gtk_box_pack_start (GtkBox *box, GtkWidget *child, gboolean expand, gboolean fill, guint padding);
196 gtk_box_pack_start(gtkBox, (child is null) ? null : child.getWidgetStruct(), expand, fill, padding);
200 * Adds child to box, packed with reference to the end of box. The
201 * child is packed after (away from end of) any other child packed with reference to the
202 * end of box.
203 * box:
204 * a GtkBox.
205 * child:
206 * the GtkWidget to be added to box.
207 * expand:
208 * TRUE if the new child is to be given extra space allocated to
209 * box. The extra space will be divided evenly between all children of
210 * box that use this option.
211 * fill:
212 * TRUE if space given to child by the expand option is
213 * actually allocated to child, rather than just padding it. This
214 * parameter has no effect if expand is set to FALSE. A child is
215 * always allocated the full height of a GtkHBox and the full width of a
216 * GtkVBox. This option affects the other dimension.
217 * padding:
218 * extra space in pixels to put between this child and its
219 * neighbors, over and above the global amount specified by
220 * spacing in GtkBox. If child is a
221 * widget at one of the reference ends of box, then padding pixels are also put
222 * between child and the reference edge of box.
224 public void packEnd(Widget child, int expand, int fill, uint padding)
226 // void gtk_box_pack_end (GtkBox *box, GtkWidget *child, gboolean expand, gboolean fill, guint padding);
227 gtk_box_pack_end(gtkBox, (child is null) ? null : child.getWidgetStruct(), expand, fill, padding);
231 * Adds widget to box, packed with reference to the start of box. The
232 * child is packed after any other child packed with reference to the
233 * start of box.
234 * Parameters for how to pack the child widget,
235 * expand, fill,
236 * and padding in GtkBoxChild, are given their default
237 * values, TRUE, TRUE, and 0, respectively.
238 * box:
239 * a GtkBox.
240 * widget:
241 * the GtkWidget to be added to box.
243 public void packStartDefaults(Widget widget)
245 // void gtk_box_pack_start_defaults (GtkBox *box, GtkWidget *widget);
246 gtk_box_pack_start_defaults(gtkBox, (widget is null) ? null : widget.getWidgetStruct());
250 * Adds widget to box, packed with reference to the end of box. The
251 * child is packed after (away from end of) any other child packed with
252 * reference to the end of box.
253 * Parameters for how to pack the child widget,
254 * expand, fill,
255 * and padding in GtkBoxChild, are given their default
256 * values, TRUE, TRUE, and 0, respectively.
257 * box:
258 * a GtkBox.
259 * widget:
260 * the GtkWidget to be added to box.
262 public void packEndDefaults(Widget widget)
264 // void gtk_box_pack_end_defaults (GtkBox *box, GtkWidget *widget);
265 gtk_box_pack_end_defaults(gtkBox, (widget is null) ? null : widget.getWidgetStruct());
269 * Returns whether the box is homogeneous (all children are the
270 * same size). See gtk_box_set_homogeneous().
271 * box:
272 * a GtkBox
273 * Returns:
274 * TRUE if the box is homogeneous.
276 public int getHomogeneous()
278 // gboolean gtk_box_get_homogeneous (GtkBox *box);
279 return gtk_box_get_homogeneous(gtkBox);
283 * Sets the homogeneous field of
284 * GtkBox, controlling whether or not all children of box are
285 * given equal space in the box.
286 * box:
287 * a GtkBox.
288 * homogeneous:
289 * a boolean value, TRUE to create equal allotments,
290 * FALSE for variable allotments.
292 public void setHomogeneous(int homogeneous)
294 // void gtk_box_set_homogeneous (GtkBox *box, gboolean homogeneous);
295 gtk_box_set_homogeneous(gtkBox, homogeneous);
299 * Gets the value set by gtk_box_set_spacing().
300 * box:
301 * a GtkBox
302 * Returns:
303 * spacing between children
305 public int getSpacing()
307 // gint gtk_box_get_spacing (GtkBox *box);
308 return gtk_box_get_spacing(gtkBox);
312 * Sets the spacing field of GtkBox,
313 * which is the number of pixels to place between children of box.
314 * box:
315 * a GtkBox.
316 * spacing:
317 * the number of pixels to put between children.
319 public void setSpacing(int spacing)
321 // void gtk_box_set_spacing (GtkBox *box, gint spacing);
322 gtk_box_set_spacing(gtkBox, spacing);
326 * Moves child to a new position in the list of box children. The
327 * list is the children field of
328 * GtkBox, and contains both widgets packed GTK_PACK_START as
329 * well as widgets packed GTK_PACK_END, in the order that these widgets
330 * were added to box.
331 * A widget's position in the box children list determines where the
332 * widget is packed into box. A child widget at some position in the
333 * list will be packed just after all other widgets of the same packing
334 * type that appear earlier in the list.
335 * box:
336 * a GtkBox.
337 * child:
338 * the GtkWidget to move.
339 * position:
340 * the new position for child in the
341 * children list of GtkBox, starting
342 * from 0. If negative, indicates the end of the list.
344 public void reorderChild(Widget child, int position)
346 // void gtk_box_reorder_child (GtkBox *box, GtkWidget *child, gint position);
347 gtk_box_reorder_child(gtkBox, (child is null) ? null : child.getWidgetStruct(), position);
351 * Returns information about how child is packed into box.
352 * box:
353 * a GtkBox.
354 * child:
355 * the GtkWidget of the child to query.
356 * expand:
357 * the returned value of the expand
358 * field in GtkBoxChild.
359 * fill:
360 * the returned value of the fill field
361 * in GtkBoxChild.
362 * padding:
363 * the returned value of the padding
364 * field in GtkBoxChild.
365 * pack_type:
366 * the returned value of the pack
367 * field in GtkBoxChild.
369 public void queryChildPacking(Widget child, int* expand, int* fill, uint* padding, GtkPackType* packType)
371 // void gtk_box_query_child_packing (GtkBox *box, GtkWidget *child, gboolean *expand, gboolean *fill, guint *padding, GtkPackType *pack_type);
372 gtk_box_query_child_packing(gtkBox, (child is null) ? null : child.getWidgetStruct(), expand, fill, padding, packType);
376 * Sets the way child is packed into box.
377 * box:
378 * a GtkBox.
379 * child:
380 * the GtkWidget of the child to set.
381 * expand:
382 * the new value of the expand field
383 * in GtkBoxChild.
384 * fill:
385 * the new value of the fill field in
386 * GtkBoxChild.
387 * padding:
388 * the new value of the padding
389 * field in GtkBoxChild.
390 * pack_type:
391 * the new value of the pack field
392 * in GtkBoxChild.
393 * Property Details
394 * The "homogeneous" property
395 * "homogeneous" gboolean : Read / Write
396 * Whether the children should all be the same size.
397 * Default value: FALSE
399 public void setChildPacking(Widget child, int expand, int fill, uint padding, GtkPackType packType)
401 // void gtk_box_set_child_packing (GtkBox *box, GtkWidget *child, gboolean expand, gboolean fill, guint padding, GtkPackType pack_type);
402 gtk_box_set_child_packing(gtkBox, (child is null) ? null : child.getWidgetStruct(), expand, fill, padding, packType);