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 _getGType() static nothrow
GType _gType() @property nothrow
Viewport self() nothrowReturns `this`, for use in `with` statements.
ViewportGidBuilder builder() static nothrowGet builder for [gtk.viewport.Viewport] Returns: New builder object
gtk.widget.Widget child() @property nothrowGet `child` property. Returns: The child widget.
void child(gtk.widget.Widget propval) @property nothrowSet `child` property. Params: propval = The child widget.
bool scrollToFocus() @property nothrowGet `scrollToFocus` property. Returns: Whether to scroll when the focus changes.
void scrollToFocus(bool propval) @property nothrowSet `scrollToFocus` property. Params: propval = Whether to scroll when the focus changes.
gtk.widget.Widget getChild() nothrowGets the child widget of viewport. Returns: the child widget of viewport
bool getScrollToFocus() nothrowGets 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) nothrowScrolls a descendant of the viewport into view.
void setChild(gtk.widget.Widget child = null) nothrowSets the child widget of viewport.
void setScrollToFocus(bool scrollToFocus) nothrowSets 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) nothrowSet `child` property. Params: propval = The child widget. Returns: Builder instance for fluent chaining
T scrollToFocus(bool propval) nothrowSet `scrollToFocus` property. Params: propval = Whether to scroll when the focus changes.

Fluent builder for gtk.viewport.Viewport

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