1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 a base class for box containers
7 <!-- ##### SECTION Long_Description ##### -->
9 GtkBox is an abstract widget which encapsulates functionallity for a
\r
10 particular kind of container, one that organizes a variable number of
\r
11 widgets into a rectangular area. GtkBox currently has two derived
\r
12 classes, #GtkHBox and #GtkVBox.
\r
15 The rectangular area of a GtkBox is organized into either a single row
\r
16 or a single column of child widgets depending upon whether the box is
\r
17 of type #GtkHBox or #GtkVBox, respectively. Thus, all children of a
\r
18 GtkBox are allocated one dimension in common, which is the height of a
\r
19 row, or the width of a column.
\r
22 GtkBox uses a notion of <emphasis>packing</emphasis>. Packing refers to
\r
23 adding widgets with reference to a particular position in a
\r
24 #GtkContainer. For a GtkBox, there are two reference positions: the
\r
25 <emphasis>start</emphasis> and the <emphasis>end</emphasis> of the box. For a
\r
26 #GtkVBox, the start is defined as the top of the box and the end is
\r
27 defined as the bottom. For a #GtkHBox the start is defined as the
\r
28 left side and the end is defined as the right side.
\r
31 Use repeated calls to gtk_box_pack_start() to pack widgets into a
\r
32 GtkBox from start to end. Use gtk_box_pack_end() to add widgets from
\r
33 end to start. You may intersperse these calls and add widgets from
\r
34 both ends of the same GtkBox.
\r
37 Use gtk_box_pack_start_defaults() or gtk_box_pack_end_defaults()
\r
38 to pack widgets into a GtkBox if you do not need to specify the
\r
39 <structfield>expand</structfield>, <structfield>fill</structfield>, or
\r
40 <structfield>padding</structfield> attributes of the child to be
\r
44 Because GtkBox is a #GtkContainer, you may also use
\r
45 gtk_container_add() to insert widgets into the box, and they will be
\r
46 packed as if with gtk_box_pack_start_defaults(). Use
\r
47 gtk_container_remove() to remove widgets from the GtkBox.
\r
50 Use gtk_box_set_homogeneous() to specify whether or not all children
\r
51 of the GtkBox are forced to get the same amount of space.
\r
54 Use gtk_box_set_spacing() to determine how much space will be
\r
55 minimally placed between all children in the GtkBox.
\r
58 Use gtk_box_reorder_child() to move a GtkBox child to a different
\r
62 Use gtk_box_set_child_packing() to reset the
\r
63 <structfield>expand</structfield>, <structfield>fill</structfield>,
\r
64 and <structfield>padding</structfield> attributes of any GtkBox child.
\r
65 Use gtk_box_query_child_packing() to query these fields.
\r
68 <!-- ##### SECTION See_Also ##### -->
73 <term>#GtkHBox</term>
\r
74 <listitem><para>a derived class that organizes widgets into a row.</para></listitem>
\r
78 <term>#GtkVBox</term>
\r
79 <listitem><para>a derived class that organizes widgets into a column.</para></listitem>
\r
83 <term>#GtkFrame</term>
\r
84 <listitem><para>a #GtkWidget useful for drawing a border around a GtkBox.</para></listitem>
\r
88 <term>#GtkTable</term>
\r
89 <listitem><para>a #GtkContainer for organizing widgets into a grid,
\r
90 rather than independent rows or columns.</para></listitem>
\r
94 <term>#GtkLayout</term>
\r
95 <listitem><para>a #GtkContainer for organizing widgets into arbitrary
\r
96 layouts.</para></listitem>
\r
103 <!-- ##### STRUCT GtkBox ##### -->
105 The #GtkBox-struct describes an instance of GtkBox and contains the following fields.
\r
106 (These fields should be considered read-only. They should never be set by
\r
109 <informaltable pgwide=1 frame="none" role="struct">
\r
110 <tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*">
\r
114 <entry>#GList * <structfield>children</structfield>;</entry>
\r
115 <entry>a list of children belonging the GtkBox. The data is a list of
\r
116 structures of type #GtkBoxChild-struct.</entry>
\r
120 <entry>#gint16 <structfield>spacing</structfield>;</entry>
\r
121 <entry>the number of pixels to put between children of the GtkBox, zero
\r
122 by default. Use gtk_box_set_spacing() to set this field.</entry>
\r
126 <entry>#guint <structfield>homogeneous</structfield>;</entry>
\r
127 <entry>a flag that if %TRUE forces all children to get equal space in
\r
128 the GtkBox; %FALSE by default. Use gtk_box_set_homogeneous() to set this
\r
131 </tbody></tgroup></informaltable>
135 <!-- ##### STRUCT GtkBoxChild ##### -->
137 The #GtkBoxChild-struct holds a child widget of GtkBox and describes
\r
138 how the child is to be packed into the GtkBox. Use
\r
139 gtk_box_query_child_packing() and gtk_box_set_child_packing() to query
\r
140 and reset the <structfield>padding</structfield>,
\r
141 <structfield>expand</structfield>, <structfield>fill</structfield>,
\r
142 and <structfield>pack</structfield> fields.
\r
145 #GtkBoxChild-struct contains the following fields. (These fields
\r
146 should be considered read-only. They should never be directly set by an
\r
149 <informaltable pgwide=1 frame="none" role="struct">
\r
150 <tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*">
\r
154 <entry>#GtkWidget * <structfield>widget</structfield>;</entry>
\r
155 <entry>the child widget, packed into the GtkBox.</entry>
\r
159 <entry>#guint16 <structfield>padding</structfield>;</entry>
\r
160 <entry>the number of extra pixels to put between this child and its
\r
161 neighbors, set when packed, zero by default.</entry>
\r
165 <entry>#guint <structfield>expand</structfield>;</entry>
\r
166 <entry>flag indicates whether extra space should be given to this
\r
167 child. Any extra space given to the parent GtkBox is divided up among
\r
168 all children with this attribute set to %TRUE; set when packed, %TRUE by
\r
173 <entry>#guint <structfield>fill</structfield>;</entry>
\r
174 <entry>flag indicates whether any extra space given to this child due to its
\r
175 <structfield>expand</structfield> attribute being set is actually
\r
176 allocated to the child, rather than being used as padding
\r
177 around the widget; set when packed, %TRUE by default.</entry>
\r
181 <entry>#guint <structfield>pack</structfield>;</entry> <entry>one of
\r
182 #GtkPackType indicating whether the child is packed with reference to
\r
183 the start (top/left) or end (bottom/right) of the GtkBox.</entry>
\r
185 </tbody></tgroup></informaltable>
\r
195 <!-- ##### FUNCTION gtk_box_pack_start ##### -->
197 Adds @child to @box, packed with reference to the start of @box. The
\r
198 @child is packed after any other child packed with reference to the
\r
203 @child: the #GtkWidget to be added to @box.
204 @expand: %TRUE if the new child is to be given extra space allocated to
\r
205 @box. The extra space will be divided evenly between all children of
\r
206 @box that use this option.
207 @fill: %TRUE if space given to @child by the @expand option is
\r
208 actually allocated to @child, rather than just padding it. This
\r
209 parameter has no effect if @expand is set to %FALSE. A child is
\r
210 always allocated the full height of a #GtkHBox and the full width of a
\r
211 #GtkVBox. This option affects the other dimension.
212 @padding: extra space in pixels to put between this child and its
\r
213 neighbors, over and above the global amount specified by
\r
214 <structfield>spacing</structfield> in #GtkBox-struct. If @child is a
\r
215 widget at one of the reference ends of @box, then @padding pixels are also put
\r
216 between @child and the reference edge of @box.
219 <!-- ##### FUNCTION gtk_box_pack_end ##### -->
221 Adds @child to @box, packed with reference to the end of @box. The
\r
222 @child is packed after (away from end of) any other child packed with reference to the
\r
227 @child: the #GtkWidget to be added to @box.
228 @expand: %TRUE if the new child is to be given extra space allocated to
\r
229 @box. The extra space will be divided evenly between all children of
\r
230 @box that use this option.
231 @fill: %TRUE if space given to @child by the @expand option is
\r
232 actually allocated to @child, rather than just padding it. This
\r
233 parameter has no effect if @expand is set to %FALSE. A child is
\r
234 always allocated the full height of a #GtkHBox and the full width of a
\r
235 #GtkVBox. This option affects the other dimension.
236 @padding: extra space in pixels to put between this child and its
\r
237 neighbors, over and above the global amount specified by
\r
238 <structfield>spacing</structfield> in #GtkBox-struct. If @child is a
\r
239 widget at one of the reference ends of @box, then @padding pixels are also put
\r
240 between @child and the reference edge of @box.
243 <!-- ##### FUNCTION gtk_box_pack_start_defaults ##### -->
245 Adds @widget to @box, packed with reference to the start of @box. The
\r
246 child is packed after any other child packed with reference to the
\r
250 Parameters for how to pack the child @widget,
\r
251 <structfield>expand</structfield>, <structfield>fill</structfield>,
\r
252 and <structfield>padding</structfield> in #GtkBoxChild-struct, are given their default
\r
253 values, %TRUE, %TRUE, and 0, respectively.
\r
257 @widget: the #GtkWidget to be added to @box.
260 <!-- ##### FUNCTION gtk_box_pack_end_defaults ##### -->
262 Adds @widget to @box, packed with reference to the end of @box. The
\r
263 child is packed after (away from end of) any other child packed with
\r
264 reference to the end of @box.
\r
267 Parameters for how to pack the child @widget,
\r
268 <structfield>expand</structfield>, <structfield>fill</structfield>,
\r
269 and <structfield>padding</structfield> in #GtkBoxChild-struct, are given their default
\r
270 values, %TRUE, %TRUE, and 0, respectively.
\r
274 @widget: the #GtkWidget to be added to @box.
277 <!-- ##### FUNCTION gtk_box_get_homogeneous ##### -->
286 <!-- ##### FUNCTION gtk_box_set_homogeneous ##### -->
288 Sets the <structfield>homogeneous</structfield> field of
\r
289 #GtkBox-struct, controlling whether or not all children of @box are
\r
290 given equal space in the box.
\r
294 @homogeneous: a boolean value, %TRUE to create equal allotments,
\r
295 %FALSE for variable allotments.
298 <!-- ##### FUNCTION gtk_box_get_spacing ##### -->
307 <!-- ##### FUNCTION gtk_box_set_spacing ##### -->
309 Sets the <structfield>spacing</structfield> field of #GtkBox-struct,
\r
310 which is the number of pixels to place between children of @box.
\r
314 @spacing: the number of pixels to put between children.
317 <!-- ##### FUNCTION gtk_box_reorder_child ##### -->
319 Moves @child to a new @position in the list of @box children. The
\r
320 list is the <structfield>children</structfield> field of
\r
321 #GtkBox-struct, and contains both widgets packed #GTK_PACK_START as
\r
322 well as widgets packed #GTK_PACK_END, in the order that these widgets
\r
323 were added to @box.
\r
326 A widget's position in the @box children list determines where the
\r
327 widget is packed into @box. A child widget at some position in the
\r
328 list will be packed just after all other widgets of the same packing
\r
329 type that appear earlier in the list. A negative value of @position is
\r
330 interpreted as position 0.
\r
334 @child: the #GtkWidget to move.
335 @position: the new position for @child in the
\r
336 <structfield>children</structfield> list of #GtkBox-struct, starting
\r
340 <!-- ##### FUNCTION gtk_box_query_child_packing ##### -->
342 Returns information about how @child is packed into @box.
\r
346 @child: the #GtkWidget of the child to query.
347 @expand: the returned value of the <structfield>expand</structfield>
\r
348 field in #GtkBoxChild-struct.
349 @fill: the returned value of the <structfield>fill</structfield> field
\r
350 in #GtkBoxChild-struct.
351 @padding: the returned value of the <structfield>padding</structfield>
\r
352 field in #GtkBoxChild-struct.
353 @pack_type: the returned value of the <structfield>pack</structfield>
\r
354 field in #GtkBoxChild-struct.
357 <!-- ##### FUNCTION gtk_box_set_child_packing ##### -->
359 Sets the way @child is packed into @box.
\r
363 @child: the #GtkWidget of the child to set.
364 @expand: the new value of the <structfield>expand</structfield> field
\r
365 in #GtkBoxChild-struct.
366 @fill: the new value of the <structfield>fill</structfield> field in
\r
368 @padding: the new value of the <structfield>padding</structfield>
\r
369 field in #GtkBoxChild-struct.
370 @pack_type: the new value of the <structfield>pack</structfield> field
\r
371 in #GtkBoxChild-struct.
374 <!-- ##### ARG GtkBox:spacing ##### -->
376 the minimum amount of space to put between children. Refers to the
\r
377 <structfield>spacing</structfield> field of #GtkBox-struct.
\r
380 <!-- ##### ARG GtkBox:homogeneous ##### -->
382 how to allocate space for children, equally or variably. Refers to
\r
383 the <structfield>homogeneous</structfield> field of #GtkBox-struct.
\r