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 gtk.Widget; 28 private import handy.c.functions; 29 public import handy.c.types; 30 31 32 /** */ 33 public class ViewSwitcherBar : Bin 34 { 35 /** the main Gtk struct */ 36 protected HdyViewSwitcherBar* hdyViewSwitcherBar; 37 38 /** Get the main Gtk struct */ 39 public HdyViewSwitcherBar* getViewSwitcherBarStruct(bool transferOwnership = false) 40 { 41 if (transferOwnership) 42 ownedRef = false; 43 return hdyViewSwitcherBar; 44 } 45 46 /** the main Gtk struct as a void* */ 47 protected override void* getStruct() 48 { 49 return cast(void*)hdyViewSwitcherBar; 50 } 51 52 /** 53 * Sets our main struct and passes it to the parent class. 54 */ 55 public this (HdyViewSwitcherBar* hdyViewSwitcherBar, bool ownedRef = false) 56 { 57 this.hdyViewSwitcherBar = hdyViewSwitcherBar; 58 super(cast(GtkBin*)hdyViewSwitcherBar, ownedRef); 59 } 60 61 62 /** */ 63 public static GType getType() 64 { 65 return hdy_view_switcher_bar_get_type(); 66 } 67 68 /** 69 * Creates a new #HdyViewSwitcherBar widget. 70 * 71 * Returns: a new #HdyViewSwitcherBar 72 * 73 * Since: 0.0.10 74 * 75 * Throws: ConstructionException GTK+ fails to create the object. 76 */ 77 public this() 78 { 79 auto __p = hdy_view_switcher_bar_new(); 80 81 if(__p is null) 82 { 83 throw new ConstructionException("null returned by new"); 84 } 85 86 this(cast(HdyViewSwitcherBar*) __p); 87 } 88 89 /** 90 * Gets the policy of @self. 91 * 92 * Returns: the policy of @self 93 * 94 * Since: 0.0.10 95 */ 96 public HdyViewSwitcherPolicy getPolicy() 97 { 98 return hdy_view_switcher_bar_get_policy(hdyViewSwitcherBar); 99 } 100 101 /** 102 * Gets whether @self should be revealed or not. 103 * 104 * Returns: %TRUE if @self is revealed, %FALSE if not. 105 * 106 * Since: 0.0.10 107 */ 108 public bool getReveal() 109 { 110 return hdy_view_switcher_bar_get_reveal(hdyViewSwitcherBar) != 0; 111 } 112 113 /** 114 * Get the #GtkStack being controlled by the #HdyViewSwitcher. 115 * 116 * Returns: the #GtkStack, or %NULL if none has been set 117 * 118 * Since: 0.0.10 119 */ 120 public Stack getStack() 121 { 122 auto __p = hdy_view_switcher_bar_get_stack(hdyViewSwitcherBar); 123 124 if(__p is null) 125 { 126 return null; 127 } 128 129 return ObjectG.getDObject!(Stack)(cast(GtkStack*) __p); 130 } 131 132 /** 133 * Sets the policy of @self. 134 * 135 * Params: 136 * policy = the new policy 137 * 138 * Since: 0.0.10 139 */ 140 public void setPolicy(HdyViewSwitcherPolicy policy) 141 { 142 hdy_view_switcher_bar_set_policy(hdyViewSwitcherBar, policy); 143 } 144 145 /** 146 * Sets whether @self should be revealed or not. 147 * 148 * Params: 149 * reveal = %TRUE to reveal @self 150 * 151 * Since: 0.0.10 152 */ 153 public void setReveal(bool reveal) 154 { 155 hdy_view_switcher_bar_set_reveal(hdyViewSwitcherBar, reveal); 156 } 157 158 /** 159 * Sets the #GtkStack to control. 160 * 161 * Params: 162 * stack = a #GtkStack 163 * 164 * Since: 0.0.10 165 */ 166 public void setStack(Stack stack) 167 { 168 hdy_view_switcher_bar_set_stack(hdyViewSwitcherBar, (stack is null) ? null : stack.getStackStruct()); 169 } 170 }