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.CenterBox; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gtk.OrientableIF; 30 private import gtk.OrientableT; 31 private import gtk.Widget; 32 private import gtk.c.functions; 33 public import gtk.c.types; 34 35 36 /** 37 * `GtkCenterBox` arranges three children in a row, keeping the middle child 38 * centered as well as possible. 39 * 40 * ![An example GtkCenterBox](centerbox.png) 41 * 42 * To add children to `GtkCenterBox`, use [method@Gtk.CenterBox.set_start_widget], 43 * [method@Gtk.CenterBox.set_center_widget] and 44 * [method@Gtk.CenterBox.set_end_widget]. 45 * 46 * The sizing and positioning of children can be influenced with the 47 * align and expand properties of the children. 48 * 49 * # GtkCenterBox as GtkBuildable 50 * 51 * The `GtkCenterBox` implementation of the `GtkBuildable` interface 52 * supports placing children in the 3 positions by specifying “start”, “center” 53 * or “end” as the “type” attribute of a <child> element. 54 * 55 * # CSS nodes 56 * 57 * `GtkCenterBox` uses a single CSS node with the name “box”, 58 * 59 * The first child of the `GtkCenterBox` will be allocated depending on the 60 * text direction, i.e. in left-to-right layouts it will be allocated on the 61 * left and in right-to-left layouts on the right. 62 * 63 * In vertical orientation, the nodes of the children are arranged from top to 64 * bottom. 65 * 66 * # Accessibility 67 * 68 * `GtkCenterBox` uses the %GTK_ACCESSIBLE_ROLE_GROUP role. 69 */ 70 public class CenterBox : Widget, OrientableIF 71 { 72 /** the main Gtk struct */ 73 protected GtkCenterBox* gtkCenterBox; 74 75 /** Get the main Gtk struct */ 76 public GtkCenterBox* getCenterBoxStruct(bool transferOwnership = false) 77 { 78 if (transferOwnership) 79 ownedRef = false; 80 return gtkCenterBox; 81 } 82 83 /** the main Gtk struct as a void* */ 84 protected override void* getStruct() 85 { 86 return cast(void*)gtkCenterBox; 87 } 88 89 /** 90 * Sets our main struct and passes it to the parent class. 91 */ 92 public this (GtkCenterBox* gtkCenterBox, bool ownedRef = false) 93 { 94 this.gtkCenterBox = gtkCenterBox; 95 super(cast(GtkWidget*)gtkCenterBox, ownedRef); 96 } 97 98 // add the Orientable capabilities 99 mixin OrientableT!(GtkCenterBox); 100 101 102 /** */ 103 public static GType getType() 104 { 105 return gtk_center_box_get_type(); 106 } 107 108 /** 109 * Creates a new `GtkCenterBox`. 110 * 111 * Returns: the new `GtkCenterBox`. 112 * 113 * Throws: ConstructionException GTK+ fails to create the object. 114 */ 115 public this() 116 { 117 auto __p = gtk_center_box_new(); 118 119 if(__p is null) 120 { 121 throw new ConstructionException("null returned by new"); 122 } 123 124 this(cast(GtkCenterBox*) __p); 125 } 126 127 /** 128 * Gets the value set by gtk_center_box_set_baseline_position(). 129 * 130 * Returns: the baseline position 131 */ 132 public GtkBaselinePosition getBaselinePosition() 133 { 134 return gtk_center_box_get_baseline_position(gtkCenterBox); 135 } 136 137 /** 138 * Gets the center widget, or %NULL if there is none. 139 * 140 * Returns: the center widget. 141 */ 142 public Widget getCenterWidget() 143 { 144 auto __p = gtk_center_box_get_center_widget(gtkCenterBox); 145 146 if(__p is null) 147 { 148 return null; 149 } 150 151 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 152 } 153 154 /** 155 * Gets the end widget, or %NULL if there is none. 156 * 157 * Returns: the end widget. 158 */ 159 public Widget getEndWidget() 160 { 161 auto __p = gtk_center_box_get_end_widget(gtkCenterBox); 162 163 if(__p is null) 164 { 165 return null; 166 } 167 168 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 169 } 170 171 /** 172 * Gets the start widget, or %NULL if there is none. 173 * 174 * Returns: the start widget. 175 */ 176 public Widget getStartWidget() 177 { 178 auto __p = gtk_center_box_get_start_widget(gtkCenterBox); 179 180 if(__p is null) 181 { 182 return null; 183 } 184 185 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 186 } 187 188 /** 189 * Sets the baseline position of a center box. 190 * 191 * This affects only horizontal boxes with at least one baseline 192 * aligned child. If there is more vertical space available than 193 * requested, and the baseline is not allocated by the parent then 194 * @position is used to allocate the baseline wrt. the extra space 195 * available. 196 * 197 * Params: 198 * position = a `GtkBaselinePosition` 199 */ 200 public void setBaselinePosition(GtkBaselinePosition position) 201 { 202 gtk_center_box_set_baseline_position(gtkCenterBox, position); 203 } 204 205 /** 206 * Sets the center widget. 207 * 208 * To remove the existing center widget, pas %NULL. 209 * 210 * Params: 211 * child = the new center widget, or %NULL 212 */ 213 public void setCenterWidget(Widget child) 214 { 215 gtk_center_box_set_center_widget(gtkCenterBox, (child is null) ? null : child.getWidgetStruct()); 216 } 217 218 /** 219 * Sets the end widget. 220 * 221 * To remove the existing end widget, pass %NULL. 222 * 223 * Params: 224 * child = the new end widget, or %NULL 225 */ 226 public void setEndWidget(Widget child) 227 { 228 gtk_center_box_set_end_widget(gtkCenterBox, (child is null) ? null : child.getWidgetStruct()); 229 } 230 231 /** 232 * Sets the start widget. 233 * 234 * To remove the existing start widget, pass %NULL. 235 * 236 * Params: 237 * child = the new start widget, or %NULL 238 */ 239 public void setStartWidget(Widget child) 240 { 241 gtk_center_box_set_start_widget(gtkCenterBox, (child is null) ? null : child.getWidgetStruct()); 242 } 243 }