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  = GtkAlignment.html
27  * outPack = gtk
28  * outFile = Alignment
29  * strct   = GtkAlignment
30  * realStrct=
31  * ctorStrct=
32  * clss    = Alignment
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_alignment_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- gtk.Widget
48  * structWrap:
49  * module aliases:
50  * local aliases:
51  * overrides:
52  */
53 
54 module gtk.Alignment;
55 
56 public  import gtkc.gtktypes;
57 
58 private import gtkc.gtk;
59 private import glib.ConstructionException;
60 private import gobject.ObjectG;
61 
62 
63 private import gtk.Widget;
64 
65 
66 
67 private import gtk.Bin;
68 
69 /**
70  * Description
71  * The GtkAlignment widget controls the alignment and size of its child widget.
72  * It has four settings: xscale, yscale, xalign, and yalign.
73  * The scale settings are used to specify how much the child widget should
74  * expand to fill the space allocated to the GtkAlignment.
75  * The values can range from 0 (meaning the child doesn't expand at all) to
76  * 1 (meaning the child expands to fill all of the available space).
77  * The align settings are used to place the child widget within the available
78  * area. The values range from 0 (top or left) to 1 (bottom or right).
79  * Of course, if the scale settings are both set to 1, the alignment settings
80  * have no effect.
81  */
82 public class Alignment : Bin
83 {
84 	
85 	/** the main Gtk struct */
86 	protected GtkAlignment* gtkAlignment;
87 	
88 	
89 	public GtkAlignment* getAlignmentStruct()
90 	{
91 		return gtkAlignment;
92 	}
93 	
94 	
95 	/** the main Gtk struct as a void* */
96 	protected override void* getStruct()
97 	{
98 		return cast(void*)gtkAlignment;
99 	}
100 	
101 	/**
102 	 * Sets our main struct and passes it to the parent class
103 	 */
104 	public this (GtkAlignment* gtkAlignment)
105 	{
106 		super(cast(GtkBin*)gtkAlignment);
107 		this.gtkAlignment = gtkAlignment;
108 	}
109 	
110 	protected override void setStruct(GObject* obj)
111 	{
112 		super.setStruct(obj);
113 		gtkAlignment = cast(GtkAlignment*)obj;
114 	}
115 	
116 	/** */
117 	public static Alignment center(Widget widget)
118 	{
119 		Alignment a = new Alignment(0.5, 0.5, 0, 0);
120 		a.add(widget);
121 		return a;
122 	}
123 	
124 	/** */
125 	public static Alignment north(Widget widget)
126 	{
127 		Alignment a = new Alignment(0.5, 0.0, 0, 0);
128 		a.add(widget);
129 		return a;
130 	}
131 	
132 	/** */
133 	public static Alignment south(Widget widget)
134 	{
135 		Alignment a = new Alignment(0.5, 1.0, 0, 0);
136 		a.add(widget);
137 		return a;
138 	}
139 	
140 	/** */
141 	public static Alignment east(Widget widget)
142 	{
143 		Alignment a = new Alignment(1.0, 0.5, 0, 0);
144 		a.add(widget);
145 		return a;
146 	}
147 	
148 	/** */
149 	public static Alignment west(Widget widget)
150 	{
151 		Alignment a = new Alignment(0.0, 0.5, 0, 0);
152 		a.add(widget);
153 		return a;
154 	}
155 	
156 	/** */
157 	public static Alignment northWest(Widget widget)
158 	{
159 		Alignment a = new Alignment(0.0, 0.0, 0, 0);
160 		a.add(widget);
161 		return a;
162 	}
163 	
164 	/** */
165 	public static Alignment southWest(Widget widget)
166 	{
167 		Alignment a = new Alignment(0.0, 0.5, 0, 0);
168 		a.add(widget);
169 		return a;
170 	}
171 	
172 	/** */
173 	public static Alignment northEast(Widget widget)
174 	{
175 		Alignment a = new Alignment(1.0, 0.0, 0, 0);
176 		a.add(widget);
177 		return a;
178 	}
179 	
180 	/** */
181 	public static Alignment southEast(Widget widget)
182 	{
183 		Alignment a = new Alignment(1.0, 1.0, 0, 0);
184 		a.add(widget);
185 		return a;
186 	}
187 	
188 	/**
189 	 */
190 	
191 	/**
192 	 * Creates a new GtkAlignment.
193 	 * Params:
194 	 * xalign = the horizontal alignment of the child widget, from 0 (left) to 1
195 	 * (right).
196 	 * yalign = the vertical alignment of the child widget, from 0 (top) to 1
197 	 * (bottom).
198 	 * xscale = the amount that the child widget expands horizontally to fill up
199 	 * unused space, from 0 to 1.
200 	 * A value of 0 indicates that the child widget should never expand.
201 	 * A value of 1 indicates that the child widget will expand to fill all of the
202 	 * space allocated for the GtkAlignment.
203 	 * yscale = the amount that the child widget expands vertically to fill up
204 	 * unused space, from 0 to 1. The values are similar to xscale.
205 	 * Throws: ConstructionException GTK+ fails to create the object.
206 	 */
207 	public this (float xalign, float yalign, float xscale, float yscale)
208 	{
209 		// GtkWidget * gtk_alignment_new (gfloat xalign,  gfloat yalign,  gfloat xscale,  gfloat yscale);
210 		auto p = gtk_alignment_new(xalign, yalign, xscale, yscale);
211 		if(p is null)
212 		{
213 			throw new ConstructionException("null returned by gtk_alignment_new(xalign, yalign, xscale, yscale)");
214 		}
215 		this(cast(GtkAlignment*) p);
216 	}
217 	
218 	/**
219 	 * Sets the GtkAlignment values.
220 	 * Params:
221 	 * xalign = the horizontal alignment of the child widget, from 0 (left) to 1
222 	 * (right).
223 	 * yalign = the vertical alignment of the child widget, from 0 (top) to 1
224 	 * (bottom).
225 	 * xscale = the amount that the child widget expands horizontally to fill up
226 	 * unused space, from 0 to 1.
227 	 * A value of 0 indicates that the child widget should never expand.
228 	 * A value of 1 indicates that the child widget will expand to fill all of the
229 	 * space allocated for the GtkAlignment.
230 	 * yscale = the amount that the child widget expands vertically to fill up
231 	 * unused space, from 0 to 1. The values are similar to xscale.
232 	 */
233 	public void set(float xalign, float yalign, float xscale, float yscale)
234 	{
235 		// void gtk_alignment_set (GtkAlignment *alignment,  gfloat xalign,  gfloat yalign,  gfloat xscale,  gfloat yscale);
236 		gtk_alignment_set(gtkAlignment, xalign, yalign, xscale, yscale);
237 	}
238 	
239 	/**
240 	 * Gets the padding on the different sides of the widget.
241 	 * See gtk_alignment_set_padding().
242 	 * Since 2.4
243 	 * Params:
244 	 * paddingTop = location to store the padding for
245 	 * the top of the widget, or NULL. [out][allow-none]
246 	 * paddingBottom = location to store the padding
247 	 * for the bottom of the widget, or NULL. [out][allow-none]
248 	 * paddingLeft = location to store the padding
249 	 * for the left of the widget, or NULL. [out][allow-none]
250 	 * paddingRight = location to store the padding
251 	 * for the right of the widget, or NULL. [out][allow-none]
252 	 */
253 	public void getPadding(out uint paddingTop, out uint paddingBottom, out uint paddingLeft, out uint paddingRight)
254 	{
255 		// void gtk_alignment_get_padding (GtkAlignment *alignment,  guint *padding_top,  guint *padding_bottom,  guint *padding_left,  guint *padding_right);
256 		gtk_alignment_get_padding(gtkAlignment, &paddingTop, &paddingBottom, &paddingLeft, &paddingRight);
257 	}
258 	
259 	/**
260 	 * Sets the padding on the different sides of the widget.
261 	 * The padding adds blank space to the sides of the widget. For instance,
262 	 * this can be used to indent the child widget towards the right by adding
263 	 * padding on the left.
264 	 * Since 2.4
265 	 * Params:
266 	 * paddingTop = the padding at the top of the widget
267 	 * paddingBottom = the padding at the bottom of the widget
268 	 * paddingLeft = the padding at the left of the widget
269 	 * paddingRight = the padding at the right of the widget.
270 	 */
271 	public void setPadding(uint paddingTop, uint paddingBottom, uint paddingLeft, uint paddingRight)
272 	{
273 		// void gtk_alignment_set_padding (GtkAlignment *alignment,  guint padding_top,  guint padding_bottom,  guint padding_left,  guint padding_right);
274 		gtk_alignment_set_padding(gtkAlignment, paddingTop, paddingBottom, paddingLeft, paddingRight);
275 	}
276 }