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