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.Bin;
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  * A GtkStackSidebar enables you to quickly and easily provide a
39  * consistent "sidebar" object for your user interface.
40  * 
41  * In order to use a GtkStackSidebar, you simply use a GtkStack to
42  * organize your UI flow, and add the sidebar to your sidebar area. You
43  * can use gtk_stack_sidebar_set_stack() to connect the #GtkStackSidebar
44  * to the #GtkStack.
45  * 
46  * # CSS nodes
47  * 
48  * GtkStackSidebar has a single CSS node with name stacksidebar and
49  * style class .sidebar.
50  * 
51  * When circumstances require it, GtkStackSidebar adds the
52  * .needs-attention style class to the widgets representing the stack
53  * pages.
54  */
55 public class StackSidebar : Bin
56 {
57 	/** the main Gtk struct */
58 	protected GtkStackSidebar* gtkStackSidebar;
59 
60 	/** Get the main Gtk struct */
61 	public GtkStackSidebar* getStackSidebarStruct(bool transferOwnership = false)
62 	{
63 		if (transferOwnership)
64 			ownedRef = false;
65 		return gtkStackSidebar;
66 	}
67 
68 	/** the main Gtk struct as a void* */
69 	protected override void* getStruct()
70 	{
71 		return cast(void*)gtkStackSidebar;
72 	}
73 
74 	protected override void setStruct(GObject* obj)
75 	{
76 		gtkStackSidebar = cast(GtkStackSidebar*)obj;
77 		super.setStruct(obj);
78 	}
79 
80 	/**
81 	 * Sets our main struct and passes it to the parent class.
82 	 */
83 	public this (GtkStackSidebar* gtkStackSidebar, bool ownedRef = false)
84 	{
85 		this.gtkStackSidebar = gtkStackSidebar;
86 		super(cast(GtkBin*)gtkStackSidebar, ownedRef);
87 	}
88 
89 
90 	/** */
91 	public static GType getType()
92 	{
93 		return gtk_stack_sidebar_get_type();
94 	}
95 
96 	/**
97 	 * Creates a new sidebar.
98 	 *
99 	 * Returns: the new #GtkStackSidebar
100 	 *
101 	 * Since: 3.16
102 	 *
103 	 * Throws: ConstructionException GTK+ fails to create the object.
104 	 */
105 	public this()
106 	{
107 		auto p = gtk_stack_sidebar_new();
108 
109 		if(p is null)
110 		{
111 			throw new ConstructionException("null returned by new");
112 		}
113 
114 		this(cast(GtkStackSidebar*) p);
115 	}
116 
117 	/**
118 	 * Retrieves the stack.
119 	 * See gtk_stack_sidebar_set_stack().
120 	 *
121 	 * Returns: the associated #GtkStack or
122 	 *     %NULL if none has been set explicitly
123 	 *
124 	 * Since: 3.16
125 	 */
126 	public Stack getStack()
127 	{
128 		auto p = gtk_stack_sidebar_get_stack(gtkStackSidebar);
129 
130 		if(p is null)
131 		{
132 			return null;
133 		}
134 
135 		return ObjectG.getDObject!(Stack)(cast(GtkStack*) p);
136 	}
137 
138 	/**
139 	 * Set the #GtkStack associated with this #GtkStackSidebar.
140 	 *
141 	 * The sidebar widget will automatically update according to the order
142 	 * (packing) and items within the given #GtkStack.
143 	 *
144 	 * Params:
145 	 *     stack = a #GtkStack
146 	 *
147 	 * Since: 3.16
148 	 */
149 	public void setStack(Stack stack)
150 	{
151 		gtk_stack_sidebar_set_stack(gtkStackSidebar, (stack is null) ? null : stack.getStackStruct());
152 	}
153 }