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.BoxLayout;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.LayoutManager;
30 private import gtk.OrientableIF;
31 private import gtk.OrientableT;
32 private import gtk.c.functions;
33 public  import gtk.c.types;
34 
35 
36 /**
37  * `GtkBoxLayout` is a layout manager that arranges children in a single
38  * row or column.
39  * 
40  * Whether it is a row or column depends on the value of its
41  * [property@Gtk.Orientable:orientation] property. Within the other dimension
42  * all children all allocated the same size. The `GtkBoxLayout` will respect
43  * the [property@Gtk.Widget:halign] and [property@Gtk.Widget:valign]
44  * properties of each child widget.
45  * 
46  * If you want all children to be assigned the same size, you can use
47  * the [property@Gtk.BoxLayout:homogeneous] property.
48  * 
49  * If you want to specify the amount of space placed between each child,
50  * you can use the [property@Gtk.BoxLayout:spacing] property.
51  */
52 public class BoxLayout : LayoutManager, OrientableIF
53 {
54 	/** the main Gtk struct */
55 	protected GtkBoxLayout* gtkBoxLayout;
56 
57 	/** Get the main Gtk struct */
58 	public GtkBoxLayout* getBoxLayoutStruct(bool transferOwnership = false)
59 	{
60 		if (transferOwnership)
61 			ownedRef = false;
62 		return gtkBoxLayout;
63 	}
64 
65 	/** the main Gtk struct as a void* */
66 	protected override void* getStruct()
67 	{
68 		return cast(void*)gtkBoxLayout;
69 	}
70 
71 	/**
72 	 * Sets our main struct and passes it to the parent class.
73 	 */
74 	public this (GtkBoxLayout* gtkBoxLayout, bool ownedRef = false)
75 	{
76 		this.gtkBoxLayout = gtkBoxLayout;
77 		super(cast(GtkLayoutManager*)gtkBoxLayout, ownedRef);
78 	}
79 
80 	// add the Orientable capabilities
81 	mixin OrientableT!(GtkBoxLayout);
82 
83 
84 	/** */
85 	public static GType getType()
86 	{
87 		return gtk_box_layout_get_type();
88 	}
89 
90 	/**
91 	 * Creates a new `GtkBoxLayout`.
92 	 *
93 	 * Params:
94 	 *     orientation = the orientation for the new layout
95 	 *
96 	 * Returns: a new box layout
97 	 *
98 	 * Throws: ConstructionException GTK+ fails to create the object.
99 	 */
100 	public this(GtkOrientation orientation)
101 	{
102 		auto __p = gtk_box_layout_new(orientation);
103 
104 		if(__p is null)
105 		{
106 			throw new ConstructionException("null returned by new");
107 		}
108 
109 		this(cast(GtkBoxLayout*) __p, true);
110 	}
111 
112 	/**
113 	 * Gets the value set by gtk_box_layout_set_baseline_position().
114 	 *
115 	 * Returns: the baseline position
116 	 */
117 	public GtkBaselinePosition getBaselinePosition()
118 	{
119 		return gtk_box_layout_get_baseline_position(gtkBoxLayout);
120 	}
121 
122 	/**
123 	 * Returns whether the layout is set to be homogeneous.
124 	 *
125 	 * Returns: %TRUE if the layout is homogeneous
126 	 */
127 	public bool getHomogeneous()
128 	{
129 		return gtk_box_layout_get_homogeneous(gtkBoxLayout) != 0;
130 	}
131 
132 	/**
133 	 * Returns the space that @box_layout puts between children.
134 	 *
135 	 * Returns: the spacing of the layout
136 	 */
137 	public uint getSpacing()
138 	{
139 		return gtk_box_layout_get_spacing(gtkBoxLayout);
140 	}
141 
142 	/**
143 	 * Sets the baseline position of a box layout.
144 	 *
145 	 * The baseline position affects only horizontal boxes with at least one
146 	 * baseline aligned child. If there is more vertical space available than
147 	 * requested, and the baseline is not allocated by the parent then the
148 	 * given @position is used to allocate the baseline within the extra
149 	 * space available.
150 	 *
151 	 * Params:
152 	 *     position = a `GtkBaselinePosition`
153 	 */
154 	public void setBaselinePosition(GtkBaselinePosition position)
155 	{
156 		gtk_box_layout_set_baseline_position(gtkBoxLayout, position);
157 	}
158 
159 	/**
160 	 * Sets whether the box layout will allocate the same
161 	 * size to all children.
162 	 *
163 	 * Params:
164 	 *     homogeneous = %TRUE to set the box layout as homogeneous
165 	 */
166 	public void setHomogeneous(bool homogeneous)
167 	{
168 		gtk_box_layout_set_homogeneous(gtkBoxLayout, homogeneous);
169 	}
170 
171 	/**
172 	 * Sets how much spacing to put between children.
173 	 *
174 	 * Params:
175 	 *     spacing = the spacing to apply between children
176 	 */
177 	public void setSpacing(uint spacing)
178 	{
179 		gtk_box_layout_set_spacing(gtkBoxLayout, spacing);
180 	}
181 }