1 /*
2  * This file is part of d-handy.
3  *
4  * d-handy 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  * d-handy 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 d-handy; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 module handy.ViewSwitcherBar;
20 
21 private import glib.ConstructionException;
22 private import gobject.ObjectG;
23 private import gtk.Bin;
24 private import gtk.BuildableIF;
25 private import gtk.BuildableT;
26 private import gtk.Stack;
27 private import handy.c.functions;
28 public  import handy.c.types;
29 
30 
31 /** */
32 public class ViewSwitcherBar : Bin
33 {
34 	/** the main Gtk struct */
35 	protected HdyViewSwitcherBar* hdyViewSwitcherBar;
36 
37 	/** Get the main Gtk struct */
38 	public HdyViewSwitcherBar* getViewSwitcherBarStruct(bool transferOwnership = false)
39 	{
40 		if (transferOwnership)
41 			ownedRef = false;
42 		return hdyViewSwitcherBar;
43 	}
44 
45 	/** the main Gtk struct as a void* */
46 	protected override void* getStruct()
47 	{
48 		return cast(void*)hdyViewSwitcherBar;
49 	}
50 
51 	/**
52 	 * Sets our main struct and passes it to the parent class.
53 	 */
54 	public this (HdyViewSwitcherBar* hdyViewSwitcherBar, bool ownedRef = false)
55 	{
56 		this.hdyViewSwitcherBar = hdyViewSwitcherBar;
57 		super(cast(GtkBin*)hdyViewSwitcherBar, ownedRef);
58 	}
59 
60 
61 	/** */
62 	public static GType getType()
63 	{
64 		return hdy_view_switcher_bar_get_type();
65 	}
66 
67 	/**
68 	 * Creates a new #HdyViewSwitcherBar widget.
69 	 *
70 	 * Returns: a new #HdyViewSwitcherBar
71 	 *
72 	 * Since: 0.0.10
73 	 *
74 	 * Throws: ConstructionException GTK+ fails to create the object.
75 	 */
76 	public this()
77 	{
78 		auto p = hdy_view_switcher_bar_new();
79 
80 		if(p is null)
81 		{
82 			throw new ConstructionException("null returned by new");
83 		}
84 
85 		this(cast(HdyViewSwitcherBar*) p);
86 	}
87 
88 	/**
89 	 * Get the icon size of the images used in the #HdyViewSwitcher.
90 	 *
91 	 * Returns: the icon size of the images
92 	 *
93 	 * Since: 0.0.10
94 	 */
95 	public GtkIconSize getIconSize()
96 	{
97 		return hdy_view_switcher_bar_get_icon_size(hdyViewSwitcherBar);
98 	}
99 
100 	/**
101 	 * Gets the policy of @self.
102 	 *
103 	 * Returns: the policy of @self
104 	 *
105 	 * Since: 0.0.10
106 	 */
107 	public HdyViewSwitcherPolicy getPolicy()
108 	{
109 		return hdy_view_switcher_bar_get_policy(hdyViewSwitcherBar);
110 	}
111 
112 	/**
113 	 * Gets whether @self should be revealed or not.
114 	 *
115 	 * Returns: %TRUE if @self is revealed, %FALSE if not.
116 	 *
117 	 * Since: 0.0.10
118 	 */
119 	public bool getReveal()
120 	{
121 		return hdy_view_switcher_bar_get_reveal(hdyViewSwitcherBar) != 0;
122 	}
123 
124 	/**
125 	 * Get the #GtkStack being controlled by the #HdyViewSwitcher.
126 	 *
127 	 * Returns: the #GtkStack, or %NULL if none has been set
128 	 *
129 	 * Since: 0.0.10
130 	 */
131 	public Stack getStack()
132 	{
133 		auto p = hdy_view_switcher_bar_get_stack(hdyViewSwitcherBar);
134 
135 		if(p is null)
136 		{
137 			return null;
138 		}
139 
140 		return ObjectG.getDObject!(Stack)(cast(GtkStack*) p);
141 	}
142 
143 	/**
144 	 * Change the icon size hint for the icons in a #HdyViewSwitcher.
145 	 *
146 	 * Params:
147 	 *     iconSize = the new icon size
148 	 *
149 	 * Since: 0.0.10
150 	 */
151 	public void setIconSize(GtkIconSize iconSize)
152 	{
153 		hdy_view_switcher_bar_set_icon_size(hdyViewSwitcherBar, iconSize);
154 	}
155 
156 	/**
157 	 * Sets the policy of @self.
158 	 *
159 	 * Params:
160 	 *     policy = the new policy
161 	 *
162 	 * Since: 0.0.10
163 	 */
164 	public void setPolicy(HdyViewSwitcherPolicy policy)
165 	{
166 		hdy_view_switcher_bar_set_policy(hdyViewSwitcherBar, policy);
167 	}
168 
169 	/**
170 	 * Sets whether @self should be revealed or not.
171 	 *
172 	 * Params:
173 	 *     reveal = %TRUE to reveal @self
174 	 *
175 	 * Since: 0.0.10
176 	 */
177 	public void setReveal(bool reveal)
178 	{
179 		hdy_view_switcher_bar_set_reveal(hdyViewSwitcherBar, reveal);
180 	}
181 
182 	/**
183 	 * Sets the #GtkStack to control.
184 	 *
185 	 * Params:
186 	 *     stack = a #GtkStack
187 	 *
188 	 * Since: 0.0.10
189 	 */
190 	public void setStack(Stack stack)
191 	{
192 		hdy_view_switcher_bar_set_stack(hdyViewSwitcherBar, (stack is null) ? null : stack.getStackStruct());
193 	}
194 }