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 gtkc.gtk; 33 public import gtkc.gtktypes; 34 35 36 /** 37 * The GtkStackSwitcher widget acts as a controller for a 38 * #GtkStack; it shows a row of buttons to switch between 39 * the various pages of the associated stack widget. 40 * 41 * All the content for the buttons comes from the child properties 42 * of the #GtkStack. 43 * 44 * It is possible to associate multiple #GtkStackSwitcher widgets 45 * with the same stack widget. 46 * 47 * The GtkStackSwitcher widget was added in 3.10. 48 */ 49 public class StackSwitcher : Box 50 { 51 /** the main Gtk struct */ 52 protected GtkStackSwitcher* gtkStackSwitcher; 53 54 /** Get the main Gtk struct */ 55 public GtkStackSwitcher* getStackSwitcherStruct() 56 { 57 return gtkStackSwitcher; 58 } 59 60 /** the main Gtk struct as a void* */ 61 protected override void* getStruct() 62 { 63 return cast(void*)gtkStackSwitcher; 64 } 65 66 protected override void setStruct(GObject* obj) 67 { 68 gtkStackSwitcher = cast(GtkStackSwitcher*)obj; 69 super.setStruct(obj); 70 } 71 72 /** 73 * Sets our main struct and passes it to the parent class. 74 */ 75 public this (GtkStackSwitcher* gtkStackSwitcher, bool ownedRef = false) 76 { 77 this.gtkStackSwitcher = gtkStackSwitcher; 78 super(cast(GtkBox*)gtkStackSwitcher, ownedRef); 79 } 80 81 /** 82 */ 83 84 public static GType getType() 85 { 86 return gtk_stack_switcher_get_type(); 87 } 88 89 /** 90 * Create a new #GtkStackSwitcher. 91 * 92 * Return: a new #GtkStackSwitcher. 93 * 94 * Since: 3.10 95 * 96 * Throws: ConstructionException GTK+ fails to create the object. 97 */ 98 public this() 99 { 100 auto p = gtk_stack_switcher_new(); 101 102 if(p is null) 103 { 104 throw new ConstructionException("null returned by new"); 105 } 106 107 this(cast(GtkStackSwitcher*) p); 108 } 109 110 /** 111 * Retrieves the stack. 112 * See gtk_stack_switcher_set_stack(). 113 * 114 * Return: the stack, or %NULL if 115 * none has been set explicitly. 116 * 117 * Since: 3.10 118 */ 119 public Stack getStack() 120 { 121 auto p = gtk_stack_switcher_get_stack(gtkStackSwitcher); 122 123 if(p is null) 124 { 125 return null; 126 } 127 128 return ObjectG.getDObject!(Stack)(cast(GtkStack*) p); 129 } 130 131 /** 132 * Sets the stack to control. 133 * 134 * Params: 135 * stack = a #GtkStack 136 * 137 * Since: 3.10 138 */ 139 public void setStack(Stack stack) 140 { 141 gtk_stack_switcher_set_stack(gtkStackSwitcher, (stack is null) ? null : stack.getStackStruct()); 142 } 143 }