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