Package: gtk

Class gtk:box

Superclasses

Documented Subclasses

Direct Slots

baseline-child
The baseline-child property of type :int (Read / Write)
The child widget that determines the baseline, in vertical orientation. Since 4.12
Default value: -1
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
homogeneous
The homogeneous property of type :boolean (Read / Write)
Whether the children should all be the same size.
Default value: false
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.

Figure: GtkBox

Whether it is a row or column depends on the value of its 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.

Use repeated calls to the gtk:box-append function to pack widgets into a box from start to end. Use the gtk:box-remove function to remove widgets from the box. The gtk:box-insert-child-after function can be used to add a child widget at a particular position.

Use the gtk:box-homogeneous function to specify whether or not all children of the box are forced to get the same amount of space and the gtk:box-spacing function to determine how much space will be minimally placed between all children in the box. Note that spacing is added between the children.

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

CSS nodes

The gtk:box implementation uses a single CSS node with name box.

Accessibility

Until GTK 4.10, the gtk:box implementation used the :group role of the gtk:accessible-role enumeration. Starting from GTK 4.12, the gtk:box implementation uses the :generic role.
 

Returned by

Slot Access Functions

Inherited Slot Access Functions

See also

2023-8-25