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.ActionBar; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtk.Widget; 30 private import gtk.c.functions; 31 public import gtk.c.types; 32 33 34 /** 35 * `GtkActionBar` is designed to present contextual actions. 36 * 37 * ![An example GtkActionBar](action-bar.png) 38 * 39 * It is expected to be displayed below the content and expand 40 * horizontally to fill the area. 41 * 42 * It allows placing children at the start or the end. In addition, it 43 * contains an internal centered box which is centered with respect to 44 * the full width of the box, even if the children at either side take 45 * up different amounts of space. 46 * 47 * # CSS nodes 48 * 49 * `GtkActionBar` has a single CSS node with name actionbar. 50 */ 51 public class ActionBar : Widget 52 { 53 /** the main Gtk struct */ 54 protected GtkActionBar* gtkActionBar; 55 56 /** Get the main Gtk struct */ 57 public GtkActionBar* getActionBarStruct(bool transferOwnership = false) 58 { 59 if (transferOwnership) 60 ownedRef = false; 61 return gtkActionBar; 62 } 63 64 /** the main Gtk struct as a void* */ 65 protected override void* getStruct() 66 { 67 return cast(void*)gtkActionBar; 68 } 69 70 /** 71 * Sets our main struct and passes it to the parent class. 72 */ 73 public this (GtkActionBar* gtkActionBar, bool ownedRef = false) 74 { 75 this.gtkActionBar = gtkActionBar; 76 super(cast(GtkWidget*)gtkActionBar, ownedRef); 77 } 78 79 80 /** */ 81 public static GType getType() 82 { 83 return gtk_action_bar_get_type(); 84 } 85 86 /** 87 * Creates a new `GtkActionBar` widget. 88 * 89 * Returns: a new `GtkActionBar` 90 * 91 * Throws: ConstructionException GTK+ fails to create the object. 92 */ 93 public this() 94 { 95 auto __p = gtk_action_bar_new(); 96 97 if(__p is null) 98 { 99 throw new ConstructionException("null returned by new"); 100 } 101 102 this(cast(GtkActionBar*) __p); 103 } 104 105 /** 106 * Retrieves the center bar widget of the bar. 107 * 108 * Returns: the center `GtkWidget` or %NULL. 109 */ 110 public Widget getCenterWidget() 111 { 112 auto __p = gtk_action_bar_get_center_widget(gtkActionBar); 113 114 if(__p is null) 115 { 116 return null; 117 } 118 119 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 120 } 121 122 /** 123 * Gets whether the contents of the action bar are revealed. 124 * 125 * Returns: the current value of the [property@Gtk.ActionBar:revealed] 126 * property. 127 */ 128 public bool getRevealed() 129 { 130 return gtk_action_bar_get_revealed(gtkActionBar) != 0; 131 } 132 133 /** 134 * Adds @child to @action_bar, packed with reference to the 135 * end of the @action_bar. 136 * 137 * Params: 138 * child = the `GtkWidget` to be added to @action_bar 139 */ 140 public void packEnd(Widget child) 141 { 142 gtk_action_bar_pack_end(gtkActionBar, (child is null) ? null : child.getWidgetStruct()); 143 } 144 145 /** 146 * Adds @child to @action_bar, packed with reference to the 147 * start of the @action_bar. 148 * 149 * Params: 150 * child = the `GtkWidget` to be added to @action_bar 151 */ 152 public void packStart(Widget child) 153 { 154 gtk_action_bar_pack_start(gtkActionBar, (child is null) ? null : child.getWidgetStruct()); 155 } 156 157 /** 158 * Removes a child from @action_bar. 159 * 160 * Params: 161 * child = the `GtkWidget` to be removed 162 */ 163 public void remove(Widget child) 164 { 165 gtk_action_bar_remove(gtkActionBar, (child is null) ? null : child.getWidgetStruct()); 166 } 167 168 /** 169 * Sets the center widget for the `GtkActionBar`. 170 * 171 * Params: 172 * centerWidget = a widget to use for the center 173 */ 174 public void setCenterWidget(Widget centerWidget) 175 { 176 gtk_action_bar_set_center_widget(gtkActionBar, (centerWidget is null) ? null : centerWidget.getWidgetStruct()); 177 } 178 179 /** 180 * Reveals or conceals the content of the action bar. 181 * 182 * Note: this does not show or hide @action_bar in the 183 * [property@Gtk.Widget:visible] sense, so revealing has 184 * no effect if the action bar is hidden. 185 * 186 * Params: 187 * revealed = The new value of the property 188 */ 189 public void setRevealed(bool revealed) 190 { 191 gtk_action_bar_set_revealed(gtkActionBar, revealed); 192 } 193 }