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

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.

Uml Diagram§

UNKNOWN image§

=for image :class<inline> :src<asset_files/images/plantuml/Viewport.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-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 )
Code
  • $hadjustment; horizontal adjustment.
  • $vadjustment; vertical adjustment.

Methods§

get-child§

Gets the child widget of $viewport.

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

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

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 )
Code
  • $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 )
Code
  • $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 )
Code
  • $scroll-to-focus; whether to keep the focus widget scrolled to view.