1 /* 2 * This file is part of d-dazzle. 3 * 4 * d-dazzle 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 * d-dazzle 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 d-dazzle; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 module dazzle.TabStrip; 20 21 private import dazzle.c.functions; 22 public import dazzle.c.types; 23 private import glib.ConstructionException; 24 private import gobject.ObjectG; 25 private import gtk.Box; 26 private import gtk.BuildableIF; 27 private import gtk.BuildableT; 28 private import gtk.OrientableIF; 29 private import gtk.OrientableT; 30 private import gtk.Stack; 31 private import gtk.Widget; 32 33 34 /** */ 35 public class TabStrip : Box 36 { 37 /** the main Gtk struct */ 38 protected DzlTabStrip* dzlTabStrip; 39 40 /** Get the main Gtk struct */ 41 public DzlTabStrip* getTabStripStruct(bool transferOwnership = false) 42 { 43 if (transferOwnership) 44 ownedRef = false; 45 return dzlTabStrip; 46 } 47 48 /** the main Gtk struct as a void* */ 49 protected override void* getStruct() 50 { 51 return cast(void*)dzlTabStrip; 52 } 53 54 /** 55 * Sets our main struct and passes it to the parent class. 56 */ 57 public this (DzlTabStrip* dzlTabStrip, bool ownedRef = false) 58 { 59 this.dzlTabStrip = dzlTabStrip; 60 super(cast(GtkBox*)dzlTabStrip, ownedRef); 61 } 62 63 alias getStyle = Widget.getStyle; 64 65 /** */ 66 public DzlTabStyle getStyle() 67 { 68 return dzl_tab_strip_get_style(dzlTabStrip); 69 } 70 71 /** 72 */ 73 74 /** */ 75 public static GType getType() 76 { 77 return dzl_tab_strip_get_type(); 78 } 79 80 /** */ 81 public this() 82 { 83 auto p = dzl_tab_strip_new(); 84 85 if(p is null) 86 { 87 throw new ConstructionException("null returned by new"); 88 } 89 90 this(cast(DzlTabStrip*) p); 91 } 92 93 /** */ 94 public void addControl(Widget widget) 95 { 96 dzl_tab_strip_add_control(dzlTabStrip, (widget is null) ? null : widget.getWidgetStruct()); 97 } 98 99 /** */ 100 public GtkPositionType getEdge() 101 { 102 return dzl_tab_strip_get_edge(dzlTabStrip); 103 } 104 105 /** 106 * Returns: A #GtkStack or %NULL. 107 */ 108 public Stack getStack() 109 { 110 auto p = dzl_tab_strip_get_stack(dzlTabStrip); 111 112 if(p is null) 113 { 114 return null; 115 } 116 117 return ObjectG.getDObject!(Stack)(cast(GtkStack*) p); 118 } 119 120 /** */ 121 public void setEdge(GtkPositionType edge) 122 { 123 dzl_tab_strip_set_edge(dzlTabStrip, edge); 124 } 125 126 /** */ 127 public void setStack(Stack stack) 128 { 129 dzl_tab_strip_set_stack(dzlTabStrip, (stack is null) ? null : stack.getStackStruct()); 130 } 131 132 /** */ 133 public void setStyle(DzlTabStyle style) 134 { 135 dzl_tab_strip_set_style(dzlTabStrip, style); 136 } 137 }