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 * Conversion parameters: 26 * inFile = GtkStack.html 27 * outPack = gtk 28 * outFile = Stack 29 * strct = GtkStack 30 * realStrct= 31 * ctorStrct= 32 * clss = Stack 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_stack_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - glib.Str 47 * - gtk.Widget 48 * structWrap: 49 * - GtkWidget* -> Widget 50 * module aliases: 51 * local aliases: 52 * overrides: 53 */ 54 55 module gtk.Stack; 56 57 public import gtkc.gtktypes; 58 59 private import gtkc.gtk; 60 private import glib.ConstructionException; 61 private import gobject.ObjectG; 62 63 private import glib.Str; 64 private import gtk.Widget; 65 66 67 private import gtk.Container; 68 69 /** 70 * The GtkStack widget is a container which only shows 71 * one of its children at a time. In contrast to GtkNotebook, 72 * GtkStack does not provide a means for users to change the 73 * visible child. Instead, the GtkStackSwitcher widget can be 74 * used with GtkStack to provide this functionality. 75 * 76 * Transitions between pages can be animated as slides or 77 * fades. This can be controlled with gtk_stack_set_transition_type(). 78 * These animations respect the "gtk-enable-animations" 79 * setting. 80 * 81 * The GtkStack widget was added in GTK+ 3.10. 82 */ 83 public class Stack : Container 84 { 85 86 /** the main Gtk struct */ 87 protected GtkStack* gtkStack; 88 89 90 /** Get the main Gtk struct */ 91 public GtkStack* getStackStruct() 92 { 93 return gtkStack; 94 } 95 96 97 /** the main Gtk struct as a void* */ 98 protected override void* getStruct() 99 { 100 return cast(void*)gtkStack; 101 } 102 103 /** 104 * Sets our main struct and passes it to the parent class 105 */ 106 public this (GtkStack* gtkStack) 107 { 108 super(cast(GtkContainer*)gtkStack); 109 this.gtkStack = gtkStack; 110 } 111 112 protected override void setStruct(GObject* obj) 113 { 114 super.setStruct(obj); 115 gtkStack = cast(GtkStack*)obj; 116 } 117 118 /** 119 */ 120 121 /** 122 * Creates a new GtkStack container. 123 * Throws: ConstructionException GTK+ fails to create the object. 124 */ 125 public this () 126 { 127 // GtkWidget * gtk_stack_new (void); 128 auto p = gtk_stack_new(); 129 if(p is null) 130 { 131 throw new ConstructionException("null returned by gtk_stack_new()"); 132 } 133 this(cast(GtkStack*) p); 134 } 135 136 /** 137 * Adds a child to stack. 138 * The child is identified by the name. 139 * Params: 140 * child = the widget to add 141 * name = the name for child 142 * Since 3.10 143 */ 144 public void addNamed(Widget child, string name) 145 { 146 // void gtk_stack_add_named (GtkStack *stack, GtkWidget *child, const gchar *name); 147 gtk_stack_add_named(gtkStack, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(name)); 148 } 149 150 /** 151 * Adds a child to stack. 152 * The child is identified by the name. The title 153 * will be used by GtkStackSwitcher to represent 154 * child in a tab bar, so it should be short. 155 * Params: 156 * child = the widget to add 157 * name = the name for child 158 * title = a human-readable title for child 159 * Since 3.10 160 */ 161 public void addTitled(Widget child, string name, string title) 162 { 163 // void gtk_stack_add_titled (GtkStack *stack, GtkWidget *child, const gchar *name, const gchar *title); 164 gtk_stack_add_titled(gtkStack, (child is null) ? null : child.getWidgetStruct(), Str.toStringz(name), Str.toStringz(title)); 165 } 166 167 /** 168 * Makes child the visible child of stack. 169 * If child is different from the currently 170 * visible child, the transition between the 171 * two will be animated with the current 172 * transition type of stack. 173 * Params: 174 * child = a child of stack 175 * Since 3.10 176 */ 177 public void setVisibleChild(Widget child) 178 { 179 // void gtk_stack_set_visible_child (GtkStack *stack, GtkWidget *child); 180 gtk_stack_set_visible_child(gtkStack, (child is null) ? null : child.getWidgetStruct()); 181 } 182 183 /** 184 * Gets the currently visible child of stack, or NULL if 185 * there are no visible children. 186 * Returns: the visible child of the GtkStack. [transfer none] Since 3.10 187 */ 188 public Widget getVisibleChild() 189 { 190 // GtkWidget * gtk_stack_get_visible_child (GtkStack *stack); 191 auto p = gtk_stack_get_visible_child(gtkStack); 192 193 if(p is null) 194 { 195 return null; 196 } 197 198 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 199 } 200 201 /** 202 * Makes the child with the given name visible. 203 * If child is different from the currently 204 * visible child, the transition between the 205 * two will be animated with the current 206 * transition type of stack. 207 * Params: 208 * name = the name of the child to make visible 209 * Since 3.10 210 */ 211 public void setVisibleChildName(string name) 212 { 213 // void gtk_stack_set_visible_child_name (GtkStack *stack, const gchar *name); 214 gtk_stack_set_visible_child_name(gtkStack, Str.toStringz(name)); 215 } 216 217 /** 218 * Returns the name of the currently visible child of stack, or 219 * NULL if there is no visible child. 220 * Returns: the name of the visible child of the GtkStack. [transfer none] Since 3.10 221 */ 222 public string getVisibleChildName() 223 { 224 // const gchar * gtk_stack_get_visible_child_name (GtkStack *stack); 225 return Str.toString(gtk_stack_get_visible_child_name(gtkStack)); 226 } 227 228 /** 229 * Makes the child with the given name visible. 230 * Params: 231 * name = the name of the child to make visible 232 * transition = the transition type to use 233 * Since 3.10 234 */ 235 public void setVisibleChildFull(string name, GtkStackTransitionType transition) 236 { 237 // void gtk_stack_set_visible_child_full (GtkStack *stack, const gchar *name, GtkStackTransitionType transition); 238 gtk_stack_set_visible_child_full(gtkStack, Str.toStringz(name), transition); 239 } 240 241 /** 242 * Sets the GtkStack to be homogeneous or not. If it 243 * is homogeneous, the GtkStack will request the same 244 * size for all its children. If it isn't, the stack 245 * may change size when a different child becomes visible. 246 * Params: 247 * homogeneous = TRUE to make stack homogeneous 248 * Since 3.10 249 */ 250 public void setHomogeneous(int homogeneous) 251 { 252 // void gtk_stack_set_homogeneous (GtkStack *stack, gboolean homogeneous); 253 gtk_stack_set_homogeneous(gtkStack, homogeneous); 254 } 255 256 /** 257 * Gets whether stack is homogeneous. 258 * See gtk_stack_set_homogeneous(). 259 * Returns: whether stack is homogeneous. Since 3.10 260 */ 261 public int getHomogeneous() 262 { 263 // gboolean gtk_stack_get_homogeneous (GtkStack *stack); 264 return gtk_stack_get_homogeneous(gtkStack); 265 } 266 267 /** 268 * Sets the duration that transitions between pages in stack 269 * will take. 270 * Params: 271 * duration = the new duration, in milliseconds 272 * Since 3.10 273 */ 274 public void setTransitionDuration(uint duration) 275 { 276 // void gtk_stack_set_transition_duration (GtkStack *stack, guint duration); 277 gtk_stack_set_transition_duration(gtkStack, duration); 278 } 279 280 /** 281 * Returns the amount of time (in milliseconds) that 282 * transitions between pages in stack will take. 283 * Returns: the transition duration Since 3.10 284 */ 285 public uint getTransitionDuration() 286 { 287 // guint gtk_stack_get_transition_duration (GtkStack *stack); 288 return gtk_stack_get_transition_duration(gtkStack); 289 } 290 291 /** 292 * Sets the type of animation that will be used for 293 * transitions between pages in stack. Available 294 * types include various kinds of fades and slides. 295 * The transition type can be changed without problems 296 * at runtime, so it is possible to change the animation 297 * based on the page that is about to become current. 298 * Params: 299 * transition = the new transition type 300 * Since 3.10 301 */ 302 public void setTransitionType(GtkStackTransitionType transition) 303 { 304 // void gtk_stack_set_transition_type (GtkStack *stack, GtkStackTransitionType transition); 305 gtk_stack_set_transition_type(gtkStack, transition); 306 } 307 308 /** 309 * Gets the type of animation that will be used 310 * for transitions between pages in stack. 311 * Returns: the current transition type of stack Since 3.10 312 */ 313 public GtkStackTransitionType getTransitionType() 314 { 315 // GtkStackTransitionType gtk_stack_get_transition_type (GtkStack *stack); 316 return gtk_stack_get_transition_type(gtkStack); 317 } 318 }