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 = GtkBox.html 27 * outPack = gtk 28 * outFile = Box 29 * strct = GtkBox 30 * realStrct= 31 * ctorStrct= 32 * clss = Box 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * - OrientableIF 40 * prefixes: 41 * - gtk_box_ 42 * - gtk_ 43 * omit structs: 44 * omit prefixes: 45 * omit code: 46 * omit signals: 47 * imports: 48 * - gtk.Widget 49 * - gtk.OrientableIF 50 * - gtk.OrientableT 51 * structWrap: 52 * - GtkWidget* -> Widget 53 * module aliases: 54 * local aliases: 55 * overrides: 56 */ 57 58 module gtk.Box; 59 60 public import gtkc.gtktypes; 61 62 private import gtkc.gtk; 63 private import glib.ConstructionException; 64 private import gobject.ObjectG; 65 66 67 private import gtk.Widget; 68 private import gtk.OrientableIF; 69 private import gtk.OrientableT; 70 71 72 73 private import gtk.Container; 74 75 /** 76 * Description 77 * GtkBox is an abstract widget which encapsulates functionality for a 78 * particular kind of container, one that organizes a variable number of 79 * widgets into a rectangular area. GtkBox has a number of derived 80 * classes, e.g. GtkHBox and GtkVBox. 81 * The rectangular area of a GtkBox is organized into either a single row 82 * or a single column of child widgets depending upon whether the box is 83 * of type GtkHBox or GtkVBox, respectively. Thus, all children of a 84 * GtkBox are allocated one dimension in common, which is the height of a 85 * row, or the width of a column. 86 * GtkBox uses a notion of packing. Packing refers to 87 * adding widgets with reference to a particular position in a 88 * GtkContainer. For a GtkBox, there are two reference positions: the 89 * start and the end of the box. 90 * For a GtkVBox, the start is defined as the top of the box and the end is 91 * defined as the bottom. For a GtkHBox the start is defined as the 92 * left side and the end is defined as the right side. 93 * Use repeated calls to gtk_box_pack_start() to pack widgets into a 94 * GtkBox from start to end. Use gtk_box_pack_end() to add widgets from 95 * end to start. You may intersperse these calls and add widgets from 96 * both ends of the same GtkBox. 97 * Use gtk_box_pack_start_defaults() or gtk_box_pack_end_defaults() 98 * to pack widgets into a GtkBox if you do not need to specify the 99 * "expand", "fill", or "padding" child properties 100 * for the child to be added. 101 * Because GtkBox is a GtkContainer, you may also use 102 * gtk_container_add() to insert widgets into the box, and they will be 103 * packed as if with gtk_box_pack_start_defaults(). Use 104 * gtk_container_remove() to remove widgets from the GtkBox. 105 * Use gtk_box_set_homogeneous() to specify whether or not all children 106 * of the GtkBox are forced to get the same amount of space. 107 * Use gtk_box_set_spacing() to determine how much space will be 108 * minimally placed between all children in the GtkBox. 109 * Use gtk_box_reorder_child() to move a GtkBox child to a different 110 * place in the box. 111 * Use gtk_box_set_child_packing() to reset the "expand", 112 * "fill" and "padding" child properties. 113 * Use gtk_box_query_child_packing() to query these fields. 114 */ 115 public class Box : Container, OrientableIF 116 { 117 118 /** the main Gtk struct */ 119 protected GtkBox* gtkBox; 120 121 122 public GtkBox* getBoxStruct() 123 { 124 return gtkBox; 125 } 126 127 128 /** the main Gtk struct as a void* */ 129 protected override void* getStruct() 130 { 131 return cast(void*)gtkBox; 132 } 133 134 /** 135 * Sets our main struct and passes it to the parent class 136 */ 137 public this (GtkBox* gtkBox) 138 { 139 super(cast(GtkContainer*)gtkBox); 140 this.gtkBox = gtkBox; 141 } 142 143 protected override void setStruct(GObject* obj) 144 { 145 super.setStruct(obj); 146 gtkBox = cast(GtkBox*)obj; 147 } 148 149 // add the Orientable capabilities 150 mixin OrientableT!(GtkBox); 151 152 /** 153 */ 154 155 /** 156 * Adds child to box, packed with reference to the start of box. 157 * The child is packed after any other child packed with reference 158 * to the start of box. 159 * Params: 160 * child = the GtkWidget to be added to box 161 * expand = TRUE if the new child is to be given extra space allocated to 162 * box. The extra space will be divided evenly between all children of 163 * box that use this option 164 * fill = TRUE if space given to child by the expand option is 165 * actually allocated to child, rather than just padding it. This 166 * parameter has no effect if expand is set to FALSE. A child is 167 * always allocated the full height of a GtkHBox and the full width 168 * of a GtkVBox. This option affects the other dimension 169 * padding = extra space in pixels to put between this child and its 170 * neighbors, over and above the global amount specified by 171 * "spacing" property. If child is a widget at one of the 172 * reference ends of box, then padding pixels are also put between 173 * child and the reference edge of box 174 */ 175 public void packStart(Widget child, int expand, int fill, uint padding) 176 { 177 // void gtk_box_pack_start (GtkBox *box, GtkWidget *child, gboolean expand, gboolean fill, guint padding); 178 gtk_box_pack_start(gtkBox, (child is null) ? null : child.getWidgetStruct(), expand, fill, padding); 179 } 180 181 /** 182 * Adds child to box, packed with reference to the end of box. 183 * The child is packed after (away from end of) any other child 184 * packed with reference to the end of box. 185 * Params: 186 * child = the GtkWidget to be added to box 187 * expand = TRUE if the new child is to be given extra space allocated 188 * to box. The extra space will be divided evenly between all children 189 * of box that use this option 190 * fill = TRUE if space given to child by the expand option is 191 * actually allocated to child, rather than just padding it. This 192 * parameter has no effect if expand is set to FALSE. A child is 193 * always allocated the full height of a GtkHBox and the full width 194 * of a GtkVBox. This option affects the other dimension 195 * padding = extra space in pixels to put between this child and its 196 * neighbors, over and above the global amount specified by 197 * "spacing" property. If child is a widget at one of the 198 * reference ends of box, then padding pixels are also put between 199 * child and the reference edge of box 200 */ 201 public void packEnd(Widget child, int expand, int fill, uint padding) 202 { 203 // void gtk_box_pack_end (GtkBox *box, GtkWidget *child, gboolean expand, gboolean fill, guint padding); 204 gtk_box_pack_end(gtkBox, (child is null) ? null : child.getWidgetStruct(), expand, fill, padding); 205 } 206 207 /** 208 * Warning 209 * gtk_box_pack_start_defaults has been deprecated since version 2.14 and should not be used in newly-written code. Use gtk_box_pack_start() 210 * Adds widget to box, packed with reference to the start of box. 211 * The child is packed after any other child packed with reference 212 * to the start of box. 213 * Parameters for how to pack the child widget, "expand", 214 * "fill" and "padding", are given their default 215 * values, TRUE, TRUE, and 0, respectively. 216 * Params: 217 * widget = the GtkWidget to be added to box 218 */ 219 public void packStartDefaults(Widget widget) 220 { 221 // void gtk_box_pack_start_defaults (GtkBox *box, GtkWidget *widget); 222 gtk_box_pack_start_defaults(gtkBox, (widget is null) ? null : widget.getWidgetStruct()); 223 } 224 225 /** 226 * Warning 227 * gtk_box_pack_end_defaults has been deprecated since version 2.14 and should not be used in newly-written code. Use gtk_box_pack_end() 228 * Adds widget to box, packed with reference to the end of box. 229 * The child is packed after any other child packed with reference 230 * to the start of box. 231 * Parameters for how to pack the child widget, "expand", 232 * "fill" and "padding", are given their default 233 * values, TRUE, TRUE, and 0, respectively. 234 * Params: 235 * widget = the GtkWidget to be added to box 236 */ 237 public void packEndDefaults(Widget widget) 238 { 239 // void gtk_box_pack_end_defaults (GtkBox *box, GtkWidget *widget); 240 gtk_box_pack_end_defaults(gtkBox, (widget is null) ? null : widget.getWidgetStruct()); 241 } 242 243 /** 244 * Returns whether the box is homogeneous (all children are the 245 * same size). See gtk_box_set_homogeneous(). 246 * Returns: TRUE if the box is homogeneous. 247 */ 248 public int getHomogeneous() 249 { 250 // gboolean gtk_box_get_homogeneous (GtkBox *box); 251 return gtk_box_get_homogeneous(gtkBox); 252 } 253 254 /** 255 * Sets the "homogeneous" property of box, controlling 256 * whether or not all children of box are given equal space 257 * in the box. 258 * Params: 259 * homogeneous = a boolean value, TRUE to create equal allotments, 260 * FALSE for variable allotments 261 */ 262 public void setHomogeneous(int homogeneous) 263 { 264 // void gtk_box_set_homogeneous (GtkBox *box, gboolean homogeneous); 265 gtk_box_set_homogeneous(gtkBox, homogeneous); 266 } 267 268 /** 269 * Gets the value set by gtk_box_set_spacing(). 270 * Returns: spacing between children 271 */ 272 public int getSpacing() 273 { 274 // gint gtk_box_get_spacing (GtkBox *box); 275 return gtk_box_get_spacing(gtkBox); 276 } 277 278 /** 279 * Sets the "spacing" property of box, which is the 280 * number of pixels to place between children of box. 281 * Params: 282 * spacing = the number of pixels to put between children 283 */ 284 public void setSpacing(int spacing) 285 { 286 // void gtk_box_set_spacing (GtkBox *box, gint spacing); 287 gtk_box_set_spacing(gtkBox, spacing); 288 } 289 290 /** 291 * Moves child to a new position in the list of box children. 292 * The list is the children field of 293 * GtkBox, and contains both widgets packed GTK_PACK_START 294 * as well as widgets packed GTK_PACK_END, in the order that these 295 * widgets were added to box. 296 * A widget's position in the box children list determines where 297 * the widget is packed into box. A child widget at some position 298 * in the list will be packed just after all other widgets of the 299 * same packing type that appear earlier in the list. 300 * Params: 301 * child = the GtkWidget to move 302 * position = the new position for child in the list of children 303 * of box, starting from 0. If negative, indicates the end of 304 * the list 305 */ 306 public void reorderChild(Widget child, int position) 307 { 308 // void gtk_box_reorder_child (GtkBox *box, GtkWidget *child, gint position); 309 gtk_box_reorder_child(gtkBox, (child is null) ? null : child.getWidgetStruct(), position); 310 } 311 312 /** 313 * Obtains information about how child is packed into box. 314 * Params: 315 * child = the GtkWidget of the child to query 316 * expand = pointer to return location for "expand" child property 317 * fill = pointer to return location for "fill" child property 318 * padding = pointer to return location for "padding" child property 319 * packType = pointer to return location for "pack-type" child property 320 */ 321 public void queryChildPacking(Widget child, out int expand, out int fill, out uint padding, out GtkPackType packType) 322 { 323 // void gtk_box_query_child_packing (GtkBox *box, GtkWidget *child, gboolean *expand, gboolean *fill, guint *padding, GtkPackType *pack_type); 324 gtk_box_query_child_packing(gtkBox, (child is null) ? null : child.getWidgetStruct(), &expand, &fill, &padding, &packType); 325 } 326 327 /** 328 * Sets the way child is packed into box. 329 * Params: 330 * child = the GtkWidget of the child to set 331 * expand = the new value of the "expand" child property 332 * fill = the new value of the "fill" child property 333 * padding = the new value of the "padding" child property 334 * packType = the new value of the "pack-type" child property 335 */ 336 public void setChildPacking(Widget child, int expand, int fill, uint padding, GtkPackType packType) 337 { 338 // void gtk_box_set_child_packing (GtkBox *box, GtkWidget *child, gboolean expand, gboolean fill, guint padding, GtkPackType pack_type); 339 gtk_box_set_child_packing(gtkBox, (child is null) ? null : child.getWidgetStruct(), expand, fill, padding, packType); 340 } 341 }