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.StackSwitcher;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.Box;
30 private import gtk.Stack;
31 private import gtk.Widget;
32 private import gtkc.gtk;
33 public  import gtkc.gtktypes;
34 
35 
36 /**
37  * The GtkStackSwitcher widget acts as a controller for a
38  * #GtkStack; it shows a row of buttons to switch between
39  * the various pages of the associated stack widget.
40  * 
41  * All the content for the buttons comes from the child properties
42  * of the #GtkStack.
43  * 
44  * It is possible to associate multiple #GtkStackSwitcher widgets
45  * with the same stack widget.
46  * 
47  * The GtkStackSwitcher widget was added in 3.10.
48  */
49 public class StackSwitcher : Box
50 {
51 	/** the main Gtk struct */
52 	protected GtkStackSwitcher* gtkStackSwitcher;
53 
54 	/** Get the main Gtk struct */
55 	public GtkStackSwitcher* getStackSwitcherStruct()
56 	{
57 		return gtkStackSwitcher;
58 	}
59 
60 	/** the main Gtk struct as a void* */
61 	protected override void* getStruct()
62 	{
63 		return cast(void*)gtkStackSwitcher;
64 	}
65 
66 	protected override void setStruct(GObject* obj)
67 	{
68 		gtkStackSwitcher = cast(GtkStackSwitcher*)obj;
69 		super.setStruct(obj);
70 	}
71 
72 	/**
73 	 * Sets our main struct and passes it to the parent class.
74 	 */
75 	public this (GtkStackSwitcher* gtkStackSwitcher, bool ownedRef = false)
76 	{
77 		this.gtkStackSwitcher = gtkStackSwitcher;
78 		super(cast(GtkBox*)gtkStackSwitcher, ownedRef);
79 	}
80 
81 
82 	/** */
83 	public static GType getType()
84 	{
85 		return gtk_stack_switcher_get_type();
86 	}
87 
88 	/**
89 	 * Create a new #GtkStackSwitcher.
90 	 *
91 	 * Return: a new #GtkStackSwitcher.
92 	 *
93 	 * Since: 3.10
94 	 *
95 	 * Throws: ConstructionException GTK+ fails to create the object.
96 	 */
97 	public this()
98 	{
99 		auto p = gtk_stack_switcher_new();
100 		
101 		if(p is null)
102 		{
103 			throw new ConstructionException("null returned by new");
104 		}
105 		
106 		this(cast(GtkStackSwitcher*) p);
107 	}
108 
109 	/**
110 	 * Retrieves the stack.
111 	 * See gtk_stack_switcher_set_stack().
112 	 *
113 	 * Return: the stack, or %NULL if
114 	 *     none has been set explicitly.
115 	 *
116 	 * Since: 3.10
117 	 */
118 	public Stack getStack()
119 	{
120 		auto p = gtk_stack_switcher_get_stack(gtkStackSwitcher);
121 		
122 		if(p is null)
123 		{
124 			return null;
125 		}
126 		
127 		return ObjectG.getDObject!(Stack)(cast(GtkStack*) p);
128 	}
129 
130 	/**
131 	 * Sets the stack to control.
132 	 *
133 	 * Params:
134 	 *     stack = a #GtkStack
135 	 *
136 	 * Since: 3.10
137 	 */
138 	public void setStack(Stack stack)
139 	{
140 		gtk_stack_switcher_set_stack(gtkStackSwitcher, (stack is null) ? null : stack.getStackStruct());
141 	}
142 }