About my projects, examples and tutorials
Gnome::Gtk4::CenterBox

Gnome::Gtk4::CenterBox

Description§

Gnome::Gtk4::CenterBox arranges three children in a row, keeping the middle child centered as well as possible.

UNKNOWN image§

=for image :class<inline> :src<asset_files/images/centerbox.png> :width<30\%>

To add children to Gnome::Gtk4::CenterBox, 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 Gnome::Gtk4::CenterBox implementation of the Gnome::Gtk4::R-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§

Gnome::Gtk4::CenterBox uses a single CSS node with the name ā€œboxā€,

The first child of the Gnome::Gtk4::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, Gnome::Gtk4::CenterBox used the GTK_ACCESSIBLE_ROLE_GROUP role.

Starting from GTK 4.12, Gnome::Gtk4::CenterBox uses the GTK_ACCESSIBLE_ROLE_GENERIC role.

Uml Diagram§

UNKNOWN image§

=for image :class<inline> :src<asset_files/images/plantuml/CenterBox.png> :width<70\%>

Class initialization§

new§

:native-object§

Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object() :$native-object! )
Code

new-centerbox§

Creates a new Gnome::Gtk4::CenterBox.

method new-centerbox ( --> Gnome::Gtk4::CenterBox )
Code

Methods§

get-baseline-position§

Gets the value set by .set-baseline-position().

method get-baseline-position (--> GtkBaselinePosition )
Code

Return value; the baseline position.

get-center-widget§

Gets the center widget, or undefined if there is none.

method get-center-widget (--> N-Object )
Code

Return value; the center widget..

get-end-widget§

Gets the end widget, or undefined if there is none.

method get-end-widget (--> N-Object )
Code

Return value; the end widget..

get-shrink-center-last§

Gets whether $self shrinks the center widget after other children.

method get-shrink-center-last (--> Bool )
Code

Return value; whether to shrink the center widget after others.

get-start-widget§

Gets the start widget, or undefined if there is none.

method get-start-widget (--> N-Object )
Code

Return value; the start widget..

set-baseline-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 wrt. the extra space available.

method set-baseline-position ( GtkBaselinePosition $position )
Code
  • $position; a enumeration GtkBaselinePosition defined in Gnome::Gtk4::T-enums.

set-center-widget§

Sets the center widget.

To remove the existing center widget, pass undefined.

method set-center-widget ( N-Object() $child )
Code
  • $child; the new center widget.

set-end-widget§

Sets the end widget.

To remove the existing end widget, pass undefined.

method set-end-widget ( N-Object() $child )
Code
  • $child; the new end widget.

set-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 set to False, start and end widgets keep natural width and the center widget starts shrinking instead.

method set-shrink-center-last ( Bool() $shrink-center-last )
Code
  • $shrink-center-last; whether to shrink the center widget after others.

set-start-widget§

Sets the start widget.

To remove the existing start widget, pass undefined.

method set-start-widget ( N-Object() $child )
Code
  • $child; the new start widget.