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.StackSidebar;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.Stack;
30 private import gtk.Widget;
31 private import gtk.c.functions;
32 public  import gtk.c.types;
33 
34 
35 /**
36  * A `GtkStackSidebar` uses a sidebar to switch between `GtkStack` pages.
37  * 
38  * In order to use a `GtkStackSidebar`, you simply use a `GtkStack` to
39  * organize your UI flow, and add the sidebar to your sidebar area. You
40  * can use [method@Gtk.StackSidebar.set_stack] to connect the `GtkStackSidebar`
41  * to the `GtkStack`.
42  * 
43  * # CSS nodes
44  * 
45  * `GtkStackSidebar` has a single CSS node with name stacksidebar and
46  * style class .sidebar.
47  * 
48  * When circumstances require it, `GtkStackSidebar` adds the
49  * .needs-attention style class to the widgets representing the stack
50  * pages.
51  */
52 public class StackSidebar : Widget
53 {
54 	/** the main Gtk struct */
55 	protected GtkStackSidebar* gtkStackSidebar;
56 
57 	/** Get the main Gtk struct */
58 	public GtkStackSidebar* getStackSidebarStruct(bool transferOwnership = false)
59 	{
60 		if (transferOwnership)
61 			ownedRef = false;
62 		return gtkStackSidebar;
63 	}
64 
65 	/** the main Gtk struct as a void* */
66 	protected override void* getStruct()
67 	{
68 		return cast(void*)gtkStackSidebar;
69 	}
70 
71 	/**
72 	 * Sets our main struct and passes it to the parent class.
73 	 */
74 	public this (GtkStackSidebar* gtkStackSidebar, bool ownedRef = false)
75 	{
76 		this.gtkStackSidebar = gtkStackSidebar;
77 		super(cast(GtkWidget*)gtkStackSidebar, ownedRef);
78 	}
79 
80 
81 	/** */
82 	public static GType getType()
83 	{
84 		return gtk_stack_sidebar_get_type();
85 	}
86 
87 	/**
88 	 * Creates a new `GtkStackSidebar`.
89 	 *
90 	 * Returns: the new `GtkStackSidebar`
91 	 *
92 	 * Throws: ConstructionException GTK+ fails to create the object.
93 	 */
94 	public this()
95 	{
96 		auto __p = gtk_stack_sidebar_new();
97 
98 		if(__p is null)
99 		{
100 			throw new ConstructionException("null returned by new");
101 		}
102 
103 		this(cast(GtkStackSidebar*) __p);
104 	}
105 
106 	/**
107 	 * Retrieves the stack.
108 	 *
109 	 * Returns: the associated #GtkStack or
110 	 *     %NULL if none has been set explicitly
111 	 */
112 	public Stack getStack()
113 	{
114 		auto __p = gtk_stack_sidebar_get_stack(gtkStackSidebar);
115 
116 		if(__p is null)
117 		{
118 			return null;
119 		}
120 
121 		return ObjectG.getDObject!(Stack)(cast(GtkStack*) __p);
122 	}
123 
124 	/**
125 	 * Set the `GtkStack` associated with this `GtkStackSidebar`.
126 	 *
127 	 * The sidebar widget will automatically update according to
128 	 * the order and items within the given `GtkStack`.
129 	 *
130 	 * Params:
131 	 *     stack = a `GtkStack`
132 	 */
133 	public void setStack(Stack stack)
134 	{
135 		gtk_stack_sidebar_set_stack(gtkStackSidebar, (stack is null) ? null : stack.getStackStruct());
136 	}
137 }