About all my projects
Gnome::Gtk4::AspectFrame

Gnome::Gtk4::AspectFrame

Description

Gnome::Gtk4::AspectFrame preserves the aspect ratio of its child.

The frame can respect the aspect ratio of the child widget, or use its own aspect ratio.

CSS nodes

Gnome::Gtk4::AspectFrame uses a CSS node with name frame.

Accessibility

Until GTK 4.10, Gnome::Gtk4::AspectFrame used the GTK_ACCESSIBLE_ROLE_GROUP role.

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

Class initialization

new

:native-object

Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.

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

new-aspectframe

Create a new Gnome::Gtk4::AspectFrame.

method new-aspectframe ( Num() $xalign, Num() $yalign, Num() $ratio, Bool() $obey-child --> Gnome::Gtk4::AspectFrame \)
  • $xalign; Horizontal alignment of the child within the parent. Ranges from 0.0 (left aligned) to 1.0 (right aligned).

  • $yalign; Vertical alignment of the child within the parent. Ranges from 0.0 (top aligned) to 1.0 (bottom aligned).

  • $ratio; The desired aspect ratio..

  • $obey-child; If True, $ratio is ignored, and the aspect ratio is taken from the requistion of the child..

Methods

get-child

Gets the child widget of $self.

method get-child (--> N-Object )

Return value; the child widget of $self.

get-obey-child

Returns whether the child's size request should override the set aspect ratio of the Gnome::Gtk4::AspectFrame.

method get-obey-child (--> Bool )

Return value; whether to obey the child's size request.

get-ratio

Returns the desired aspect ratio of the child.

method get-ratio (--> Num )

Return value; the desired aspect ratio.

get-xalign

Returns the horizontal alignment of the child within the allocation of the Gnome::Gtk4::AspectFrame.

method get-xalign (--> Num )

Return value; the horizontal alignment.

get-yalign

Returns the vertical alignment of the child within the allocation of the Gnome::Gtk4::AspectFrame.

method get-yalign (--> Num )

Return value; the vertical alignment.

Example

# Example for get-yalign
my Num $yalign = $aspect-frame.get-yalign;

Note; In version 4.9.4 of Gtk 4 and before the value returned is that of xalign and not yalign. The value, however, is set correctly using .set-yalign.

set-child

Sets the child widget of $self.

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

set-obey-child

Sets whether the aspect ratio of the child's size request should override the set aspect ratio of the Gnome::Gtk4::AspectFrame.

method set-obey-child ( Bool() $obey-child )
  • $obey-child; If True, $ratio is ignored, and the aspect ratio is taken from the requisition of the child..

set-ratio

Sets the desired aspect ratio of the child.

method set-ratio ( Num() $ratio )
  • $ratio; aspect ratio of the child.

set-xalign

Sets the horizontal alignment of the child within the allocation of the Gnome::Gtk4::AspectFrame.

method set-xalign ( Num() $xalign )
  • $xalign; horizontal alignment, from 0.0 (left aligned) to 1.0 (right aligned).

set-yalign

Sets the vertical alignment of the child within the allocation of the Gnome::Gtk4::AspectFrame.

method set-yalign ( Num() $yalign )
  • $yalign; horizontal alignment, from 0.0 (top aligned) to 1.0 (bottom aligned).