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

Gnome::Gtk4::Frame

Description§

Gnome::Gtk4::Frame is a widget that surrounds its child with a decorative frame and an optional label.

UNKNOWN image§

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

If present, the label is drawn inside the top edge of the frame. The horizontal position of the label can be controlled with .set-label-align().

Gnome::Gtk4::Frame clips its child. You can use this to add rounded corners to widgets, but be aware that it also cuts off shadows.

GtkFrame as GtkBuildable§

The Gnome::Gtk4::Frame implementation of the Gnome::Gtk4::R-Buildable interface supports placing a child in the label position by specifying ā€œlabelā€ as the ā€œtypeā€ attribute of a `<child>` element. A normal content child can be specified without specifying a `<child>` type attribute.

An example of a UI definition fragment with GtkFrame:

CSS nodes§

Gnome::Gtk4::Frame has a main CSS node with name ā€œframeā€, which is used to draw the visible border. You can set the appearance of the border using CSS properties like ā€œborder-styleā€ on this node.

Accessibility§

Gnome::Gtk4::Frame uses the GTK_ACCESSIBLE_ROLE_GROUP role.

Uml Diagram§

UNKNOWN image§

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

Creates a new Gnome::Gtk4::Frame, with optional label $label.

If $label is undefined, the label is omitted.

method new-frame ( Str $label --> Gnome::Gtk4::Frame )
Code
  • $label; the text to use as the label of the frame.

Methods§

get-child§

Gets the child widget of $frame.

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

Return value; the child widget of $frame.

get-label§

Returns the frame labels text.

If the frame's label widget is not a Gnome::Gtk4::Label, undefined is returned.

method get-label (--> Str )
Code

Return value; the text in the label, or undefined if there was no label widget or the label widget was not a Gnome::Gtk4::Label. This string is owned by GTK and must not be modified or freed..

get-label-align§

Retrieves the X alignment of the frame’s label.

method get-label-align (--> Num )
Code

Return value; the frames X alignment.

get-label-widget§

Retrieves the label widget for the frame.

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

Return value; the label widget.

set-child§

Sets the child widget of $frame.

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

set-label§

Creates a new Gnome::Gtk4::Label with the $label and sets it as the frame's label widget.

method set-label ( Str $label )
Code
  • $label; the text to use as the label of the frame.

set-label-align§

Sets the X alignment of the frame widget’s label.

The default value for a newly created frame is 0.0.

method set-label-align ( Num() $xalign )
Code
  • $xalign; The position of the label along the top edge of the widget. A value of 0.0 represents left alignment; 1.0 represents right alignment..

set-label-widget§

Sets the label widget for the frame.

This is the widget that will appear embedded in the top edge of the frame as a title.

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