About my projects, examples and tutorials
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.

Uml Diagram§

UNKNOWN image§

=for image :class<inline> :src<asset_files/images/plantuml/AspectFrame.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-aspectframe§

Create a new Gnome::Gtk4::AspectFrame.

method new-aspectframe ( Num() $xalign, Num() $yalign, Num() $ratio, Bool() $obey-child --> Gnome::Gtk4::AspectFrame )
Code
  • $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 )
Code

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 )
Code

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

get-ratio§

Returns the desired aspect ratio of the child.

method get-ratio (--> Num )
Code

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 )
Code

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 )
Code

Return value; the vertical alignment.

Example§

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

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 )
Code
  • $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 )
Code
  • $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 )
Code
  • $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 )
Code
  • $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 )
Code
  • $yalign; horizontal alignment, from 0.0 (top aligned) to 1.0 (bottom aligned).