Package: gtk

Class gtk-box

Superclasses

gtk-container, gtk-widget, g-initially-unowned, gtk-buildable, gtk-orientable, g-object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

Direct Slots

baseline-position
The baseline-position property of type gtk-baseline-position (Read / Write)
The position of the baseline aligned widgets if extra space is available.
Default value: :center
Since 3.10
homogeneous
The homogeneous property of type :boolean (Read / Write)
Whether the children should all be the same size.
Default value: nil
spacing
The spacing property of type :int (Read / Write)
The amount of space between children.
Allowed values: >= 0
Default value: 0

Details

The gtk-box widget arranges child widgets into a single row or column, depending upon the value :horizontal or :vertical of its inherited orientation property. Within the other dimension, all children are allocated the same size. Of course, the halign and valign properties can be used on the children to influence their allocation.

gtk-box uses a notion of packing. Packing refers to adding widgets with reference to a particular position in a gtk-container. For a gtk-box, there are two reference positions: the start and the end of the box. For a vertical gtk-box, the start is defined as the top of the box and the end is defined as the bottom. For a horizontal gtk-box the start is defined as the left side and the end is defined as the right side.

Use repeated calls to the function gtk-box-pack-start to pack widgets into a gtk-box from start to end. Use the function gtk-box-pack-end to add widgets from end to start. You may intersperse these calls and add widgets from both ends of the same gtk-box.

Because gtk-box is a gtk-container, you may also use the function gtk-container-add to insert widgets into the box, and they will be packed with the default values for expand and fill child properties. Use the function gtk-container-remove to remove widgets from the gtk-box.

Use the slot access function gtk-box-homogeneous to specify whether or not all children of the gtk-box are forced to get the same amount of space.

Use the slot access function gtk-box-spacing to determine how much space will be minimally placed between all children in the gtk-box. Note that spacing is added between the children, while padding added by the functions gtk-box-pack-start or gtk-box-pack-end is added on either side of the widget it belongs to.

Use the function gtk-box-reorder-child to move a gtk-box child to a different place in the box.

Use the function gtk-box-set-child-packing to reset the expand, fill and padding child properties. Use the function gtk-box-query-child-packing to query these fields.

CSS nodes

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

In horizontal orientation, the nodes of the children are always arranged from left to right. So :first-child will always select the leftmost child, regardless of text direction.

Child Property Details

expand
The expand child property of type :boolean (Read / Write)
Whether the child should receive extra space when the parent grows. Note that the default value for this property is nil for gtk-box. Note that the halign, valign, hexpand and vexpand properties are the preferred way to influence child size allocation in containers.
Default value: nil
fill
The fill child property of type :boolean (Read / Write)
Whether the child should receive extra space when the parent grows. Note that the halign, valign, hexpand and vexpand properties are the preferred way to influence child size allocation in containers.
Default value: true
pack-type
The pack-type child property of type gtk-pack-type (Read / Write)
A gtk-pack-type indicating whether the child is packed with reference to the start or end of the parent.
Default value: :start
padding
The padding child property of type :uint (Read / Write)
Extra space to put between the child and its neighbors, in pixels.
Default value: 0
position
The position child property of type :int (Read / Write)
The index of the child in the parent.
Default value: 0
 

Slot Access Functions

Inherited Slot Access Functions

See also

2019-3-13