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
GType _gType() @property
Viewport self()Returns `this`, for use in `with` statements.
ViewportGidBuilder builder()Get builder for [gtk.viewport.Viewport] Returns: New builder object
gtk.widget.Widget child() @propertyGet `child` property. Returns: The child widget.
void 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 viewport
bool 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 view
void 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(void * ptr, Flag!"Take" take)
this(gtk.adjustment.Adjustment hadjustment = null, gtk.adjustment.Adjustment vadjustment = null)Creates a new [gtk.viewport.Viewport].

Fluent builder implementation template for gtk.viewport.Viewport

Methods
T child(gtk.widget.Widget propval)Set `child` property. Params: propval = The child widget. Returns: Builder instance for fluent chaining
T scrollToFocus(bool propval)Set `scrollToFocus` property. Params: propval = Whether to scroll when the focus changes.

Fluent builder for gtk.viewport.Viewport

Methods
Viewport build()Create object from builder. Returns: New object