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.Misc;
26 
27 private import gtk.Widget;
28 private import gtkc.gtk;
29 public  import gtkc.gtktypes;
30 
31 
32 /**
33  * The #GtkMisc widget is an abstract widget which is not useful itself, but
34  * is used to derive subclasses which have alignment and padding attributes.
35  * 
36  * The horizontal and vertical padding attributes allows extra space to be
37  * added around the widget.
38  * 
39  * The horizontal and vertical alignment attributes enable the widget to be
40  * positioned within its allocated area. Note that if the widget is added to
41  * a container in such a way that it expands automatically to fill its
42  * allocated area, the alignment settings will not alter the widget's position.
43  * 
44  * Note that the desired effect can in most cases be achieved by using the
45  * #GtkWidget:halign, #GtkWidget:valign and #GtkWidget:margin properties
46  * on the child widget, so GtkMisc should not be used in new code. To reflect
47  * this fact, all #GtkMisc API has been deprecated.
48  */
49 public class Misc : Widget
50 {
51 	/** the main Gtk struct */
52 	protected GtkMisc* gtkMisc;
53 
54 	/** Get the main Gtk struct */
55 	public GtkMisc* getMiscStruct(bool transferOwnership = false)
56 	{
57 		if (transferOwnership)
58 			ownedRef = false;
59 		return gtkMisc;
60 	}
61 
62 	/** the main Gtk struct as a void* */
63 	protected override void* getStruct()
64 	{
65 		return cast(void*)gtkMisc;
66 	}
67 
68 	protected override void setStruct(GObject* obj)
69 	{
70 		gtkMisc = cast(GtkMisc*)obj;
71 		super.setStruct(obj);
72 	}
73 
74 	/**
75 	 * Sets our main struct and passes it to the parent class.
76 	 */
77 	public this (GtkMisc* gtkMisc, bool ownedRef = false)
78 	{
79 		this.gtkMisc = gtkMisc;
80 		super(cast(GtkWidget*)gtkMisc, ownedRef);
81 	}
82 
83 
84 	/** */
85 	public static GType getType()
86 	{
87 		return gtk_misc_get_type();
88 	}
89 
90 	/**
91 	 * Gets the X and Y alignment of the widget within its allocation.
92 	 * See gtk_misc_set_alignment().
93 	 *
94 	 * Deprecated: Use #GtkWidget alignment and margin properties.
95 	 *
96 	 * Params:
97 	 *     xalign = location to store X alignment of @misc, or %NULL
98 	 *     yalign = location to store Y alignment of @misc, or %NULL
99 	 */
100 	public void getAlignment(out float xalign, out float yalign)
101 	{
102 		gtk_misc_get_alignment(gtkMisc, &xalign, &yalign);
103 	}
104 
105 	/**
106 	 * Gets the padding in the X and Y directions of the widget.
107 	 * See gtk_misc_set_padding().
108 	 *
109 	 * Deprecated: Use #GtkWidget alignment and margin properties.
110 	 *
111 	 * Params:
112 	 *     xpad = location to store padding in the X
113 	 *         direction, or %NULL
114 	 *     ypad = location to store padding in the Y
115 	 *         direction, or %NULL
116 	 */
117 	public void getPadding(out int xpad, out int ypad)
118 	{
119 		gtk_misc_get_padding(gtkMisc, &xpad, &ypad);
120 	}
121 
122 	/**
123 	 * Sets the alignment of the widget.
124 	 *
125 	 * Deprecated: Use #GtkWidget's alignment (#GtkWidget:halign and #GtkWidget:valign) and margin properties or #GtkLabel's #GtkLabel:xalign and #GtkLabel:yalign properties.
126 	 *
127 	 * Params:
128 	 *     xalign = the horizontal alignment, from 0 (left) to 1 (right).
129 	 *     yalign = the vertical alignment, from 0 (top) to 1 (bottom).
130 	 */
131 	public void setAlignment(float xalign, float yalign)
132 	{
133 		gtk_misc_set_alignment(gtkMisc, xalign, yalign);
134 	}
135 
136 	/**
137 	 * Sets the amount of space to add around the widget.
138 	 *
139 	 * Deprecated: Use #GtkWidget alignment and margin properties.
140 	 *
141 	 * Params:
142 	 *     xpad = the amount of space to add on the left and right of the widget,
143 	 *         in pixels.
144 	 *     ypad = the amount of space to add on the top and bottom of the widget,
145 	 *         in pixels.
146 	 */
147 	public void setPadding(int xpad, int ypad)
148 	{
149 		gtk_misc_set_padding(gtkMisc, xpad, ypad);
150 	}
151 }