gtk.box

Module for [Box] class

Types 3

The gtk.box.Box widget arranges child widgets into a single row or column.

!An example GtkBox

Whether it is a row or column depends on the value of its gtk.orientable.Orientable.orientation property. Within the other dimension, all children are allocated the same size. Of course, the gtk.widget.Widget.halign and gtk.widget.Widget.valign properties can be used on the children to influence their allocation.

Use repeated calls to gtk.box.Box.append to pack widgets into a gtk.box.Box from start to end. Use gtk.box.Box.remove to remove widgets from the gtk.box.Box. gtk.box.Box.insertChildAfter can be used to add a child at a particular position.

Use gtk.box.Box.setHomogeneous to specify whether or not all children of the gtk.box.Box are forced to get the same amount of space.

Use gtk.box.Box.setSpacing to determine how much space will be minimally placed between all children in the gtk.box.Box. Note that spacing is added between the children.

Use gtk.box.Box.reorderChildAfter to move a child to a different place in the box.

CSS nodes

gtk.box.Box uses a single CSS node with name box.

Accessibility

Until GTK 4.10, gtk.box.Box used the gtk.types.AccessibleRole.Group role.

Starting from GTK 4.12, gtk.box.Box uses the gtk.types.AccessibleRole.Generic role.

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
Box self() nothrowReturns `this`, for use in `with` statements.
BoxGidBuilder builder() static nothrowGet builder for [gtk.box.Box] Returns: New builder object
int baselineChild() @property nothrowGet `baselineChild` property. Returns: The child that determines the baseline, in vertical orientation.
void baselineChild(int propval) @property nothrowSet `baselineChild` property. Params: propval = The child that determines the baseline, in vertical orientation.
gtk.types.BaselinePosition baselinePosition() @property nothrowGet `baselinePosition` property. Returns: The position of the baseline aligned widgets if extra space is available.
void baselinePosition(gtk.types.BaselinePosition propval) @property nothrowSet `baselinePosition` property. Params: propval = The position of the baseline aligned widgets if extra space is available.
bool homogeneous() @property nothrowGet `homogeneous` property. Returns: Whether the children should all be the same size.
void homogeneous(bool propval) @property nothrowSet `homogeneous` property. Params: propval = Whether the children should all be the same size.
int spacing() @property nothrowGet `spacing` property. Returns: The amount of space between children.
void spacing(int propval) @property nothrowSet `spacing` property. Params: propval = The amount of space between children.
void append(gtk.widget.Widget child) nothrowAdds child as the last child to box.
int getBaselineChild() nothrowGets the value set by [gtk.box.Box.setBaselineChild]. Returns: the baseline child
gtk.types.BaselinePosition getBaselinePosition() nothrowGets the value set by [gtk.box.Box.setBaselinePosition]. Returns: the baseline position
bool getHomogeneous() nothrowReturns whether the box is homogeneous (all children are the same size). Returns: true if the box is homogeneous.
int getSpacing() nothrowGets the value set by [gtk.box.Box.setSpacing]. Returns: spacing between children
void insertChildAfter(gtk.widget.Widget child, gtk.widget.Widget sibling = null) nothrowInserts child in the position after sibling in the list of box children.
void prepend(gtk.widget.Widget child) nothrowAdds child as the first child to box.
void remove(gtk.widget.Widget child) nothrowRemoves a child widget from box.
void reorderChildAfter(gtk.widget.Widget child, gtk.widget.Widget sibling = null) nothrowMoves child to the position after sibling in the list of box children.
void setBaselineChild(int child) nothrowSets the baseline child of a box.
void setBaselinePosition(gtk.types.BaselinePosition position) nothrowSets the baseline position of a box.
void setHomogeneous(bool homogeneous) nothrowSets whether or not all children of box are given equal space in the box.
void setSpacing(int spacing) nothrowSets the number of pixels to place between children of box.
Constructors
this(void * ptr, Flag!"Take" take)
this(gtk.types.Orientation orientation, int spacing)Creates a new [gtk.box.Box].

Fluent builder implementation template for gtk.box.Box

Methods
T baselineChild(int propval) nothrowSet `baselineChild` property. Params: propval = The child that determines the baseline, in vertical orientation. Returns: Builder instance for fluent chaining
T baselinePosition(gtk.types.BaselinePosition propval) nothrowSet `baselinePosition` property. Params: propval = The position of the baseline aligned widgets if extra space is available. Returns: Builder instance for fluent chaining
T homogeneous(bool propval) nothrowSet `homogeneous` property. Params: propval = Whether the children should all be the same size. Returns: Builder instance for fluent chaining
T spacing(int propval) nothrowSet `spacing` property. Params: propval = The amount of space between children. Returns: Builder instance for fluent chaining

Fluent builder for gtk.box.Box

Methods
Box build() nothrowCreate object from builder. Returns: New object