Gnome::Gtk4::Frame
Description
Gnome::Gtk4::Frame is a widget that surrounds its child with a decorative frame and an optional label.
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.
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-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 \)
$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 )
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 )
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 )
Return value; the frames X alignment.
get-label-widget
Retrieves the label widget for the frame.
method get-label-widget (--> N-Object )
Return value; the label widget.
set-child
Sets the child widget of $frame
.
method set-child ( N-Object() $child )
$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 )
$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 )
$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 )
$label-widget; the new label widget.