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.StackSidebar; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtk.Bin; 30 private import gtk.Stack; 31 private import gtk.Widget; 32 private import gtkc.gtk; 33 public import gtkc.gtktypes; 34 35 36 /** 37 * A GtkStackSidebar enables you to quickly and easily provide a 38 * consistent "sidebar" object for your user interface. 39 * 40 * In order to use a GtkStackSidebar, you simply use a GtkStack to 41 * organize your UI flow, and add the sidebar to your sidebar area. You 42 * can use gtk_stack_sidebar_set_stack() to connect the #GtkStackSidebar 43 * to the #GtkStack. 44 * 45 * # CSS nodes 46 * 47 * GtkStackSidebar has a single CSS node with name stacksidebar and 48 * style class .sidebar. 49 * 50 * When circumstances require it, GtkStackSidebar adds the 51 * .needs-attention style class to the widgets representing the stack 52 * pages. 53 */ 54 public class StackSidebar : Bin 55 { 56 /** the main Gtk struct */ 57 protected GtkStackSidebar* gtkStackSidebar; 58 59 /** Get the main Gtk struct */ 60 public GtkStackSidebar* getStackSidebarStruct(bool transferOwnership = false) 61 { 62 if (transferOwnership) 63 ownedRef = false; 64 return gtkStackSidebar; 65 } 66 67 /** the main Gtk struct as a void* */ 68 protected override void* getStruct() 69 { 70 return cast(void*)gtkStackSidebar; 71 } 72 73 protected override void setStruct(GObject* obj) 74 { 75 gtkStackSidebar = cast(GtkStackSidebar*)obj; 76 super.setStruct(obj); 77 } 78 79 /** 80 * Sets our main struct and passes it to the parent class. 81 */ 82 public this (GtkStackSidebar* gtkStackSidebar, bool ownedRef = false) 83 { 84 this.gtkStackSidebar = gtkStackSidebar; 85 super(cast(GtkBin*)gtkStackSidebar, ownedRef); 86 } 87 88 89 /** */ 90 public static GType getType() 91 { 92 return gtk_stack_sidebar_get_type(); 93 } 94 95 /** 96 * Creates a new sidebar. 97 * 98 * Returns: the new #GtkStackSidebar 99 * 100 * Since: 3.16 101 * 102 * Throws: ConstructionException GTK+ fails to create the object. 103 */ 104 public this() 105 { 106 auto p = gtk_stack_sidebar_new(); 107 108 if(p is null) 109 { 110 throw new ConstructionException("null returned by new"); 111 } 112 113 this(cast(GtkStackSidebar*) p); 114 } 115 116 /** 117 * Retrieves the stack. 118 * See gtk_stack_sidebar_set_stack(). 119 * 120 * Returns: the associated #GtkStack or 121 * %NULL if none has been set explicitly 122 * 123 * Since: 3.16 124 */ 125 public Stack getStack() 126 { 127 auto p = gtk_stack_sidebar_get_stack(gtkStackSidebar); 128 129 if(p is null) 130 { 131 return null; 132 } 133 134 return ObjectG.getDObject!(Stack)(cast(GtkStack*) p); 135 } 136 137 /** 138 * Set the #GtkStack associated with this #GtkStackSidebar. 139 * 140 * The sidebar widget will automatically update according to the order 141 * (packing) and items within the given #GtkStack. 142 * 143 * Params: 144 * stack = a #GtkStack 145 * 146 * Since: 3.16 147 */ 148 public void setStack(Stack stack) 149 { 150 gtk_stack_sidebar_set_stack(gtkStackSidebar, (stack is null) ? null : stack.getStackStruct()); 151 } 152 }