]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/tmpl/gtkcontainer.sgml
=== Released 2.3.3 ===
[~andy/gtk] / docs / reference / gtk / tmpl / gtkcontainer.sgml
1 <!-- ##### SECTION Title ##### -->
2 GtkContainer
3
4 <!-- ##### SECTION Short_Description ##### -->
5 Base class for widgets which contain other widgets
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 A GTK+ user interface is constructed by nesting widgets inside widgets. Container widgets are the inner
10 nodes in the resulting tree of widgets: they contain other widgets. So, for example, you might have a 
11 #GtkWindow containing a #GtkFrame containing a GtkLabel. If you wanted an image instead of a textual label 
12 inside the frame, you might replace the #GtkLabel widget with a #GtkImage widget.
13 </para>
14 <para>
15 There are two major kinds of container widgets in GTK+. Both are subclasses of the abstract #GtkContainer 
16 base class.
17 </para>
18 <para>
19 The first type of container widget has a single child widget and derives from #GtkBin. These containers
20 are <firstterm>decorators</firstterm>, which add some kind of functionality to the child. For example, 
21 a #GtkButton makes its child into a clickable button; a #GtkFrame draws a frame around its child and 
22 a #GtkWindow places its child widget inside a top-level window.
23 </para>
24 <para>
25 The second type of container can have more than one child; its purpose is to manage 
26 <firstterm>layout</firstterm>. This means that these containers assign sizes and positions to their children. 
27 For example, a #GtkHBox arranges its children in a horizontal row, and a #GtkTable arranges the widgets it
28 contains in a two-dimensional grid. 
29 </para>
30 <para>
31 To fulfill its task, a layout container must negotiate the size requirements with its parent and its children.
32 This negotiation is carried out in two phases, <firstterm>size requisition</firstterm> and 
33 <firstterm>size allocation</firstterm>. 
34 </para>
35 <refsect2 id="size-requisition"><title>Size Requisition</title>
36 <para>
37 The size requisition of a widget is it's desired width and height. This is represented by a #GtkRequisition.
38 </para>
39 <para>
40 How a widget determines its desired size depends on the widget. A #GtkLabel, for example, requests enough space 
41 to display all its text. Container widgets generally base their size request on the requisitions of their 
42 children.  
43 </para>
44 <para>
45 The size requisition phase of the widget layout process operates top-down. It starts at a top-level widget,
46 typically a #GtkWindow. The top-level widget asks its child for its size requisition by calling
47 gtk_widget_size_request(). To determine its requisition, the child asks its own children for their requisitions 
48 and so on. Finally, the top-level widget will get a requisition back from its child. 
49 </para>
50 </refsect2>
51 <refsect2 id="size-allocation"><title>Size Allocation</title>
52 <para>
53 When the top-level widget has determined how much space its child would like to have, the second phase of the
54 size negotiation, size allocation, begins. Depending on its configuration (see gtk_window_set_resizable()), the 
55 top-level widget may be able to expand in order to satisfy the size request or it may have to ignore the size 
56 request and keep its fixed size. It then tells its child widget how much space it gets by calling 
57 gtk_widget_size_allocate(). The child widget divides the space among its children and tells each child how much 
58 space it got, and so on. Under normal circumstances, a #GtkWindow will always give its child the amount of space
59 the child requested.
60 </para>
61 <para>
62 A child's size allocation is represented by a #GtkAllocation. This struct contains not only a width and height, 
63 but also a position (i.e. X and Y coordinates), so that containers can tell their children not only how much
64 space they have gotten, but also where they are positioned inside the space available to the container. 
65 </para>
66 <para>
67 Widgets are required to honor the size allocation they receive; a size request is only a request, and widgets
68 must be able to cope with any size.
69 </para>
70 </refsect2>
71 <refsect2 id="child-properties"><title>Child properties</title>
72 <para>
73 <structname>GtkContainer</structname> introduces <firstterm>child 
74 properties</firstterm> - these are object properties that are not specific
75 to either the container or the contained widget, but rather to their relation.
76 Typical examples of child properties are the position or pack-type of a widget
77 which is contained in a #GtkBox.</para>
78 <para>
79 Use gtk_container_class_install_child_property() to install child properties 
80 for a container class and gtk_container_class_find_child_property() or
81 gtk_container_class_list_child_properties() to get information about existing
82 child properties.
83 </para>
84 <para>
85 To set the value of a child property, use gtk_container_child_set_property(), 
86 gtk_container_child_set() or gtk_container_child_set_valist(). 
87 To obtain the value of a child property, use 
88 gtk_container_child_get_property(), gtk_container_child_get() or
89 gtk_container_child_get_valist(). To emit notification about child property 
90 changes, use gtk_widget_child_notify().
91 </para>
92 </refsect2>
93
94 <!-- ##### SECTION See_Also ##### -->
95 <para>
96
97 </para>
98
99 <!-- ##### STRUCT GtkContainer ##### -->
100 <para>
101
102 </para>
103
104
105 <!-- ##### SIGNAL GtkContainer::add ##### -->
106 <para>
107
108 </para>
109
110 @container: the object which received the signal.
111 @widget: 
112
113 <!-- ##### SIGNAL GtkContainer::check-resize ##### -->
114 <para>
115
116 </para>
117
118 @container: the object which received the signal.
119
120 <!-- ##### SIGNAL GtkContainer::remove ##### -->
121 <para>
122
123 </para>
124
125 @container: the object which received the signal.
126 @widget: 
127
128 <!-- ##### SIGNAL GtkContainer::set-focus-child ##### -->
129 <para>
130
131 </para>
132
133 @container: the object which received the signal.
134 @widget: 
135
136 <!-- ##### ARG GtkContainer:border-width ##### -->
137 <para>
138
139 </para>
140
141 <!-- ##### ARG GtkContainer:child ##### -->
142 <para>
143
144 </para>
145
146 <!-- ##### ARG GtkContainer:resize-mode ##### -->
147 <para>
148
149 </para>
150
151 <!-- ##### MACRO GTK_IS_RESIZE_CONTAINER ##### -->
152 <para>
153
154 </para>
155
156 @widget: 
157
158
159 <!-- ##### MACRO GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID ##### -->
160 <para>
161
162 </para>
163
164 @object: 
165 @property_id: 
166 @pspec: 
167
168
169 <!-- ##### MACRO gtk_container_border_width ##### -->
170 <para>
171 Does the same as gtk_container_get_border_width().
172 </para>
173
174 @Deprecated: Use gtk_container_get_border_width() instead.
175
176
177 <!-- ##### FUNCTION gtk_container_add ##### -->
178 <para>
179
180 </para>
181
182 @container: 
183 @widget: 
184
185
186 <!-- ##### FUNCTION gtk_container_remove ##### -->
187 <para>
188
189 </para>
190
191 @container: 
192 @widget: 
193
194
195 <!-- ##### FUNCTION gtk_container_add_with_properties ##### -->
196 <para>
197
198 </para>
199
200 @container: 
201 @widget: 
202 @first_prop_name: 
203 @Varargs: 
204
205
206 <!-- ##### FUNCTION gtk_container_get_resize_mode ##### -->
207 <para>
208
209 </para>
210
211 @container: 
212 @Returns: 
213
214
215 <!-- ##### FUNCTION gtk_container_set_resize_mode ##### -->
216 <para>
217
218 </para>
219
220 @container: 
221 @resize_mode: 
222
223
224 <!-- ##### FUNCTION gtk_container_check_resize ##### -->
225 <para>
226
227 </para>
228
229 @container: 
230
231
232 <!-- ##### FUNCTION gtk_container_foreach ##### -->
233 <para>
234
235 </para>
236
237 @container: 
238 @callback: 
239 @callback_data: 
240
241
242 <!-- ##### FUNCTION gtk_container_foreach_full ##### -->
243 <para>
244
245 </para>
246
247 @container: 
248 @callback: 
249 @marshal: 
250 @callback_data: 
251 @notify: 
252 @Deprecated: Use gtk_container_foreach() instead.
253
254
255 <!-- ##### MACRO gtk_container_children ##### -->
256 <para>
257 Does the same as gtk_container_get_children().
258 </para>
259
260 @Returns: 
261 @Deprecated: Use gtk_container_get_children() instead.
262
263
264 <!-- ##### FUNCTION gtk_container_get_children ##### -->
265 <para>
266
267 </para>
268
269 @container: 
270 @Returns: 
271
272
273 <!-- ##### FUNCTION gtk_container_set_reallocate_redraws ##### -->
274 <para>
275
276 </para>
277
278 @container: 
279 @needs_redraws: 
280
281
282 <!-- ##### FUNCTION gtk_container_set_focus_child ##### -->
283 <para>
284
285 </para>
286
287 @container: 
288 @child: 
289
290
291 <!-- ##### FUNCTION gtk_container_get_focus_vadjustment ##### -->
292 <para>
293
294 </para>
295
296 @container: 
297 @Returns: 
298
299
300 <!-- ##### FUNCTION gtk_container_set_focus_vadjustment ##### -->
301 <para>
302
303 </para>
304
305 @container: 
306 @adjustment: 
307
308
309 <!-- ##### FUNCTION gtk_container_get_focus_hadjustment ##### -->
310 <para>
311
312 </para>
313
314 @container: 
315 @Returns: 
316
317
318 <!-- ##### FUNCTION gtk_container_set_focus_hadjustment ##### -->
319 <para>
320
321 </para>
322
323 @container: 
324 @adjustment: 
325
326
327 <!-- ##### FUNCTION gtk_container_resize_children ##### -->
328 <para>
329
330 </para>
331
332 @container: 
333
334
335 <!-- ##### FUNCTION gtk_container_child_type ##### -->
336 <para>
337
338 </para>
339
340 @container: 
341 @Returns: 
342
343
344 <!-- ##### FUNCTION gtk_container_child_get ##### -->
345 <para>
346
347 </para>
348
349 @container: 
350 @child: 
351 @first_prop_name: 
352 @Varargs: 
353
354
355 <!-- ##### FUNCTION gtk_container_child_set ##### -->
356 <para>
357
358 </para>
359
360 @container: 
361 @child: 
362 @first_prop_name: 
363 @Varargs: 
364 <!-- # Unused Parameters # -->
365 @first_arg_name: 
366
367
368 <!-- ##### FUNCTION gtk_container_child_get_property ##### -->
369 <para>
370
371 </para>
372
373 @container: 
374 @child: 
375 @property_name: 
376 @value: 
377
378
379 <!-- ##### FUNCTION gtk_container_child_set_property ##### -->
380 <para>
381
382 </para>
383
384 @container: 
385 @child: 
386 @property_name: 
387 @value: 
388
389
390 <!-- ##### FUNCTION gtk_container_child_get_valist ##### -->
391 <para>
392
393 </para>
394
395 @container: 
396 @child: 
397 @first_property_name: 
398 @var_args: 
399
400
401 <!-- ##### FUNCTION gtk_container_child_set_valist ##### -->
402 <para>
403
404 </para>
405
406 @container: 
407 @child: 
408 @first_property_name: 
409 @var_args: 
410
411
412 <!-- ##### FUNCTION gtk_container_forall ##### -->
413 <para>
414
415 </para>
416
417 @container: 
418 @callback: 
419 @callback_data: 
420
421
422 <!-- ##### FUNCTION gtk_container_get_border_width ##### -->
423 <para>
424
425 </para>
426
427 @container: 
428 @Returns: 
429
430
431 <!-- ##### FUNCTION gtk_container_set_border_width ##### -->
432 <para>
433
434 </para>
435
436 @container: 
437 @border_width: 
438
439
440 <!-- ##### FUNCTION gtk_container_propagate_expose ##### -->
441 <para>
442
443 </para>
444
445 @container: 
446 @child: 
447 @event: 
448
449
450 <!-- ##### FUNCTION gtk_container_get_focus_chain ##### -->
451 <para>
452
453 </para>
454
455 @container: 
456 @focusable_widgets: 
457 @Returns: 
458
459
460 <!-- ##### FUNCTION gtk_container_set_focus_chain ##### -->
461 <para>
462
463 </para>
464
465 @container: 
466 @focusable_widgets: 
467
468
469 <!-- ##### FUNCTION gtk_container_unset_focus_chain ##### -->
470 <para>
471
472 </para>
473
474 @container: 
475
476
477 <!-- ##### FUNCTION gtk_container_class_find_child_property ##### -->
478 <para>
479
480 </para>
481
482 @cclass: 
483 @property_name: 
484 @Returns: 
485 <!-- # Unused Parameters # -->
486 @class: 
487
488
489 <!-- ##### FUNCTION gtk_container_class_install_child_property ##### -->
490 <para>
491
492 </para>
493
494 @cclass: 
495 @property_id: 
496 @pspec: 
497 <!-- # Unused Parameters # -->
498 @class: 
499
500
501 <!-- ##### FUNCTION gtk_container_class_list_child_properties ##### -->
502 <para>
503
504 </para>
505
506 @cclass: 
507 @n_properties: 
508 @Returns: 
509 <!-- # Unused Parameters # -->
510 @class: 
511
512