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  * # CSS nodes
50  * 
51  * GtkStackSwitcher has a single CSS node named stackswitcher and
52  * style class .stack-switcher.
53  * 
54  * When circumstances require it, GtkStackSwitcher adds the
55  * .needs-attention style class to the widgets representing the
56  * stack pages.
57  */
58 public class StackSwitcher : Box
59 {
60 	/** the main Gtk struct */
61 	protected GtkStackSwitcher* gtkStackSwitcher;
62 
63 	/** Get the main Gtk struct */
64 	public GtkStackSwitcher* getStackSwitcherStruct()
65 	{
66 		return gtkStackSwitcher;
67 	}
68 
69 	/** the main Gtk struct as a void* */
70 	protected override void* getStruct()
71 	{
72 		return cast(void*)gtkStackSwitcher;
73 	}
74 
75 	protected override void setStruct(GObject* obj)
76 	{
77 		gtkStackSwitcher = cast(GtkStackSwitcher*)obj;
78 		super.setStruct(obj);
79 	}
80 
81 	/**
82 	 * Sets our main struct and passes it to the parent class.
83 	 */
84 	public this (GtkStackSwitcher* gtkStackSwitcher, bool ownedRef = false)
85 	{
86 		this.gtkStackSwitcher = gtkStackSwitcher;
87 		super(cast(GtkBox*)gtkStackSwitcher, ownedRef);
88 	}
89 
90 
91 	/** */
92 	public static GType getType()
93 	{
94 		return gtk_stack_switcher_get_type();
95 	}
96 
97 	/**
98 	 * Create a new #GtkStackSwitcher.
99 	 *
100 	 * Return: a new #GtkStackSwitcher.
101 	 *
102 	 * Since: 3.10
103 	 *
104 	 * Throws: ConstructionException GTK+ fails to create the object.
105 	 */
106 	public this()
107 	{
108 		auto p = gtk_stack_switcher_new();
109 		
110 		if(p is null)
111 		{
112 			throw new ConstructionException("null returned by new");
113 		}
114 		
115 		this(cast(GtkStackSwitcher*) p);
116 	}
117 
118 	/**
119 	 * Retrieves the stack.
120 	 * See gtk_stack_switcher_set_stack().
121 	 *
122 	 * Return: the stack, or %NULL if
123 	 *     none has been set explicitly.
124 	 *
125 	 * Since: 3.10
126 	 */
127 	public Stack getStack()
128 	{
129 		auto p = gtk_stack_switcher_get_stack(gtkStackSwitcher);
130 		
131 		if(p is null)
132 		{
133 			return null;
134 		}
135 		
136 		return ObjectG.getDObject!(Stack)(cast(GtkStack*) p);
137 	}
138 
139 	/**
140 	 * Sets the stack to control.
141 	 *
142 	 * Params:
143 	 *     stack = a #GtkStack
144 	 *
145 	 * Since: 3.10
146 	 */
147 	public void setStack(Stack stack)
148 	{
149 		gtk_stack_switcher_set_stack(gtkStackSwitcher, (stack is null) ? null : stack.getStackStruct());
150 	}
151 }