alternative to assert
[gtkD.git] / gtkD / src / gtk / SizeGroup.d
blobba40c6d5172d058edb5e58f042e3b020c2601d2c
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 = GtkSizeGroup.html
26 * outPack = gtk
27 * outFile = SizeGroup
28 * strct = GtkSizeGroup
29 * realStrct=
30 * ctorStrct=
31 * clss = SizeGroup
32 * interf =
33 * class Code: No
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gtk_size_group_
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.SizeGroup;
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 * GtkSizeGroup provides a mechanism for grouping a number of widgets
75 * together so they all request the same amount of space. This is
76 * typically useful when you want a column of widgets to have the same
77 * size, but you can't use a GtkTable widget.
78 * In detail, the size requested for each widget in a GtkSizeGroup is
79 * the maximum of the sizes that would have been requested for each
80 * widget in the size group if they were not in the size group. The mode
81 * of the size group (see gtk_size_group_set_mode()) determines whether
82 * this applies to the horizontal size, the vertical size, or both sizes.
83 * Note that size groups only affect the amount of space requested, not
84 * the size that the widgets finally receive. If you want the widgets in
85 * a GtkSizeGroup to actually be the same size, you need to pack them in
86 * such a way that they get the size they request and not more. For
87 * example, if you are packing your widgets into a table, you would not
88 * include the GTK_FILL flag.
89 * GtkSizeGroup objects are referenced by each widget in the size group,
90 * so once you have added all widgets to a GtkSizeGroup, you can drop
91 * the initial reference to the size group with g_object_unref(). If the
92 * widgets in the size group are subsequently destroyed, then they will
93 * be removed from the size group and drop their references on the size
94 * group; when all widgets have been removed, the size group will be
95 * freed.
96 * Widgets can be part of multiple size groups; GTK+ will compute the
97 * horizontal size of a widget from the horizontal requisition of all
98 * widgets that can be reached from the widget by a chain of size groups
99 * of type GTK_SIZE_GROUP_HORIZONTAL or GTK_SIZE_GROUP_BOTH, and the
100 * vertical size from the vertical requisition of all widgets that can be
101 * reached from the widget by a chain of size groups of type
102 * GTK_SIZE_GROUP_VERTICAL or GTK_SIZE_GROUP_BOTH.
104 private import gobject.ObjectG;
105 public class SizeGroup : ObjectG
108 /** the main Gtk struct */
109 protected GtkSizeGroup* gtkSizeGroup;
112 public GtkSizeGroup* getSizeGroupStruct()
114 return gtkSizeGroup;
118 /** the main Gtk struct as a void* */
119 protected void* getStruct()
121 return cast(void*)gtkSizeGroup;
125 * Sets our main struct and passes it to the parent class
127 public this (GtkSizeGroup* gtkSizeGroup)
129 version(noAssert)
131 if ( gtkSizeGroup is null )
133 int zero = 0;
134 version(Tango)
136 Stdout("struct gtkSizeGroup is null on constructor").newline;
138 else
140 printf("struct gtkSizeGroup is null on constructor");
142 zero = zero / zero;
145 else
147 assert(gtkSizeGroup !is null, "struct gtkSizeGroup is null on constructor");
149 super(cast(GObject*)gtkSizeGroup);
150 this.gtkSizeGroup = gtkSizeGroup;
159 * Create a new GtkSizeGroup.
160 * mode:
161 * the mode for the new size group.
162 * Returns:
163 * a newly created GtkSizeGroup
165 public this (GtkSizeGroupMode mode)
167 // GtkSizeGroup* gtk_size_group_new (GtkSizeGroupMode mode);
168 this(cast(GtkSizeGroup*)gtk_size_group_new(mode) );
172 * Sets the GtkSizeGroupMode of the size group. The mode of the size
173 * group determines whether the widgets in the size group should
174 * all have the same horizontal requisition (GTK_SIZE_GROUP_MODE_HORIZONTAL)
175 * all have the same vertical requisition (GTK_SIZE_GROUP_MODE_VERTICAL),
176 * or should all have the same requisition in both directions
177 * (GTK_SIZE_GROUP_MODE_BOTH).
178 * size_group:
179 * a GtkSizeGroup
180 * mode:
181 * the mode to set for the size group.
183 public void setMode(GtkSizeGroupMode mode)
185 // void gtk_size_group_set_mode (GtkSizeGroup *size_group, GtkSizeGroupMode mode);
186 gtk_size_group_set_mode(gtkSizeGroup, mode);
190 * Gets the current mode of the size group. See gtk_size_group_set_mode().
191 * size_group:
192 * a GtkSizeGroup
193 * Returns:
194 * the current mode of the size group.
196 public GtkSizeGroupMode getMode()
198 // GtkSizeGroupMode gtk_size_group_get_mode (GtkSizeGroup *size_group);
199 return gtk_size_group_get_mode(gtkSizeGroup);
203 * Sets whether unmapped widgets should be ignored when
204 * calculating the size.
205 * size_group:
206 * a GtkSizeGroup
207 * ignore_hidden:
208 * whether unmapped widgets should be ignored
209 * when calculating the size
210 * Since 2.8
212 public void setIgnoreHidden(int ignoreHidden)
214 // void gtk_size_group_set_ignore_hidden (GtkSizeGroup *size_group, gboolean ignore_hidden);
215 gtk_size_group_set_ignore_hidden(gtkSizeGroup, ignoreHidden);
219 * Returns if invisible widgets are ignored when calculating the size.
220 * size_group:
221 * a GtkSizeGroup
222 * Returns:
223 * TRUE if invisible widgets are ignored.
224 * Since 2.8
226 public int getIgnoreHidden()
228 // gboolean gtk_size_group_get_ignore_hidden (GtkSizeGroup *size_group);
229 return gtk_size_group_get_ignore_hidden(gtkSizeGroup);
233 * Adds a widget to a GtkSizeGroup. In the future, the requisition
234 * of the widget will be determined as the maximum of its requisition
235 * and the requisition of the other widgets in the size group.
236 * Whether this applies horizontally, vertically, or in both directions
237 * depends on the mode of the size group. See gtk_size_group_set_mode().
238 * size_group:
239 * a GtkSizeGroup
240 * widget:
241 * the GtkWidget to add
243 public void addWidget(Widget widget)
245 // void gtk_size_group_add_widget (GtkSizeGroup *size_group, GtkWidget *widget);
246 gtk_size_group_add_widget(gtkSizeGroup, (widget is null) ? null : widget.getWidgetStruct());
250 * Removes a widget from a GtkSizeGroup.
251 * size_group:
252 * a GtkSizeGrup
253 * widget:
254 * the GtkWidget to remove
256 public void removeWidget(Widget widget)
258 // void gtk_size_group_remove_widget (GtkSizeGroup *size_group, GtkWidget *widget);
259 gtk_size_group_remove_widget(gtkSizeGroup, (widget is null) ? null : widget.getWidgetStruct());
263 * Returns the list of widgets associated with size_group.
264 * size_group:
265 * a GtkSizeGrup
266 * Returns:
267 * a GSList of widgets. The list is owned by GTK+
268 * and should not be modified.
269 * Since 2.10
270 * Property Details
271 * The "ignore-hidden" property
272 * "ignore-hidden" gboolean : Read / Write
273 * If TRUE, unmapped widgets are ignored when determining
274 * the size of the group.
275 * Default value: FALSE
276 * Since 2.8
278 public GSList* getWidgets()
280 // GSList* gtk_size_group_get_widgets (GtkSizeGroup *size_group);
281 return gtk_size_group_get_widgets(gtkSizeGroup);