1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.Container;
26 
27 private import cairo.Context;
28 private import glib.ListG;
29 private import glib.Str;
30 private import gobject.ObjectG;
31 private import gobject.Signals;
32 private import gobject.Value;
33 private import gtk.Adjustment;
34 private import gtk.Widget;
35 private import gtk.WidgetPath;
36 public  import gtkc.gdktypes;
37 private import gtkc.gtk;
38 public  import gtkc.gtktypes;
39 
40 
41 /**
42  * A GTK+ user interface is constructed by nesting widgets inside widgets.
43  * Container widgets are the inner nodes in the resulting tree of widgets:
44  * they contain other widgets. So, for example, you might have a #GtkWindow
45  * containing a #GtkFrame containing a #GtkLabel. If you wanted an image instead
46  * of a textual label inside the frame, you might replace the #GtkLabel widget
47  * with a #GtkImage widget.
48  * 
49  * There are two major kinds of container widgets in GTK+. Both are subclasses
50  * of the abstract GtkContainer base class.
51  * 
52  * The first type of container widget has a single child widget and derives
53  * from #GtkBin. These containers are decorators, which
54  * add some kind of functionality to the child. For example, a #GtkButton makes
55  * its child into a clickable button; a #GtkFrame draws a frame around its child
56  * and a #GtkWindow places its child widget inside a top-level window.
57  * 
58  * The second type of container can have more than one child; its purpose is to
59  * manage layout. This means that these containers assign
60  * sizes and positions to their children. For example, a #GtkHBox arranges its
61  * children in a horizontal row, and a #GtkGrid arranges the widgets it contains
62  * in a two-dimensional grid.
63  * 
64  * # Height for width geometry management
65  * 
66  * GTK+ uses a height-for-width (and width-for-height) geometry management system.
67  * Height-for-width means that a widget can change how much vertical space it needs,
68  * depending on the amount of horizontal space that it is given (and similar for
69  * width-for-height).
70  * 
71  * There are some things to keep in mind when implementing container widgets
72  * that make use of GTK+’s height for width geometry management system. First,
73  * it’s important to note that a container must prioritize one of its
74  * dimensions, that is to say that a widget or container can only have a
75  * #GtkSizeRequestMode that is %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or
76  * %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT. However, every widget and container
77  * must be able to respond to the APIs for both dimensions, i.e. even if a
78  * widget has a request mode that is height-for-width, it is possible that
79  * its parent will request its sizes using the width-for-height APIs.
80  * 
81  * To ensure that everything works properly, here are some guidelines to follow
82  * when implementing height-for-width (or width-for-height) containers.
83  * 
84  * Each request mode involves 2 virtual methods. Height-for-width apis run
85  * through gtk_widget_get_preferred_width() and then through gtk_widget_get_preferred_height_for_width().
86  * When handling requests in the opposite #GtkSizeRequestMode it is important that
87  * every widget request at least enough space to display all of its content at all times.
88  * 
89  * When gtk_widget_get_preferred_height() is called on a container that is height-for-width,
90  * the container must return the height for its minimum width. This is easily achieved by
91  * simply calling the reverse apis implemented for itself as follows:
92  * 
93  * |[<!-- language="C" -->
94  * static void
95  * foo_container_get_preferred_height (GtkWidget *widget,
96  * gint *min_height,
97  * gint *nat_height)
98  * {
99  * if (i_am_in_height_for_width_mode)
100  * {
101  * gint min_width;
102  * 
103  * GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget,
104  * &min_width,
105  * NULL);
106  * GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width
107  * (widget,
108  * min_width,
109  * min_height,
110  * nat_height);
111  * }
112  * else
113  * {
114  * ... many containers support both request modes, execute the
115  * real width-for-height request here by returning the
116  * collective heights of all widgets that are stacked
117  * vertically (or whatever is appropriate for this container)
118  * ...
119  * }
120  * }
121  * ]|
122  * 
123  * Similarly, when gtk_widget_get_preferred_width_for_height() is called for a container or widget
124  * that is height-for-width, it then only needs to return the base minimum width like so:
125  * 
126  * |[<!-- language="C" -->
127  * static void
128  * foo_container_get_preferred_width_for_height (GtkWidget *widget,
129  * gint for_height,
130  * gint *min_width,
131  * gint *nat_width)
132  * {
133  * if (i_am_in_height_for_width_mode)
134  * {
135  * GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget,
136  * min_width,
137  * nat_width);
138  * }
139  * else
140  * {
141  * ... execute the real width-for-height request here based on
142  * the required width of the children collectively if the
143  * container were to be allocated the said height ...
144  * }
145  * }
146  * ]|
147  * 
148  * Height for width requests are generally implemented in terms of a virtual allocation
149  * of widgets in the input orientation. Assuming an height-for-width request mode, a container
150  * would implement the get_preferred_height_for_width() virtual function by first calling
151  * gtk_widget_get_preferred_width() for each of its children.
152  * 
153  * For each potential group of children that are lined up horizontally, the values returned by
154  * gtk_widget_get_preferred_width() should be collected in an array of #GtkRequestedSize structures.
155  * Any child spacing should be removed from the input @for_width and then the collective size should be
156  * allocated using the gtk_distribute_natural_allocation() convenience function.
157  * 
158  * The container will then move on to request the preferred height for each child by using
159  * gtk_widget_get_preferred_height_for_width() and using the sizes stored in the #GtkRequestedSize array.
160  * 
161  * To allocate a height-for-width container, it’s again important
162  * to consider that a container must prioritize one dimension over the other. So if
163  * a container is a height-for-width container it must first allocate all widgets horizontally
164  * using a #GtkRequestedSize array and gtk_distribute_natural_allocation() and then add any
165  * extra space (if and where appropriate) for the widget to expand.
166  * 
167  * After adding all the expand space, the container assumes it was allocated sufficient
168  * height to fit all of its content. At this time, the container must use the total horizontal sizes
169  * of each widget to request the height-for-width of each of its children and store the requests in a
170  * #GtkRequestedSize array for any widgets that stack vertically (for tabular containers this can
171  * be generalized into the heights and widths of rows and columns).
172  * The vertical space must then again be distributed using gtk_distribute_natural_allocation()
173  * while this time considering the allocated height of the widget minus any vertical spacing
174  * that the container adds. Then vertical expand space should be added where appropriate and available
175  * and the container should go on to actually allocating the child widgets.
176  * 
177  * See [GtkWidget’s geometry management section][geometry-management]
178  * to learn more about implementing height-for-width geometry management for widgets.
179  * 
180  * # Child properties
181  * 
182  * GtkContainer introduces child properties.
183  * These are object properties that are not specific
184  * to either the container or the contained widget, but rather to their relation.
185  * Typical examples of child properties are the position or pack-type of a widget
186  * which is contained in a #GtkBox.
187  * 
188  * Use gtk_container_class_install_child_property() to install child properties
189  * for a container class and gtk_container_class_find_child_property() or
190  * gtk_container_class_list_child_properties() to get information about existing
191  * child properties.
192  * 
193  * To set the value of a child property, use gtk_container_child_set_property(),
194  * gtk_container_child_set() or gtk_container_child_set_valist().
195  * To obtain the value of a child property, use
196  * gtk_container_child_get_property(), gtk_container_child_get() or
197  * gtk_container_child_get_valist(). To emit notification about child property
198  * changes, use gtk_widget_child_notify().
199  * 
200  * # GtkContainer as GtkBuildable
201  * 
202  * The GtkContainer implementation of the GtkBuildable interface supports
203  * a <packing> element for children, which can contain multiple <property>
204  * elements that specify child properties for the child.
205  * 
206  * An example of child properties in UI definitions:
207  * |[
208  * <object class="GtkVBox">
209  * <child>
210  * <object class="GtkLabel"/>
211  * <packing>
212  * <property name="pack-type">start</property>
213  * </packing>
214  * </child>
215  * </object>
216  * ]|
217  * 
218  * Since 2.16, child properties can also be marked as translatable using
219  * the same “translatable”, “comments” and “context” attributes that are used
220  * for regular properties.
221  */
222 public class Container : Widget
223 {
224 	/** the main Gtk struct */
225 	protected GtkContainer* gtkContainer;
226 
227 	/** Get the main Gtk struct */
228 	public GtkContainer* getContainerStruct()
229 	{
230 		return gtkContainer;
231 	}
232 
233 	/** the main Gtk struct as a void* */
234 	protected override void* getStruct()
235 	{
236 		return cast(void*)gtkContainer;
237 	}
238 
239 	protected override void setStruct(GObject* obj)
240 	{
241 		gtkContainer = cast(GtkContainer*)obj;
242 		super.setStruct(obj);
243 	}
244 
245 	/**
246 	 * Sets our main struct and passes it to the parent class.
247 	 */
248 	public this (GtkContainer* gtkContainer, bool ownedRef = false)
249 	{
250 		this.gtkContainer = gtkContainer;
251 		super(cast(GtkWidget*)gtkContainer, ownedRef);
252 	}
253 
254 	/**
255 	 * Removes all widgets from the container
256 	 */
257 	void removeAll()
258 	{
259 		GList* gList = gtk_container_get_children(getContainerStruct());
260 		if ( gList !is null )
261 		{
262 			ListG children = new ListG(gList);
263 			for ( int i=children.length()-1 ; i>=0 ; i-- )
264 			{
265 				gtk_container_remove(getContainerStruct(), cast(GtkWidget*)children.nthData(i));
266 			}
267 		}
268 	}
269 
270 	/**
271 	 */
272 
273 	public static GType getType()
274 	{
275 		return gtk_container_get_type();
276 	}
277 
278 	/**
279 	 * Adds @widget to @container. Typically used for simple containers
280 	 * such as #GtkWindow, #GtkFrame, or #GtkButton; for more complicated
281 	 * layout containers such as #GtkBox or #GtkGrid, this function will
282 	 * pick default packing parameters that may not be correct.  So
283 	 * consider functions such as gtk_box_pack_start() and
284 	 * gtk_grid_attach() as an alternative to gtk_container_add() in
285 	 * those cases. A widget may be added to only one container at a time;
286 	 * you can’t place the same widget inside two different containers.
287 	 *
288 	 * Note that some containers, such as #GtkScrolledWindow or #GtkListBox,
289 	 * may add intermediate children between the added widget and the
290 	 * container.
291 	 *
292 	 * Params:
293 	 *     widget = a widget to be placed inside @container
294 	 */
295 	public void add(Widget widget)
296 	{
297 		gtk_container_add(gtkContainer, (widget is null) ? null : widget.getWidgetStruct());
298 	}
299 
300 	public void checkResize()
301 	{
302 		gtk_container_check_resize(gtkContainer);
303 	}
304 
305 	/**
306 	 * Gets the value of a child property for @child and @container.
307 	 *
308 	 * Params:
309 	 *     child = a widget which is a child of @container
310 	 *     propertyName = the name of the property to get
311 	 *     value = a location to return the value
312 	 */
313 	public void childGetProperty(Widget child, string propertyName, Value value)
314 	{
315 		gtk_container_child_get_property(gtkContainer, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(propertyName), (value is null) ? null : value.getValueStruct());
316 	}
317 
318 	/**
319 	 * Gets the values of one or more child properties for @child and @container.
320 	 *
321 	 * Params:
322 	 *     child = a widget which is a child of @container
323 	 *     firstPropertyName = the name of the first property to get
324 	 *     varArgs = return location for the first property, followed
325 	 *         optionally by more name/return location pairs, followed by %NULL
326 	 */
327 	public void childGetValist(Widget child, string firstPropertyName, void* varArgs)
328 	{
329 		gtk_container_child_get_valist(gtkContainer, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(firstPropertyName), varArgs);
330 	}
331 
332 	/**
333 	 * Emits a #GtkWidget::child-notify signal for the
334 	 * [child property][child-properties]
335 	 * @child_property on widget.
336 	 *
337 	 * This is an analogue of g_object_notify() for child properties.
338 	 *
339 	 * Also see gtk_widget_child_notify().
340 	 *
341 	 * Params:
342 	 *     child = the child widget
343 	 *     childProperty = the name of a child property installed on
344 	 *         the class of @container
345 	 *
346 	 * Since: 3.2
347 	 */
348 	public void childNotify(Widget child, string childProperty)
349 	{
350 		gtk_container_child_notify(gtkContainer, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(childProperty));
351 	}
352 
353 	/**
354 	 * Sets a child property for @child and @container.
355 	 *
356 	 * Params:
357 	 *     child = a widget which is a child of @container
358 	 *     propertyName = the name of the property to set
359 	 *     value = the value to set the property to
360 	 */
361 	public void childSetProperty(Widget child, string propertyName, Value value)
362 	{
363 		gtk_container_child_set_property(gtkContainer, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(propertyName), (value is null) ? null : value.getValueStruct());
364 	}
365 
366 	/**
367 	 * Sets one or more child properties for @child and @container.
368 	 *
369 	 * Params:
370 	 *     child = a widget which is a child of @container
371 	 *     firstPropertyName = the name of the first property to set
372 	 *     varArgs = a %NULL-terminated list of property names and values, starting
373 	 *         with @first_prop_name
374 	 */
375 	public void childSetValist(Widget child, string firstPropertyName, void* varArgs)
376 	{
377 		gtk_container_child_set_valist(gtkContainer, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(firstPropertyName), varArgs);
378 	}
379 
380 	/**
381 	 * Returns the type of the children supported by the container.
382 	 *
383 	 * Note that this may return %G_TYPE_NONE to indicate that no more
384 	 * children can be added, e.g. for a #GtkPaned which already has two
385 	 * children.
386 	 *
387 	 * Return: a #GType.
388 	 */
389 	public GType childType()
390 	{
391 		return gtk_container_child_type(gtkContainer);
392 	}
393 
394 	/**
395 	 * Invokes @callback on each child of @container, including children
396 	 * that are considered “internal” (implementation details of the
397 	 * container). “Internal” children generally weren’t added by the user
398 	 * of the container, but were added by the container implementation
399 	 * itself.  Most applications should use gtk_container_foreach(),
400 	 * rather than gtk_container_forall().
401 	 *
402 	 * Params:
403 	 *     callback = a callback
404 	 *     callbackData = callback user data
405 	 */
406 	public void forall(GtkCallback callback, void* callbackData)
407 	{
408 		gtk_container_forall(gtkContainer, callback, callbackData);
409 	}
410 
411 	/**
412 	 * Invokes @callback on each non-internal child of @container. See
413 	 * gtk_container_forall() for details on what constitutes an
414 	 * “internal” child.  Most applications should use
415 	 * gtk_container_foreach(), rather than gtk_container_forall().
416 	 *
417 	 * Params:
418 	 *     callback = a callback
419 	 *     callbackData = callback user data
420 	 */
421 	public void foreac(GtkCallback callback, void* callbackData)
422 	{
423 		gtk_container_foreach(gtkContainer, callback, callbackData);
424 	}
425 
426 	/**
427 	 * Retrieves the border width of the container. See
428 	 * gtk_container_set_border_width().
429 	 *
430 	 * Return: the current border width
431 	 */
432 	public uint getBorderWidth()
433 	{
434 		return gtk_container_get_border_width(gtkContainer);
435 	}
436 
437 	/**
438 	 * Returns the container’s non-internal children. See
439 	 * gtk_container_forall() for details on what constitutes an "internal" child.
440 	 *
441 	 * Return: a newly-allocated list of the container’s non-internal children.
442 	 */
443 	public ListG getChildren()
444 	{
445 		auto p = gtk_container_get_children(gtkContainer);
446 		
447 		if(p is null)
448 		{
449 			return null;
450 		}
451 		
452 		return new ListG(cast(GList*) p);
453 	}
454 
455 	/**
456 	 * Retrieves the focus chain of the container, if one has been
457 	 * set explicitly. If no focus chain has been explicitly
458 	 * set, GTK+ computes the focus chain based on the positions
459 	 * of the children. In that case, GTK+ stores %NULL in
460 	 * @focusable_widgets and returns %FALSE.
461 	 *
462 	 * Params:
463 	 *     focusableWidgets = location
464 	 *         to store the focus chain of the
465 	 *         container, or %NULL. You should free this list
466 	 *         using g_list_free() when you are done with it, however
467 	 *         no additional reference count is added to the
468 	 *         individual widgets in the focus chain.
469 	 *
470 	 * Return: %TRUE if the focus chain of the container
471 	 *     has been set explicitly.
472 	 */
473 	public bool getFocusChain(out ListG focusableWidgets)
474 	{
475 		GList* outfocusableWidgets = null;
476 		
477 		auto p = gtk_container_get_focus_chain(gtkContainer, &outfocusableWidgets) != 0;
478 		
479 		focusableWidgets = new ListG(outfocusableWidgets);
480 		
481 		return p;
482 	}
483 
484 	/**
485 	 * Returns the current focus child widget inside @container. This is not the
486 	 * currently focused widget. That can be obtained by calling
487 	 * gtk_window_get_focus().
488 	 *
489 	 * Return: The child widget which will receive the
490 	 *     focus inside @container when the @conatiner is focussed,
491 	 *     or %NULL if none is set.
492 	 *
493 	 * Since: 2.14
494 	 */
495 	public Widget getFocusChild()
496 	{
497 		auto p = gtk_container_get_focus_child(gtkContainer);
498 		
499 		if(p is null)
500 		{
501 			return null;
502 		}
503 		
504 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
505 	}
506 
507 	/**
508 	 * Retrieves the horizontal focus adjustment for the container. See
509 	 * gtk_container_set_focus_hadjustment ().
510 	 *
511 	 * Return: the horizontal focus adjustment, or %NULL if
512 	 *     none has been set.
513 	 */
514 	public Adjustment getFocusHadjustment()
515 	{
516 		auto p = gtk_container_get_focus_hadjustment(gtkContainer);
517 		
518 		if(p is null)
519 		{
520 			return null;
521 		}
522 		
523 		return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p);
524 	}
525 
526 	/**
527 	 * Retrieves the vertical focus adjustment for the container. See
528 	 * gtk_container_set_focus_vadjustment().
529 	 *
530 	 * Return: the vertical focus adjustment, or %NULL if
531 	 *     none has been set.
532 	 */
533 	public Adjustment getFocusVadjustment()
534 	{
535 		auto p = gtk_container_get_focus_vadjustment(gtkContainer);
536 		
537 		if(p is null)
538 		{
539 			return null;
540 		}
541 		
542 		return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) p);
543 	}
544 
545 	/**
546 	 * Returns a newly created widget path representing all the widget hierarchy
547 	 * from the toplevel down to and including @child.
548 	 *
549 	 * Params:
550 	 *     child = a child of @container
551 	 *
552 	 * Return: A newly created #GtkWidgetPath
553 	 */
554 	public WidgetPath getPathForChild(Widget child)
555 	{
556 		auto p = gtk_container_get_path_for_child(gtkContainer, (child is null) ? null : child.getWidgetStruct());
557 		
558 		if(p is null)
559 		{
560 			return null;
561 		}
562 		
563 		return ObjectG.getDObject!(WidgetPath)(cast(GtkWidgetPath*) p);
564 	}
565 
566 	/**
567 	 * Returns the resize mode for the container. See
568 	 * gtk_container_set_resize_mode ().
569 	 *
570 	 * Deprecated: Resize modes are deprecated. They aren’t necessary
571 	 * anymore since frame clocks and might introduce obscure bugs if
572 	 * used.
573 	 *
574 	 * Return: the current resize mode
575 	 */
576 	public GtkResizeMode getResizeMode()
577 	{
578 		return gtk_container_get_resize_mode(gtkContainer);
579 	}
580 
581 	/**
582 	 * When a container receives a call to the draw function, it must send
583 	 * synthetic #GtkWidget::draw calls to all children that don’t have their
584 	 * own #GdkWindows. This function provides a convenient way of doing this.
585 	 * A container, when it receives a call to its #GtkWidget::draw function,
586 	 * calls gtk_container_propagate_draw() once for each child, passing in
587 	 * the @cr the container received.
588 	 *
589 	 * gtk_container_propagate_draw() takes care of translating the origin of @cr,
590 	 * and deciding whether the draw needs to be sent to the child. It is a
591 	 * convenient and optimized way of getting the same effect as calling
592 	 * gtk_widget_draw() on the child directly.
593 	 *
594 	 * In most cases, a container can simply either inherit the
595 	 * #GtkWidget::draw implementation from #GtkContainer, or do some drawing
596 	 * and then chain to the ::draw implementation from #GtkContainer.
597 	 *
598 	 * Params:
599 	 *     child = a child of @container
600 	 *     cr = Cairo context as passed to the container. If you want to use @cr
601 	 *         in container’s draw function, consider using cairo_save() and
602 	 *         cairo_restore() before calling this function.
603 	 */
604 	public void propagateDraw(Widget child, Context cr)
605 	{
606 		gtk_container_propagate_draw(gtkContainer, (child is null) ? null : child.getWidgetStruct(), (cr is null) ? null : cr.getContextStruct());
607 	}
608 
609 	/**
610 	 * Removes @widget from @container. @widget must be inside @container.
611 	 * Note that @container will own a reference to @widget, and that this
612 	 * may be the last reference held; so removing a widget from its
613 	 * container can destroy that widget. If you want to use @widget
614 	 * again, you need to add a reference to it while it’s not inside
615 	 * a container, using g_object_ref(). If you don’t want to use @widget
616 	 * again it’s usually more efficient to simply destroy it directly
617 	 * using gtk_widget_destroy() since this will remove it from the
618 	 * container and help break any circular reference count cycles.
619 	 *
620 	 * Params:
621 	 *     widget = a current child of @container
622 	 */
623 	public void remove(Widget widget)
624 	{
625 		gtk_container_remove(gtkContainer, (widget is null) ? null : widget.getWidgetStruct());
626 	}
627 
628 	public void resizeChildren()
629 	{
630 		gtk_container_resize_children(gtkContainer);
631 	}
632 
633 	/**
634 	 * Sets the border width of the container.
635 	 *
636 	 * The border width of a container is the amount of space to leave
637 	 * around the outside of the container. The only exception to this is
638 	 * #GtkWindow; because toplevel windows can’t leave space outside,
639 	 * they leave the space inside. The border is added on all sides of
640 	 * the container. To add space to only one side, use a specific
641 	 * #GtkWidget:margin property on the child widget, for example
642 	 * #GtkWidget:margin-top.
643 	 *
644 	 * Params:
645 	 *     borderWidth = amount of blank space to leave outside
646 	 *         the container. Valid values are in the range 0-65535 pixels.
647 	 */
648 	public void setBorderWidth(uint borderWidth)
649 	{
650 		gtk_container_set_border_width(gtkContainer, borderWidth);
651 	}
652 
653 	/**
654 	 * Sets a focus chain, overriding the one computed automatically by GTK+.
655 	 *
656 	 * In principle each widget in the chain should be a descendant of the
657 	 * container, but this is not enforced by this method, since it’s allowed
658 	 * to set the focus chain before you pack the widgets, or have a widget
659 	 * in the chain that isn’t always packed. The necessary checks are done
660 	 * when the focus chain is actually traversed.
661 	 *
662 	 * Params:
663 	 *     focusableWidgets = the new focus chain
664 	 */
665 	public void setFocusChain(ListG focusableWidgets)
666 	{
667 		gtk_container_set_focus_chain(gtkContainer, (focusableWidgets is null) ? null : focusableWidgets.getListGStruct());
668 	}
669 
670 	/**
671 	 * Sets, or unsets if @child is %NULL, the focused child of @container.
672 	 *
673 	 * This function emits the GtkContainer::set_focus_child signal of
674 	 * @container. Implementations of #GtkContainer can override the
675 	 * default behaviour by overriding the class closure of this signal.
676 	 *
677 	 * This is function is mostly meant to be used by widgets. Applications can use
678 	 * gtk_widget_grab_focus() to manualy set the focus to a specific widget.
679 	 *
680 	 * Params:
681 	 *     child = a #GtkWidget, or %NULL
682 	 */
683 	public void setFocusChild(Widget child)
684 	{
685 		gtk_container_set_focus_child(gtkContainer, (child is null) ? null : child.getWidgetStruct());
686 	}
687 
688 	/**
689 	 * Hooks up an adjustment to focus handling in a container, so when a child
690 	 * of the container is focused, the adjustment is scrolled to show that
691 	 * widget. This function sets the horizontal alignment.
692 	 * See gtk_scrolled_window_get_hadjustment() for a typical way of obtaining
693 	 * the adjustment and gtk_container_set_focus_vadjustment() for setting
694 	 * the vertical adjustment.
695 	 *
696 	 * The adjustments have to be in pixel units and in the same coordinate
697 	 * system as the allocation for immediate children of the container.
698 	 *
699 	 * Params:
700 	 *     adjustment = an adjustment which should be adjusted when the focus is
701 	 *         moved among the descendents of @container
702 	 */
703 	public void setFocusHadjustment(Adjustment adjustment)
704 	{
705 		gtk_container_set_focus_hadjustment(gtkContainer, (adjustment is null) ? null : adjustment.getAdjustmentStruct());
706 	}
707 
708 	/**
709 	 * Hooks up an adjustment to focus handling in a container, so when a
710 	 * child of the container is focused, the adjustment is scrolled to
711 	 * show that widget. This function sets the vertical alignment. See
712 	 * gtk_scrolled_window_get_vadjustment() for a typical way of obtaining
713 	 * the adjustment and gtk_container_set_focus_hadjustment() for setting
714 	 * the horizontal adjustment.
715 	 *
716 	 * The adjustments have to be in pixel units and in the same coordinate
717 	 * system as the allocation for immediate children of the container.
718 	 *
719 	 * Params:
720 	 *     adjustment = an adjustment which should be adjusted when the focus
721 	 *         is moved among the descendents of @container
722 	 */
723 	public void setFocusVadjustment(Adjustment adjustment)
724 	{
725 		gtk_container_set_focus_vadjustment(gtkContainer, (adjustment is null) ? null : adjustment.getAdjustmentStruct());
726 	}
727 
728 	/**
729 	 * Sets the @reallocate_redraws flag of the container to the given value.
730 	 *
731 	 * Containers requesting reallocation redraws get automatically
732 	 * redrawn if any of their children changed allocation.
733 	 *
734 	 * Deprecated: Call gtk_widget_queue_draw() in your size_allocate handler.
735 	 *
736 	 * Params:
737 	 *     needsRedraws = the new value for the container’s @reallocate_redraws flag
738 	 */
739 	public void setReallocateRedraws(bool needsRedraws)
740 	{
741 		gtk_container_set_reallocate_redraws(gtkContainer, needsRedraws);
742 	}
743 
744 	/**
745 	 * Sets the resize mode for the container.
746 	 *
747 	 * The resize mode of a container determines whether a resize request
748 	 * will be passed to the container’s parent, queued for later execution
749 	 * or executed immediately.
750 	 *
751 	 * Deprecated: Resize modes are deprecated. They aren’t necessary
752 	 * anymore since frame clocks and might introduce obscure bugs if
753 	 * used.
754 	 *
755 	 * Params:
756 	 *     resizeMode = the new resize mode
757 	 */
758 	public void setResizeMode(GtkResizeMode resizeMode)
759 	{
760 		gtk_container_set_resize_mode(gtkContainer, resizeMode);
761 	}
762 
763 	/**
764 	 * Removes a focus chain explicitly set with gtk_container_set_focus_chain().
765 	 */
766 	public void unsetFocusChain()
767 	{
768 		gtk_container_unset_focus_chain(gtkContainer);
769 	}
770 
771 	int[string] connectedSignals;
772 
773 	void delegate(Widget, Container)[] onAddListeners;
774 	void addOnAdd(void delegate(Widget, Container) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
775 	{
776 		if ( "add" !in connectedSignals )
777 		{
778 			Signals.connectData(
779 				this,
780 				"add",
781 				cast(GCallback)&callBackAdd,
782 				cast(void*)this,
783 				null,
784 				connectFlags);
785 			connectedSignals["add"] = 1;
786 		}
787 		onAddListeners ~= dlg;
788 	}
789 	extern(C) static void callBackAdd(GtkContainer* containerStruct, GtkWidget* object, Container _container)
790 	{
791 		foreach ( void delegate(Widget, Container) dlg; _container.onAddListeners )
792 		{
793 			dlg(ObjectG.getDObject!(Widget)(object), _container);
794 		}
795 	}
796 
797 	void delegate(Container)[] onCheckResizeListeners;
798 	void addOnCheckResize(void delegate(Container) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
799 	{
800 		if ( "check-resize" !in connectedSignals )
801 		{
802 			Signals.connectData(
803 				this,
804 				"check-resize",
805 				cast(GCallback)&callBackCheckResize,
806 				cast(void*)this,
807 				null,
808 				connectFlags);
809 			connectedSignals["check-resize"] = 1;
810 		}
811 		onCheckResizeListeners ~= dlg;
812 	}
813 	extern(C) static void callBackCheckResize(GtkContainer* containerStruct, Container _container)
814 	{
815 		foreach ( void delegate(Container) dlg; _container.onCheckResizeListeners )
816 		{
817 			dlg(_container);
818 		}
819 	}
820 
821 	void delegate(Widget, Container)[] onRemoveListeners;
822 	void addOnRemove(void delegate(Widget, Container) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
823 	{
824 		if ( "remove" !in connectedSignals )
825 		{
826 			Signals.connectData(
827 				this,
828 				"remove",
829 				cast(GCallback)&callBackRemove,
830 				cast(void*)this,
831 				null,
832 				connectFlags);
833 			connectedSignals["remove"] = 1;
834 		}
835 		onRemoveListeners ~= dlg;
836 	}
837 	extern(C) static void callBackRemove(GtkContainer* containerStruct, GtkWidget* object, Container _container)
838 	{
839 		foreach ( void delegate(Widget, Container) dlg; _container.onRemoveListeners )
840 		{
841 			dlg(ObjectG.getDObject!(Widget)(object), _container);
842 		}
843 	}
844 
845 	void delegate(Widget, Container)[] onSetFocusChildListeners;
846 	void addOnSetFocusChild(void delegate(Widget, Container) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
847 	{
848 		if ( "set-focus-child" !in connectedSignals )
849 		{
850 			Signals.connectData(
851 				this,
852 				"set-focus-child",
853 				cast(GCallback)&callBackSetFocusChild,
854 				cast(void*)this,
855 				null,
856 				connectFlags);
857 			connectedSignals["set-focus-child"] = 1;
858 		}
859 		onSetFocusChildListeners ~= dlg;
860 	}
861 	extern(C) static void callBackSetFocusChild(GtkContainer* containerStruct, GtkWidget* object, Container _container)
862 	{
863 		foreach ( void delegate(Widget, Container) dlg; _container.onSetFocusChildListeners )
864 		{
865 			dlg(ObjectG.getDObject!(Widget)(object), _container);
866 		}
867 	}
868 }