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