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 = GtkHeaderBar.html 27 * outPack = gtk 28 * outFile = HeaderBar 29 * strct = GtkHeaderBar 30 * realStrct= 31 * ctorStrct= 32 * clss = HeaderBar 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gtk_header_bar_ 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.HeaderBar; 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 * GtkHeaderBar is similar to a horizontal GtkBox, it allows 71 * to place children at the start or the end. In addition, 72 * it allows a title to be displayed. The title will be 73 * centered with respect to the width of the box, even if the children 74 * at either side take up different amounts of space. 75 */ 76 public class HeaderBar : Container 77 { 78 79 /** the main Gtk struct */ 80 protected GtkHeaderBar* gtkHeaderBar; 81 82 83 /** Get the main Gtk struct */ 84 public GtkHeaderBar* getHeaderBarStruct() 85 { 86 return gtkHeaderBar; 87 } 88 89 90 /** the main Gtk struct as a void* */ 91 protected override void* getStruct() 92 { 93 return cast(void*)gtkHeaderBar; 94 } 95 96 /** 97 * Sets our main struct and passes it to the parent class 98 */ 99 public this (GtkHeaderBar* gtkHeaderBar) 100 { 101 super(cast(GtkContainer*)gtkHeaderBar); 102 this.gtkHeaderBar = gtkHeaderBar; 103 } 104 105 protected override void setStruct(GObject* obj) 106 { 107 super.setStruct(obj); 108 gtkHeaderBar = cast(GtkHeaderBar*)obj; 109 } 110 111 /** 112 */ 113 114 /** 115 * Creates a new GtkHeaderBar widget. 116 * Throws: ConstructionException GTK+ fails to create the object. 117 */ 118 public this () 119 { 120 // GtkWidget * gtk_header_bar_new (void); 121 auto p = gtk_header_bar_new(); 122 if(p is null) 123 { 124 throw new ConstructionException("null returned by gtk_header_bar_new()"); 125 } 126 this(cast(GtkHeaderBar*) p); 127 } 128 129 /** 130 * Sets the title of the GtkHeaderBar. The title should help a user 131 * identify the current view. A good title should not include the 132 * application name. 133 * Params: 134 * title = a title. [allow-none] 135 * Since 3.10 136 */ 137 public void setTitle(string title) 138 { 139 // void gtk_header_bar_set_title (GtkHeaderBar *bar, const gchar *title); 140 gtk_header_bar_set_title(gtkHeaderBar, Str.toStringz(title)); 141 } 142 143 /** 144 * Retrieves the title of the header. See gtk_header_bar_set_title(). 145 * Returns: the title of the header, or NULL if none has been set explicitely. The returned string is owned by the widget and must not be modified or freed. Since 3.10 146 */ 147 public string getTitle() 148 { 149 // const gchar * gtk_header_bar_get_title (GtkHeaderBar *bar); 150 return Str.toString(gtk_header_bar_get_title(gtkHeaderBar)); 151 } 152 153 /** 154 * Sets the subtitle of the GtkHeaderBar. The title should give a user 155 * an additional detail to help him identify the current view. 156 * Note that GtkHeaderBar always reserves room for the subtitle, even 157 * if none is currently set. If this is not desired, use 158 * gtk_header_bar_set_custom_title() to place your own label in the 159 * title position. To achieve the same style, use the "title" style 160 * class. 161 * Params: 162 * subtitle = a subtitle. [allow-none] 163 * Since 3.10 164 */ 165 public void setSubtitle(string subtitle) 166 { 167 // void gtk_header_bar_set_subtitle (GtkHeaderBar *bar, const gchar *subtitle); 168 gtk_header_bar_set_subtitle(gtkHeaderBar, Str.toStringz(subtitle)); 169 } 170 171 /** 172 * Retrieves the subtitle of the header. See gtk_header_bar_set_subtitle(). 173 * Returns: the subtitle of the header, or NULL if none has been set explicitely. The returned string is owned by the widget and must not be modified or freed. Since 3.10 174 */ 175 public string getSubtitle() 176 { 177 // const gchar * gtk_header_bar_get_subtitle (GtkHeaderBar *bar); 178 return Str.toString(gtk_header_bar_get_subtitle(gtkHeaderBar)); 179 } 180 181 /** 182 * Sets a custom title for the GtkHeaderBar. The title should help a 183 * user identify the current view. This supercedes any title set by 184 * gtk_header_bar_set_title() or gtk_header_bar_set_subtitle(). 185 * You should set the custom title to NULL, for the header title label 186 * to be visible again. 187 * Params: 188 * titleWidget = a custom widget to use for a title. [allow-none] 189 * Since 3.10 190 */ 191 public void setCustomTitle(Widget titleWidget) 192 { 193 // void gtk_header_bar_set_custom_title (GtkHeaderBar *bar, GtkWidget *title_widget); 194 gtk_header_bar_set_custom_title(gtkHeaderBar, (titleWidget is null) ? null : titleWidget.getWidgetStruct()); 195 } 196 197 /** 198 * Retrieves the custom title widget of the header. See 199 * gtk_header_bar_set_custom_title(). 200 * Returns: the custom title widget of the header, or NULL if none has been set explicitely. [transfer none] Since 3.10 201 */ 202 public Widget getCustomTitle() 203 { 204 // GtkWidget * gtk_header_bar_get_custom_title (GtkHeaderBar *bar); 205 auto p = gtk_header_bar_get_custom_title(gtkHeaderBar); 206 207 if(p is null) 208 { 209 return null; 210 } 211 212 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) p); 213 } 214 215 /** 216 * Adds child to box, packed with reference to the 217 * start of the box. 218 * Params: 219 * child = the GtkWidget to be added to bar 220 * Since 3.10 221 */ 222 public void packStart(Widget child) 223 { 224 // void gtk_header_bar_pack_start (GtkHeaderBar *bar, GtkWidget *child); 225 gtk_header_bar_pack_start(gtkHeaderBar, (child is null) ? null : child.getWidgetStruct()); 226 } 227 228 /** 229 * Adds child to box, packed with reference to the 230 * end of the box. 231 * Params: 232 * child = the GtkWidget to be added to bar 233 * Since 3.10 234 */ 235 public void packEnd(Widget child) 236 { 237 // void gtk_header_bar_pack_end (GtkHeaderBar *bar, GtkWidget *child); 238 gtk_header_bar_pack_end(gtkHeaderBar, (child is null) ? null : child.getWidgetStruct()); 239 } 240 241 /** 242 * Sets whether this header bar shows a window close 243 * button. 244 * Params: 245 * setting = TRUE to show a window close button 246 * Since 3.10 247 */ 248 public void setShowCloseButton(int setting) 249 { 250 // void gtk_header_bar_set_show_close_button (GtkHeaderBar *bar, gboolean setting); 251 gtk_header_bar_set_show_close_button(gtkHeaderBar, setting); 252 } 253 254 /** 255 * Returns whether this header bar shows a window close 256 * button. 257 * Returns: TRUE if a window close button is shown Since 3.10 258 */ 259 public int getShowCloseButton() 260 { 261 // gboolean gtk_header_bar_get_show_close_button (GtkHeaderBar *bar); 262 return gtk_header_bar_get_show_close_button(gtkHeaderBar); 263 } 264 }