Gnome::Gtk4::Viewport
Description
Gnome::Gtk4::Viewport implements scrollability for widgets that lack their own scrolling capabilities.
Use Gnome::Gtk4::Viewport to scroll child widgets such as Gnome::Gtk4::Grid, Gnome::Gtk4::Box, and so on.
The Gnome::Gtk4::Viewport will start scrolling content only if allocated less than the child widget’s minimum size in a given orientation.
CSS nodes
Gnome::Gtk4::Viewport has a single CSS node with name viewport.
Accessibility
Until GTK 4.10, Gnome::Gtk4::Viewport used the GTK_ACCESSIBLE_ROLE_GROUP role.
Starting from GTK 4.12, Gnome::Gtk4::Viewport 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-viewport
Creates a new Gnome::Gtk4::Viewport.
The new viewport uses the given adjustments, or default adjustments if none are given.
method new-viewport ( N-Object() $hadjustment, N-Object() $vadjustment --> Gnome::Gtk4::Viewport \)
$hadjustment; horizontal adjustment.
$vadjustment; vertical adjustment.
Methods
get-child
Gets the child widget of $viewport
.
method get-child (--> N-Object )
Return value; the child widget of $viewport
.
get-scroll-to-focus
Gets whether the viewport is scrolling to keep the focused child in view.
method get-scroll-to-focus (--> Bool )
Return value; True
if the viewport keeps the focus child scrolled to view.
scroll-to
Scrolls a descendant of the viewport into view.
The viewport and the descendant must be visible and mapped for this function to work, otherwise no scrolling will be performed.
method scroll-to ( N-Object() $descendant, N-Object $scroll )
$descendant; a descendant widget of the viewport.
$scroll; (transfer ownership: full) details of how to perform the scroll operation or NULL to scroll into view
set-child
Sets the child widget of $viewport
.
method set-child ( N-Object() $child )
$child; the child widget.
set-scroll-to-focus
Sets whether the viewport should automatically scroll to keep the focused child in view.
method set-scroll-to-focus ( Bool() $scroll-to-focus )
$scroll-to-focus; whether to keep the focus widget scrolled to view.