]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/tmpl/gtkbox.sgml
Remove a (now) misleading comment.
[~andy/gtk] / docs / reference / gtk / tmpl / gtkbox.sgml
1 <!-- ##### SECTION Title ##### -->
2 GtkBox
3
4 <!-- ##### SECTION Short_Description ##### -->
5 a base class for box containers
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>\r
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
13 </para>\r
14 <para>\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
20 </para>\r
21 <para>\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
29 </para>\r
30 <para>\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
35 </para>\r
36 <para>\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
41 added.\r
42 </para>\r
43 <para>\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
48 </para>\r
49 <para>\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
52 </para>\r
53 <para>\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
56 </para>\r
57 <para>\r
58 Use gtk_box_reorder_child() to move a GtkBox child to a different\r
59 place in the box.\r
60 </para>\r
61 <para>\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
66 </para>
67
68 <!-- ##### SECTION See_Also ##### -->
69 <para>\r
70 <variablelist>\r
71 \r
72 <varlistentry>\r
73 <term>#GtkHBox</term>\r
74 <listitem><para>a derived class that organizes widgets into a row.</para></listitem>\r
75 </varlistentry>\r
76 \r
77 <varlistentry>\r
78 <term>#GtkVBox</term>\r
79 <listitem><para>a derived class that organizes widgets into a column.</para></listitem>\r
80 </varlistentry>\r
81 \r
82 <varlistentry>\r
83 <term>#GtkFrame</term>\r
84 <listitem><para>a #GtkWidget useful for drawing a border around a GtkBox.</para></listitem>\r
85 </varlistentry>\r
86 \r
87 <varlistentry>\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
91 </varlistentry>\r
92 \r
93 <varlistentry>\r
94 <term>#GtkLayout</term>\r
95 <listitem><para>a #GtkContainer for organizing widgets into arbitrary\r
96 layouts.</para></listitem>\r
97 </varlistentry>\r
98 \r
99 </variablelist>\r
100 \r
101 </para>
102
103 <!-- ##### STRUCT GtkBox ##### -->
104 <para>\r
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
107 an application.)\r
108 \r
109 <informaltable pgwide=1 frame="none" role="struct">\r
110 <tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*">\r
111 <tbody>\r
112 \r
113 <row>\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
117 </row>\r
118 \r
119 <row>\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
123 </row>\r
124 \r
125 <row>\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
129 field.</entry>\r
130 </row>\r
131 </tbody></tgroup></informaltable>
132 </para>
133
134
135 <!-- ##### STRUCT GtkBoxChild ##### -->
136 <para>\r
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
143 </para>\r
144 <para>\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
147 application.)\r
148 \r
149 <informaltable pgwide=1 frame="none" role="struct">\r
150 <tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*">\r
151 <tbody>\r
152 \r
153 <row>\r
154 <entry>#GtkWidget * <structfield>widget</structfield>;</entry>\r
155 <entry>the child widget, packed into the GtkBox.</entry>\r
156 </row>\r
157 \r
158 <row>\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
162 </row>\r
163 \r
164 <row>\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
169 default.</entry>\r
170 </row>\r
171 \r
172 <row>\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
178 </row>\r
179 \r
180 <row>\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
184 </row>\r
185 </tbody></tgroup></informaltable>\r
186 </para>
187
188 @widget: 
189 @padding: 
190 @expand: 
191 @fill: 
192 @pack: 
193 @is_secondary: 
194
195 <!-- ##### FUNCTION gtk_box_pack_start ##### -->
196 <para>\r
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
199 start of @box.\r
200 </para>
201
202 @box: a #GtkBox.
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.
217
218
219 <!-- ##### FUNCTION gtk_box_pack_end ##### -->
220 <para>\r
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
223 end of @box.\r
224 </para>
225
226 @box: a #GtkBox.
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.
241
242
243 <!-- ##### FUNCTION gtk_box_pack_start_defaults ##### -->
244 <para>\r
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
247 start of @box.\r
248 </para>\r
249 <para>\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
254 </para>
255
256 @box: a #GtkBox.
257 @widget: the #GtkWidget to be added to @box.
258
259
260 <!-- ##### FUNCTION gtk_box_pack_end_defaults ##### -->
261 <para>\r
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
265 </para>\r
266 <para>\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
271 </para>
272
273 @box: a #GtkBox.
274 @widget: the #GtkWidget to be added to @box.
275
276
277 <!-- ##### FUNCTION gtk_box_get_homogeneous ##### -->
278 <para>
279
280 </para>
281
282 @box: 
283 @Returns: 
284
285
286 <!-- ##### FUNCTION gtk_box_set_homogeneous ##### -->
287 <para>\r
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
291 </para>
292
293 @box: a #GtkBox.
294 @homogeneous: a boolean value, %TRUE to create equal allotments,\r
295 %FALSE for variable allotments.
296
297
298 <!-- ##### FUNCTION gtk_box_get_spacing ##### -->
299 <para>
300
301 </para>
302
303 @box: 
304 @Returns: 
305
306
307 <!-- ##### FUNCTION gtk_box_set_spacing ##### -->
308 <para>\r
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
311 </para>
312
313 @box: a #GtkBox.
314 @spacing: the number of pixels to put between children.
315
316
317 <!-- ##### FUNCTION gtk_box_reorder_child ##### -->
318 <para>\r
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
324 </para>\r
325 <para>\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
331 </para>
332
333 @box: a #GtkBox.
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
337 from 0.
338
339
340 <!-- ##### FUNCTION gtk_box_query_child_packing ##### -->
341 <para>\r
342 Returns information about how @child is packed into @box.\r
343 </para>
344
345 @box: a #GtkBox.
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.
355
356
357 <!-- ##### FUNCTION gtk_box_set_child_packing ##### -->
358 <para>\r
359 Sets the way @child is packed into @box.\r
360 </para>
361
362 @box: a #GtkBox.
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
367 #GtkBoxChild-struct.
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.
372
373
374 <!-- ##### ARG GtkBox:spacing ##### -->
375 <para>\r
376 the minimum amount of space to put between children.  Refers to the\r
377 <structfield>spacing</structfield> field of #GtkBox-struct.\r
378 </para>
379
380 <!-- ##### ARG GtkBox:homogeneous ##### -->
381 <para>\r
382 how to allocate space for children, equally or variably.  Refers to\r
383 the <structfield>homogeneous</structfield> field of #GtkBox-struct.\r
384 </para>
385