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.Box; 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 * The GtkStackSwitcher widget acts as a controller for a 39 * #GtkStack; it shows a row of buttons to switch between 40 * the various pages of the associated stack widget. 41 * 42 * All the content for the buttons comes from the child properties 43 * of the #GtkStack. 44 * 45 * It is possible to associate multiple #GtkStackSwitcher widgets 46 * with the same stack widget. 47 * 48 * The GtkStackSwitcher widget was added in 3.10. 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 public class StackSwitcher : Box 60 { 61 /** the main Gtk struct */ 62 protected GtkStackSwitcher* gtkStackSwitcher; 63 64 /** Get the main Gtk struct */ 65 public GtkStackSwitcher* getStackSwitcherStruct(bool transferOwnership = false) 66 { 67 if (transferOwnership) 68 ownedRef = false; 69 return gtkStackSwitcher; 70 } 71 72 /** the main Gtk struct as a void* */ 73 protected override void* getStruct() 74 { 75 return cast(void*)gtkStackSwitcher; 76 } 77 78 /** 79 * Sets our main struct and passes it to the parent class. 80 */ 81 public this (GtkStackSwitcher* gtkStackSwitcher, bool ownedRef = false) 82 { 83 this.gtkStackSwitcher = gtkStackSwitcher; 84 super(cast(GtkBox*)gtkStackSwitcher, ownedRef); 85 } 86 87 88 /** */ 89 public static GType getType() 90 { 91 return gtk_stack_switcher_get_type(); 92 } 93 94 /** 95 * Create a new #GtkStackSwitcher. 96 * 97 * Returns: a new #GtkStackSwitcher. 98 * 99 * Since: 3.10 100 * 101 * Throws: ConstructionException GTK+ fails to create the object. 102 */ 103 public this() 104 { 105 auto p = gtk_stack_switcher_new(); 106 107 if(p is null) 108 { 109 throw new ConstructionException("null returned by new"); 110 } 111 112 this(cast(GtkStackSwitcher*) p); 113 } 114 115 /** 116 * Retrieves the stack. 117 * See gtk_stack_switcher_set_stack(). 118 * 119 * Returns: the stack, or %NULL if 120 * none has been set explicitly. 121 * 122 * Since: 3.10 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 * Since: 3.10 143 */ 144 public void setStack(Stack stack) 145 { 146 gtk_stack_switcher_set_stack(gtkStackSwitcher, (stack is null) ? null : stack.getStackStruct()); 147 } 148 }