Package: gtk

Class gtk-box

Superclasses

gtk-container, gtk-widget, 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
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, depending upon the :horizontal or :vertical value 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.

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

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

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

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

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

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

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

CSS nodes

The gtk-box implementation 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 widget, regardless of text direction.

Child Property Details

expand
The expand child property of type :boolean (Read / Write)
Whether the child widget should receive extra space when the parent widget grows. The hexpand or vexpand properties are the preferred way to influence whether the child widget receives extra space, by setting the expand property of the child widget corresponding to the orientation of the box. In contrast to the hexpand property, the expand child property does not cause the box to expand itself.
Default value: false
fill
The fill child property of type :boolean (Read / Write)
Whether the child widget should fill extra space or use it as padding. The halign or valign properties are the preferred way to influence whether the child widget fills available space, by setting the align property of the child widget corresponding to the orientation of the box to the :fill value of the gtk-align enumeration to fill, or to something else to refrain from filling.
Default value: true
pack-type
The pack-type child property of type gtk-pack-type (Read / Write)
A pack type indicating whether the child widget is packed with reference to the start or end of the parent widget.
Default value: :start
padding
The padding child property of type :uint (Read / Write)
Extra space to put between the child widget and its neighbors, in pixels. The CSS padding properties are the preferred way to add space among widgets, by setting the paddings corresponding to the orientation of the box.
Allowed values: <= G_MAXINT
Default value: 0
position
The position child property of type :int (Read / Write)
The index of the child widget in the parent widget.
Allowed values: >= -1
Default value: 0
 

Slot Access Functions

Inherited Slot Access Functions

See also

*2021-10-31