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