Object Hierarchy:

Object hierarchy for CenterBox


[ CCode ( type_id = "gtk_center_box_get_type ()" ) ]
public class CenterBox : Widget, Accessible, Buildable, ConstraintTarget, Orientable

The GtkCenterBox widget arranges three children in a horizontal or vertical arrangement, keeping the middle child centered as well as possible.

To add children to GtkCenterBox, use set_start_widget, set_center_widget and set_end_widget.

The sizing and positioning of children can be influenced with the align and expand properties of the children.

GtkCenterBox as GtkBuildable

The GtkCenterBox implementation of the 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

GtkCenterBox uses a single CSS node with the name “box”,

The first child of the 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.


GtkCenterBox uses the gtk_accessible_role_group role.

Namespace: Gtk
Package: gtk4



Creation methods:


Inherited Members:

All known members inherited from class Gtk.Widget
All known members inherited from interface Gtk.Orientable