Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: CenterBox

[31:7] extends: object

Arranges three children in a row, keeping the middle child centered as well as possible. An example GtkCenterBox To add children to GtkCenterBox, use [method@Gtk.CenterBox.set_start_widget], [method@Gtk.CenterBox.set_center_widget] and [method@Gtk.CenterBox.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 GtkBuildable 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 GtkCenterBox 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, GtkCenterBox used the [enum@Gtk.AccessibleRole.group] role. Starting from GTK 4.12, GtkCenterBox uses the [enum@Gtk.AccessibleRole.generic] role.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • CenterBox ()

    Creates a new GtkCenterBox.

  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asWidget ()

    Wraps this handle as Widget.

    • @r A Widget object.
  • asAccessible ()

    Wraps this handle as Accessible.

    • @r A Accessible object.
  • asBuildable ()

    Wraps this handle as Buildable.

    • @r A Buildable object.
  • asConstraintTarget ()

    Wraps this handle as ConstraintTarget.

    • @r A ConstraintTarget object.
  • asOrientable ()

    Wraps this handle as Orientable.

    • @r A Orientable object.
  • getProperty (string Name)

    Reads one generated property by name.

  • setProperty (string Name, Value)

    Writes one generated property by name.

  • setBaselineposition (string Value)

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

    • @p Value is the new property value.
    • @r None.
  • setCenterwidget (object Value)

    The widget that is placed at the center position.

    • @p Value is the new property value.
    • @r None.
  • setEndwidget (object Value)

    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.

    • @p Value is the new property value.
    • @r None.
  • setShrinkcenterlast (bool Value)

    Whether to shrink the center widget after other children. By default, when there's 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 false, start and end widgets keep natural width and the center widget starts shrinking instead.

    • @p Value is the new property value.
    • @r None.
  • setStartwidget (object Value)

    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.

    • @p Value is the new property value.
    • @r None.
  • get_baseline_position ()

    Gets the baseline position of the center box. See [method@Gtk.CenterBox.set_baseline_position].

  • get_center_widget ()

    Gets the center widget.

  • get_end_widget ()

    Gets the end widget.

  • get_shrink_center_last ()

    Gets whether the center widget shrinks after other children.

  • get_start_widget ()

    Gets the start widget.

  • set_baseline_position (string position)

    Sets the baseline position of a center box. This affects only horizontal boxes with at least one baseline aligned child. If there is more vertical space available than requested, and the baseline is not allocated by the parent then @position is used to allocate the baseline with respect to the extra space available.

    • @p position is the baseline position.
    • @r None.
  • set_center_widget (object child)

    Sets the center widget. To remove the existing center widget, pass NULL.

    • @p child is the new center widget.
    • @r None.
  • set_end_widget (object child)

    Sets the end widget. To remove the existing end widget, pass NULL.

    • @p child is the new end widget.
    • @r None.
  • set_shrink_center_last (bool shrink_center_last)

    Sets whether to shrink the center widget after other children. By default, when there's 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

    • @shrink_center_last is false, start and end widgets keep natural width and the center widget starts shrinking instead.
    • @p shrink_center_last is whether to shrink the center widget after others.
    • @r None.
  • set_start_widget (object child)

    Sets the start widget. To remove the existing start widget, pass NULL.

    • @p child is the new start widget.
    • @r None.

class: CenterBoxMeta

[348:14] static extends: object

Generated metadata helpers for CenterBox class surfaces.

Methods

  • properties ()

    Returns property metadata for CenterBox.

    • @r A list.