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  = GtkStack.html
27  * outPack = gtk
28  * outFile = Stack
29  * strct   = GtkStack
30  * realStrct=
31  * ctorStrct=
32  * clss    = Stack
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gtk_stack_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gtk.Widget
48  * structWrap:
49  * 	- GtkWidget* -> Widget
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54 
55 module gtk.Stack;
56 
57 public  import gtkc.gtktypes;
58 
59 private import gtkc.gtk;
60 private import glib.ConstructionException;
61 private import gobject.ObjectG;
62 
63 
64 private import glib.Str;
65 private import gtk.Widget;
66 
67 
68 
69 private import gtk.Container;
70 
71 /**
72  * The GtkStack widget is a container which only shows
73  * one of its children at a time. In contrast to GtkNotebook,
74  * GtkStack does not provide a means for users to change the
75  * visible child. Instead, the GtkStackSwitcher widget can be
76  * used with GtkStack to provide this functionality.
77  *
78  * Transitions between pages can be animated as slides or
79  * fades. This can be controlled with gtk_stack_set_transition_type().
80  * These animations respect the "gtk-enable-animations"
81  * setting.
82  *
83  * The GtkStack widget was added in GTK+ 3.10.
84  */
85 public class Stack : Container
86 {
87 	
88 	/** the main Gtk struct */
89 	protected GtkStack* gtkStack;
90 	
91 	
92 	public GtkStack* getStackStruct()
93 	{
94 		return gtkStack;
95 	}
96 	
97 	
98 	/** the main Gtk struct as a void* */
99 	protected override void* getStruct()
100 	{
101 		return cast(void*)gtkStack;
102 	}
103 	
104 	/**
105 	 * Sets our main struct and passes it to the parent class
106 	 */
107 	public this (GtkStack* gtkStack)
108 	{
109 		super(cast(GtkContainer*)gtkStack);
110 		this.gtkStack = gtkStack;
111 	}
112 	
113 	protected override void setStruct(GObject* obj)
114 	{
115 		super.setStruct(obj);
116 		gtkStack = cast(GtkStack*)obj;
117 	}
118 	
119 	/**
120 	 */
121 	
122 	/**
123 	 * Creates a new GtkStack container.
124 	 * Throws: ConstructionException GTK+ fails to create the object.
125 	 */
126 	public this ()
127 	{
128 		// GtkWidget * gtk_stack_new (void);
129 		auto p = gtk_stack_new();
130 		if(p is null)
131 		{
132 			throw new ConstructionException("null returned by gtk_stack_new()");
133 		}
134 		this(cast(GtkStack*) p);
135 	}
136 	
137 	/**
138 	 * Adds a child to stack.
139 	 * The child is identified by the name.
140 	 * Params:
141 	 * child = the widget to add
142 	 * name = the name for child
143 	 * Since 3.10
144 	 */
145 	public void addNamed(Widget child, string name)
146 	{
147 		// void gtk_stack_add_named (GtkStack *stack,  GtkWidget *child,  const gchar *name);
148 		gtk_stack_add_named(gtkStack, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(name));
149 	}
150 	
151 	/**
152 	 * Adds a child to stack.
153 	 * The child is identified by the name. The title
154 	 * will be used by GtkStackSwitcher to represent
155 	 * child in a tab bar, so it should be short.
156 	 * Params:
157 	 * child = the widget to add
158 	 * name = the name for child
159 	 * title = a human-readable title for child
160 	 * Since 3.10
161 	 */
162 	public void addTitled(Widget child, string name, string title)
163 	{
164 		// void gtk_stack_add_titled (GtkStack *stack,  GtkWidget *child,  const gchar *name,  const gchar *title);
165 		gtk_stack_add_titled(gtkStack, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(name), Str.toStringz(title));
166 	}
167 	
168 	/**
169 	 * Makes child the visible child of stack.
170 	 * If child is different from the currently
171 	 * visible child, the transition between the
172 	 * two will be animated with the current
173 	 * transition type of stack.
174 	 * Params:
175 	 * child = a child of stack
176 	 * Since 3.10
177 	 */
178 	public void setVisibleChild(Widget child)
179 	{
180 		// void gtk_stack_set_visible_child (GtkStack *stack,  GtkWidget *child);
181 		gtk_stack_set_visible_child(gtkStack, (child is null) ? null : child.getWidgetStruct());
182 	}
183 	
184 	/**
185 	 * Gets the currently visible child of stack, or NULL if
186 	 * there are no visible children.
187 	 * Returns: the visible child of the GtkStack. [transfer none] Since 3.10
188 	 */
189 	public Widget getVisibleChild()
190 	{
191 		// GtkWidget * gtk_stack_get_visible_child (GtkStack *stack);
192 		auto p = gtk_stack_get_visible_child(gtkStack);
193 		
194 		if(p is null)
195 		{
196 			return null;
197 		}
198 		
199 		return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p);
200 	}
201 	
202 	/**
203 	 * Makes the child with the given name visible.
204 	 * If child is different from the currently
205 	 * visible child, the transition between the
206 	 * two will be animated with the current
207 	 * transition type of stack.
208 	 * Params:
209 	 * name = the name of the child to make visible
210 	 * Since 3.10
211 	 */
212 	public void setVisibleChildName(string name)
213 	{
214 		// void gtk_stack_set_visible_child_name (GtkStack *stack,  const gchar *name);
215 		gtk_stack_set_visible_child_name(gtkStack, Str.toStringz(name));
216 	}
217 	
218 	/**
219 	 * Returns the name of the currently visible child of stack, or
220 	 * NULL if there is no visible child.
221 	 * Returns: the name of the visible child of the GtkStack. [transfer none] Since 3.10
222 	 */
223 	public string getVisibleChildName()
224 	{
225 		// const gchar * gtk_stack_get_visible_child_name (GtkStack *stack);
226 		return Str.toString(gtk_stack_get_visible_child_name(gtkStack));
227 	}
228 	
229 	/**
230 	 * Makes the child with the given name visible.
231 	 * Params:
232 	 * name = the name of the child to make visible
233 	 * transition = the transition type to use
234 	 * Since 3.10
235 	 */
236 	public void setVisibleChildFull(string name, GtkStackTransitionType transition)
237 	{
238 		// void gtk_stack_set_visible_child_full (GtkStack *stack,  const gchar *name,  GtkStackTransitionType transition);
239 		gtk_stack_set_visible_child_full(gtkStack, Str.toStringz(name), transition);
240 	}
241 	
242 	/**
243 	 * Sets the GtkStack to be homogeneous or not. If it
244 	 * is homogeneous, the GtkStack will request the same
245 	 * size for all its children. If it isn't, the stack
246 	 * may change size when a different child becomes visible.
247 	 * Params:
248 	 * homogeneous = TRUE to make stack homogeneous
249 	 * Since 3.10
250 	 */
251 	public void setHomogeneous(int homogeneous)
252 	{
253 		// void gtk_stack_set_homogeneous (GtkStack *stack,  gboolean homogeneous);
254 		gtk_stack_set_homogeneous(gtkStack, homogeneous);
255 	}
256 	
257 	/**
258 	 * Gets whether stack is homogeneous.
259 	 * See gtk_stack_set_homogeneous().
260 	 * Returns: whether stack is homogeneous. Since 3.10
261 	 */
262 	public int getHomogeneous()
263 	{
264 		// gboolean gtk_stack_get_homogeneous (GtkStack *stack);
265 		return gtk_stack_get_homogeneous(gtkStack);
266 	}
267 	
268 	/**
269 	 * Sets the duration that transitions between pages in stack
270 	 * will take.
271 	 * Params:
272 	 * duration = the new duration, in milliseconds
273 	 * Since 3.10
274 	 */
275 	public void setTransitionDuration(uint duration)
276 	{
277 		// void gtk_stack_set_transition_duration (GtkStack *stack,  guint duration);
278 		gtk_stack_set_transition_duration(gtkStack, duration);
279 	}
280 	
281 	/**
282 	 * Returns the amount of time (in milliseconds) that
283 	 * transitions between pages in stack will take.
284 	 * Returns: the transition duration Since 3.10
285 	 */
286 	public uint getTransitionDuration()
287 	{
288 		// guint gtk_stack_get_transition_duration (GtkStack *stack);
289 		return gtk_stack_get_transition_duration(gtkStack);
290 	}
291 	
292 	/**
293 	 * Sets the type of animation that will be used for
294 	 * transitions between pages in stack. Available
295 	 * types include various kinds of fades and slides.
296 	 * The transition type can be changed without problems
297 	 * at runtime, so it is possible to change the animation
298 	 * based on the page that is about to become current.
299 	 * Params:
300 	 * transition = the new transition type
301 	 * Since 3.10
302 	 */
303 	public void setTransitionType(GtkStackTransitionType transition)
304 	{
305 		// void gtk_stack_set_transition_type (GtkStack *stack,  GtkStackTransitionType transition);
306 		gtk_stack_set_transition_type(gtkStack, transition);
307 	}
308 	
309 	/**
310 	 * Gets the type of animation that will be used
311 	 * for transitions between pages in stack.
312 	 * Returns: the current transition type of stack Since 3.10
313 	 */
314 	public GtkStackTransitionType getTransitionType()
315 	{
316 		// GtkStackTransitionType gtk_stack_get_transition_type (GtkStack *stack);
317 		return gtk_stack_get_transition_type(gtkStack);
318 	}
319 }