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