Basics
Guides
API Reference
Basics
Guides
API Reference
[246:14] static extends: object
Generated metadata helpers for Viewport class surfaces.
properties ()
Returns property metadata for
Viewport.
A list.[19:7] extends: object
Implements scrollability for widgets that don't support scrolling on their
own. Use GtkViewport to scroll child widgets such as GtkGrid, GtkBox,
and so on. The GtkViewport will start scrolling content only if allocated
less than the child widget’s minimum size in a given orientation. # CSS nodes
GtkViewport has a single CSS node with name viewport. # Accessibility
Until GTK 4.10, GtkViewport used the [enum@Gtk.AccessibleRole.group] role.
Starting from GTK 4.12, GtkViewport uses the
[enum@Gtk.AccessibleRole.generic] role.
Viewport (hadjustment = null, vadjustment = null)
Creates a new
GtkViewport. The new viewport uses the given adjustments, or default adjustments if none are given.
hadjustment is horizontal adjustment.vadjustment is vertical adjustment.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asWidget ()
Wraps this handle as
Widget.
A Widget object.asAccessible ()
Wraps this handle as
Accessible.
A Accessible object.asBuildable ()
Wraps this handle as
Buildable.
A Buildable object.asConstraintTarget ()
Wraps this handle as
ConstraintTarget.
A ConstraintTarget object.asScrollable ()
Wraps this handle as
Scrollable.
A Scrollable object.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setChild (object Value)
The child widget.
Value is the new property value.None.setScrolltofocus (bool Value)
Whether to scroll when the focus changes. Before 4.6.2, this property was mistakenly defaulting to FALSE, so if your code needs to work with older versions, consider setting it explicitly to TRUE.
Value is the new property value.None.get_child ()
Gets the child widget of @viewport.
get_scroll_to_focus ()
Gets whether the viewport is scrolling to keep the focused child in view.
scroll_to (object descendant, object scroll)
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.
descendant is a descendant widget of the viewport.scroll is details of how to perform the scroll operation or NULL to scroll into view.None.set_child (object child)
Sets the child widget of @viewport.
child is the child widget.None.set_scroll_to_focus (bool scroll_to_focus)
Sets whether the viewport should automatically scroll to keep the focused child in view.
scroll_to_focus is whether to keep the focus widget scrolled to view.None.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.