Class

GtkBox

[]

Description [src]

class Gtk.Box : Gtk.Widget
  implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Orientable {
  /* No available fields */
}

The GtkBox widget arranges child widgets into a single row or column.

An example GtkBox

Whether it is a row or column depends on the value of its GtkOrientable:orientation property. Within the other dimension, all children are allocated the same size. Of course, the GtkWidget:halign and GtkWidget:valign properties can be used on the children to influence their allocation.

Use repeated calls to gtk_box_append() to pack widgets into a GtkBox from start to end. Use gtk_box_remove() to remove widgets from the GtkBox. gtk_box_insert_child_after() can be used to add a child at a particular position.

Use gtk_box_set_homogeneous() to specify whether or not all children of the GtkBox are forced to get the same amount of space.

Use gtk_box_set_spacing() to determine how much space will be minimally placed between all children in the GtkBox. Note that spacing is added between the children.

Use gtk_box_reorder_child_after() to move a child to a different place in the box.

CSS nodes

GtkBox uses a single CSS node with name box.

Accessibility

Until GTK 4.10, GtkBox used the GTK_ACCESSIBLE_ROLE_GROUP role.

Starting from GTK 4.12, GtkBox uses the GTK_ACCESSIBLE_ROLE_GENERIC role.

[]

Hierarchy

hierarchy this GtkBox implements_0 GtkAccessible this--implements_0 implements_1 GtkBuildable this--implements_1 implements_2 GtkConstraintTarget this--implements_2 implements_3 GtkOrientable this--implements_3 ancestor_0 GtkWidget ancestor_0--this ancestor_1 GInitiallyUnowned ancestor_1--ancestor_0 ancestor_2 GObject ancestor_2--ancestor_1
[]

Constructors

gtk_box_new

Creates a new GtkBox.

[]

Instance methods

gtk_box_append

Adds child as the last child to box.

gtk_box_get_baseline_child

Gets the value set by gtk_box_set_baseline_child().

since: 4.12

gtk_box_get_baseline_position

Gets the value set by gtk_box_set_baseline_position().

gtk_box_get_homogeneous

Returns whether the box is homogeneous (all children are the same size).

gtk_box_get_spacing

Gets the value set by gtk_box_set_spacing().

gtk_box_insert_child_after

Inserts child in the position after sibling in the list of box children.

gtk_box_prepend

Adds child as the first child to box.

gtk_box_remove

Removes a child widget from box.

gtk_box_reorder_child_after

Moves child to the position after sibling in the list of box children.

gtk_box_set_baseline_child

Sets the baseline child of a box.

since: 4.12

gtk_box_set_baseline_position

Sets the baseline position of a box.

gtk_box_set_homogeneous

Sets whether or not all children of box are given equal space in the box.

gtk_box_set_spacing

Sets the number of pixels to place between children of box.

Methods inherited from GtkWidget (162)
Methods inherited from GObject (43)
Methods inherited from GtkAccessible (19)
Methods inherited from GtkBuildable (1)
Methods inherited from GtkOrientable (2)
[]

Properties

Gtk.Box:baseline-child

The child that determines the baseline, in vertical orientation.

since: 4.12

Gtk.Box:baseline-position

The position of the baseline aligned widgets if extra space is available.

Gtk.Box:homogeneous

Whether the children should all be the same size.

Gtk.Box:spacing

The amount of space between children.

Properties inherited from GtkWidget (34)
Properties inherited from GtkAccessible (1)
Properties inherited from GtkOrientable (1)
[]

Signals

Signals inherited from GtkWidget (13)
Signals inherited from GObject (1)

Class structure