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  = GtkFrame.html
27  * outPack = gtk
28  * outFile = Frame
29  * strct   = GtkFrame
30  * realStrct=
31  * ctorStrct=
32  * clss    = Frame
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_frame_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- gtk.Widget
49  * structWrap:
50  * 	- GtkWidget* -> Widget
51  * module aliases:
52  * local aliases:
53  * overrides:
54  */
55 
56 module gtk.Frame;
57 
58 public  import gtkc.gtktypes;
59 
60 private import gtkc.gtk;
61 private import glib.ConstructionException;
62 private import gobject.ObjectG;
63 
64 
65 private import glib.Str;
66 private import gtk.Widget;
67 
68 
69 
70 private import gtk.Bin;
71 
72 /**
73  * Description
74  * The frame widget is a Bin that surrounds its child
75  * with a decorative frame and an optional label.
76  * If present, the label is drawn in a gap in the
77  * top side of the frame. The position of the
78  * label can be controlled with gtk_frame_set_label_align().
79  * GtkFrame as GtkBuildable
80  * The GtkFrame implementation of the GtkBuildable interface
81  * supports placing a child in the label position by specifying
82  * "label" as the "type" attribute of a <child> element.
83  * A normal content child can be specified without specifying
84  * a <child> type attribute.
85  * $(DDOC_COMMENT example)
86  */
87 public class Frame : Bin
88 {
89 	
90 	/** the main Gtk struct */
91 	protected GtkFrame* gtkFrame;
92 	
93 	
94 	public GtkFrame* getFrameStruct()
95 	{
96 		return gtkFrame;
97 	}
98 	
99 	
100 	/** the main Gtk struct as a void* */
101 	protected override void* getStruct()
102 	{
103 		return cast(void*)gtkFrame;
104 	}
105 	
106 	/**
107 	 * Sets our main struct and passes it to the parent class
108 	 */
109 	public this (GtkFrame* gtkFrame)
110 	{
111 		super(cast(GtkBin*)gtkFrame);
112 		this.gtkFrame = gtkFrame;
113 	}
114 	
115 	protected override void setStruct(GObject* obj)
116 	{
117 		super.setStruct(obj);
118 		gtkFrame = cast(GtkFrame*)obj;
119 	}
120 	
121 	/**
122 	 * Creates frame with label and set it's child widget
123 	 */
124 	public this(Widget widget, string label)
125 	{
126 		this(label);
127 		add(widget);
128 	}
129 	
130 	/**
131 	 */
132 	
133 	/**
134 	 * Creates a new GtkFrame, with optional label label.
135 	 * If label is NULL, the label is omitted.
136 	 * Params:
137 	 * label = the text to use as the label of the frame
138 	 * Throws: ConstructionException GTK+ fails to create the object.
139 	 */
140 	public this (string label)
141 	{
142 		// GtkWidget * gtk_frame_new (const gchar *label);
143 		auto p = gtk_frame_new(Str.toStringz(label));
144 		if(p is null)
145 		{
146 			throw new ConstructionException("null returned by gtk_frame_new(Str.toStringz(label))");
147 		}
148 		this(cast(GtkFrame*) p);
149 	}
150 	
151 	/**
152 	 * Sets the text of the label. If label is NULL,
153 	 * the current label is removed.
154 	 * Params:
155 	 * label = the text to use as the label of the frame. [allow-none]
156 	 */
157 	public void setLabel(string label)
158 	{
159 		// void gtk_frame_set_label (GtkFrame *frame,  const gchar *label);
160 		gtk_frame_set_label(gtkFrame, Str.toStringz(label));
161 	}
162 	
163 	/**
164 	 * Sets the label widget for the frame. This is the widget that
165 	 * will appear embedded in the top edge of the frame as a
166 	 * title.
167 	 * Params:
168 	 * labelWidget = the new label widget
169 	 */
170 	public void setLabelWidget(Widget labelWidget)
171 	{
172 		// void gtk_frame_set_label_widget (GtkFrame *frame,  GtkWidget *label_widget);
173 		gtk_frame_set_label_widget(gtkFrame, (labelWidget is null) ? null : labelWidget.getWidgetStruct());
174 	}
175 	
176 	/**
177 	 * Sets the alignment of the frame widget's label. The
178 	 * default values for a newly created frame are 0.0 and 0.5.
179 	 * Params:
180 	 * xalign = The position of the label along the top edge
181 	 * of the widget. A value of 0.0 represents left alignment;
182 	 * 1.0 represents right alignment.
183 	 * yalign = The y alignment of the label. A value of 0.0 aligns under
184 	 * the frame; 1.0 aligns above the frame. If the values are exactly
185 	 * 0.0 or 1.0 the gap in the frame won't be painted because the label
186 	 * will be completely above or below the frame.
187 	 */
188 	public void setLabelAlign(float xalign, float yalign)
189 	{
190 		// void gtk_frame_set_label_align (GtkFrame *frame,  gfloat xalign,  gfloat yalign);
191 		gtk_frame_set_label_align(gtkFrame, xalign, yalign);
192 	}
193 	
194 	/**
195 	 * Sets the shadow type for frame.
196 	 * Params:
197 	 * type = the new GtkShadowType
198 	 */
199 	public void setShadowType(GtkShadowType type)
200 	{
201 		// void gtk_frame_set_shadow_type (GtkFrame *frame,  GtkShadowType type);
202 		gtk_frame_set_shadow_type(gtkFrame, type);
203 	}
204 	
205 	/**
206 	 * If the frame's label widget is a GtkLabel, returns the
207 	 * text in the label widget. (The frame will have a GtkLabel
208 	 * for the label widget if a non-NULL argument was passed
209 	 * to gtk_frame_new().)
210 	 * Returns: the text in the label, or NULL if there was no label widget or the lable widget was not a GtkLabel. This string is owned by GTK+ and must not be modified or freed.
211 	 */
212 	public string getLabel()
213 	{
214 		// const gchar * gtk_frame_get_label (GtkFrame *frame);
215 		return Str.toString(gtk_frame_get_label(gtkFrame));
216 	}
217 	
218 	/**
219 	 * Retrieves the X and Y alignment of the frame's label. See
220 	 * gtk_frame_set_label_align().
221 	 * Params:
222 	 * xalign = location to store X alignment of
223 	 * frame's label, or NULL. [out][allow-none]
224 	 * yalign = location to store X alignment of
225 	 * frame's label, or NULL. [out][allow-none]
226 	 */
227 	public void getLabelAlign(out float xalign, out float yalign)
228 	{
229 		// void gtk_frame_get_label_align (GtkFrame *frame,  gfloat *xalign,  gfloat *yalign);
230 		gtk_frame_get_label_align(gtkFrame, &xalign, &yalign);
231 	}
232 	
233 	/**
234 	 * Retrieves the label widget for the frame. See
235 	 * gtk_frame_set_label_widget().
236 	 * Returns: the label widget, or NULL if there is none. [transfer none]
237 	 */
238 	public Widget getLabelWidget()
239 	{
240 		// GtkWidget * gtk_frame_get_label_widget (GtkFrame *frame);
241 		auto p = gtk_frame_get_label_widget(gtkFrame);
242 		
243 		if(p is null)
244 		{
245 			return null;
246 		}
247 		
248 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
249 	}
250 	
251 	/**
252 	 * Retrieves the shadow type of the frame. See
253 	 * gtk_frame_set_shadow_type().
254 	 * Returns: the current shadow type of the frame.
255 	 */
256 	public GtkShadowType getShadowType()
257 	{
258 		// GtkShadowType gtk_frame_get_shadow_type (GtkFrame *frame);
259 		return gtk_frame_get_shadow_type(gtkFrame);
260 	}
261 }