gtk.viewport
Module for [Viewport] class
Types 3
[gtk.viewport.Viewport] implements scrollability for widgets that lack their own scrolling capabilities.
Use [gtk.viewport.Viewport] to scroll child widgets such as [gtk.grid.Grid], [gtk.box.Box], and so on.
The [gtk.viewport.Viewport] will start scrolling content only if allocated less than the child widget’s minimum size in a given orientation.
CSS nodes
[gtk.viewport.Viewport] has a single CSS node with name viewport.
Accessibility
Until GTK 4.10, [gtk.viewport.Viewport] used the [gtk.types.AccessibleRole.Group] role.
Starting from GTK 4.12, [gtk.viewport.Viewport] uses the [gtk.types.AccessibleRole.Generic] role.
Methods
ViewportGidBuilder builder()Get builder for [gtk.viewport.Viewport] Returns: New builder objectvoid child(gtk.widget.Widget propval) @propertySet `child` property. Params: propval = The child widget.bool scrollToFocus() @propertyGet `scrollToFocus` property. Returns: Whether to scroll when the focus changes.void scrollToFocus(bool propval) @propertySet `scrollToFocus` property. Params: propval = Whether to scroll when the focus changes.gtk.widget.Widget getChild()Gets the child widget of viewport. Returns: the child widget of viewportbool getScrollToFocus()Gets whether the viewport is scrolling to keep the focused child in view. Returns: true if the viewport keeps the focus child scrolled to viewvoid scrollTo(gtk.widget.Widget descendant, gtk.scroll_info.ScrollInfo scroll = null)Scrolls a descendant of the viewport into view.void setChild(gtk.widget.Widget child = null)Sets the child widget of viewport.void setScrollToFocus(bool scrollToFocus)Sets whether the viewport should automatically scroll to keep the focused child in view.Constructors
this(gtk.adjustment.Adjustment hadjustment = null, gtk.adjustment.Adjustment vadjustment = null)Creates a new [gtk.viewport.Viewport].classViewportGidBuilderImpl(T) : gtk.widget.WidgetGidBuilderImpl!T, gtk.scrollable.ScrollableGidBuilderImpl!T
Methods
T child(gtk.widget.Widget propval)Set `child` property. Params: propval = The child widget. Returns: Builder instance for fluent chainingT scrollToFocus(bool propval)Set `scrollToFocus` property. Params: propval = Whether to scroll when the focus changes.