Package: gtk

Class gtk:center-box

Superclasses

Documented Subclasses

None

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
center-widget
The center-widget property of type gtk:widget (Read / Write)
The widget that is placed at the center position. Since 4.10
end-widget
The end-widget property of type gtk:widget (Read / Write)
The widget that is placed at the end position. In vertical orientation, the end position is at the bottom. In horizontal orientation, the end position is at the trailing edge with respect to the text direction. Since 4.10
shrink-center-last
The shrink-center-last property of type :boolean (Read / Write)
Whether to shrink the center widget after other children. By default, when there is no space to give all three children their natural widths, the start and end widgets start shrinking and the center child keeps natural width until they reach minimum width. If set to false, start and end widgets keep natural width and the center widget starts shrinking instead. Since 4.12
Default value: true
start-widget
The start-widget property of type gtk:widget (Read / Write)
The widget that is placed at the start position. In vertical orientation, the start position is at the top. In horizontal orientation, the start position is at the leading edge with respect to the text direction. Since 4.10

Details

The gtk:center-box widget arranges three children in a horizontal or vertical arrangement, keeping the middle child centered as well as possible.

Figure: GtkCenterBox

To add children to the gtk:center-box widget, use the gtk:center-box-start-widget, gtk:center-box-center-widget and gtk:center-box-end-widget functions. The sizing and positioning of children can be influenced with the align and expand properties of the children.

GtkCenterBox as GtkBuildable

The gtk:center-box implementation of the gtk:buildable interface supports placing children in the 3 positions by specifying "start", "center" or "end" as the "type" attribute of a <child> element.

CSS nodes

The gtk:center-box implementation uses a single CSS node with the name box. The first child of the gtk:center-box widget will be allocated depending on the text direction, that is, in left-to-right layouts it will be allocated on the left and in right-to-left layouts on the right. In vertical orientation, the nodes of the children are arranged from top to bottom.

Accessibility

Until GTK 4.10, the gtk:center-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

2024-10-1