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.Stack; 30 private import gtk.Widget; 31 private import gtk.c.functions; 32 public import gtk.c.types; 33 34 35 /** 36 * The `GtkStackSwitcher` shows a row of buttons to switch between `GtkStack` 37 * pages. 38 * 39 * ![An example GtkStackSwitcher](stackswitcher.png) 40 * 41 * It acts as a controller for the associated `GtkStack`. 42 * 43 * All the content for the buttons comes from the properties of the stacks 44 * [class@Gtk.StackPage] objects; the button visibility in a `GtkStackSwitcher` 45 * widget is controlled by the visibility of the child in the `GtkStack`. 46 * 47 * It is possible to associate multiple `GtkStackSwitcher` widgets 48 * with the same `GtkStack` widget. 49 * 50 * # CSS nodes 51 * 52 * `GtkStackSwitcher` has a single CSS node named stackswitcher and 53 * style class .stack-switcher. 54 * 55 * When circumstances require it, `GtkStackSwitcher` adds the 56 * .needs-attention style class to the widgets representing the 57 * stack pages. 58 * 59 * # Accessibility 60 * 61 * `GtkStackSwitcher` uses the %GTK_ACCESSIBLE_ROLE_TAB_LIST role 62 * and uses the %GTK_ACCESSIBLE_ROLE_TAB for its buttons. 63 */ 64 public class StackSwitcher : Widget 65 { 66 /** the main Gtk struct */ 67 protected GtkStackSwitcher* gtkStackSwitcher; 68 69 /** Get the main Gtk struct */ 70 public GtkStackSwitcher* getStackSwitcherStruct(bool transferOwnership = false) 71 { 72 if (transferOwnership) 73 ownedRef = false; 74 return gtkStackSwitcher; 75 } 76 77 /** the main Gtk struct as a void* */ 78 protected override void* getStruct() 79 { 80 return cast(void*)gtkStackSwitcher; 81 } 82 83 /** 84 * Sets our main struct and passes it to the parent class. 85 */ 86 public this (GtkStackSwitcher* gtkStackSwitcher, bool ownedRef = false) 87 { 88 this.gtkStackSwitcher = gtkStackSwitcher; 89 super(cast(GtkWidget*)gtkStackSwitcher, ownedRef); 90 } 91 92 93 /** */ 94 public static GType getType() 95 { 96 return gtk_stack_switcher_get_type(); 97 } 98 99 /** 100 * Create a new `GtkStackSwitcher`. 101 * 102 * Returns: a new `GtkStackSwitcher`. 103 * 104 * Throws: ConstructionException GTK+ fails to create the object. 105 */ 106 public this() 107 { 108 auto __p = gtk_stack_switcher_new(); 109 110 if(__p is null) 111 { 112 throw new ConstructionException("null returned by new"); 113 } 114 115 this(cast(GtkStackSwitcher*) __p); 116 } 117 118 /** 119 * Retrieves the stack. 120 * 121 * Returns: the stack, or %NULL if 122 * none has been set explicitly. 123 */ 124 public Stack getStack() 125 { 126 auto __p = gtk_stack_switcher_get_stack(gtkStackSwitcher); 127 128 if(__p is null) 129 { 130 return null; 131 } 132 133 return ObjectG.getDObject!(Stack)(cast(GtkStack*) __p); 134 } 135 136 /** 137 * Sets the stack to control. 138 * 139 * Params: 140 * stack = a `GtkStack` 141 */ 142 public void setStack(Stack stack) 143 { 144 gtk_stack_switcher_set_stack(gtkStackSwitcher, (stack is null) ? null : stack.getStackStruct()); 145 } 146 }