gtk.center_box

Module for [CenterBox] class

Types 3

[gtk.center_box.CenterBox] arranges three children in a row, keeping the middle child centered as well as possible.

!An example GtkCenterBox

To add children to [gtk.center_box.CenterBox], use [gtk.center_box.CenterBox.setStartWidget], [gtk.center_box.CenterBox.setCenterWidget] and [gtk.center_box.CenterBox.setEndWidget].

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.CenterBox] implementation of the [gtk.buildable.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

[gtk.center_box.CenterBox] uses a single CSS node with the name “box”,

The first child of the [gtk.center_box.CenterBox] will be allocated depending on the text direction, i.e. 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, [gtk.center_box.CenterBox] used the [gtk.types.AccessibleRole.Group] role.

Starting from GTK 4.12, [gtk.center_box.CenterBox] uses the [gtk.types.AccessibleRole.Generic] role.

Methods
GType _gType() @property
CenterBox self()Returns `this`, for use in `with` statements.
CenterBoxGidBuilder builder()Get builder for [gtk.center_box.CenterBox] Returns: New builder object
gtk.types.BaselinePosition baselinePosition() @propertyGet `baselinePosition` property. Returns: The position of the baseline aligned widget if extra space is available.
void baselinePosition(gtk.types.BaselinePosition propval) @propertySet `baselinePosition` property. Params: propval = The position of the baseline aligned widget if extra space is available.
gtk.widget.Widget centerWidget() @propertyGet `centerWidget` property. Returns: The widget that is placed at the center position.
void centerWidget(gtk.widget.Widget propval) @propertySet `centerWidget` property. Params: propval = The widget that is placed at the center position.
gtk.widget.Widget endWidget() @propertyGet `endWidget` property. Returns: The widget that is placed at the end position.
void endWidget(gtk.widget.Widget propval) @propertySet `endWidget` property. Params: propval = The widget that is placed at the end position.
bool shrinkCenterLast() @propertyGet `shrinkCenterLast` property. Returns: Whether to shrink the center widget after other children.
void shrinkCenterLast(bool propval) @propertySet `shrinkCenterLast` property. Params: propval = Whether to shrink the center widget after other children.
gtk.widget.Widget startWidget() @propertyGet `startWidget` property. Returns: The widget that is placed at the start position.
void startWidget(gtk.widget.Widget propval) @propertySet `startWidget` property. Params: propval = The widget that is placed at the start position.
gtk.types.BaselinePosition getBaselinePosition()Gets the value set by [gtk.center_box.CenterBox.setBaselinePosition]. Returns: the baseline position
gtk.widget.Widget getCenterWidget()Gets the center widget, or null if there is none. Returns: the center widget.
gtk.widget.Widget getEndWidget()Gets the end widget, or null if there is none. Returns: the end widget.
bool getShrinkCenterLast()Gets whether self shrinks the center widget after other children. Returns: whether to shrink the center widget after others
gtk.widget.Widget getStartWidget()Gets the start widget, or null if there is none. Returns: the start widget.
void setBaselinePosition(gtk.types.BaselinePosition position)Sets the baseline position of a center box.
void setCenterWidget(gtk.widget.Widget child = null)Sets the center widget.
void setEndWidget(gtk.widget.Widget child = null)Sets the end widget.
void setShrinkCenterLast(bool shrinkCenterLast)Sets whether to shrink the center widget after other children.
void setStartWidget(gtk.widget.Widget child = null)Sets the start widget.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new [gtk.centerbox.CenterBox]. Returns: the new [gtk.centerbox.CenterBox].
Methods
T baselinePosition(gtk.types.BaselinePosition propval)Set `baselinePosition` property. Params: propval = The position of the baseline aligned widget if extra space is available. Returns: Builder instance for fluent chaining
T centerWidget(gtk.widget.Widget propval)Set `centerWidget` property. Params: propval = The widget that is placed at the center position. Returns: Builder instance for fluent chaining
T endWidget(gtk.widget.Widget propval)Set `endWidget` property. Params: propval = The widget that is placed at the end position.
T shrinkCenterLast(bool propval)Set `shrinkCenterLast` property. Params: propval = Whether to shrink the center widget after other children.
T startWidget(gtk.widget.Widget propval)Set `startWidget` property. Params: propval = The widget that is placed at the start position.

Fluent builder for [gtk.center_box.CenterBox]

Methods