The
gtk-viewport widget acts as an adaptor class, implementing
scrollability for child widgets that lack their own scrolling capabilities. Use the
gtk-viewport widget to scroll child widgets such as the widgets
gtk-grid,
gtk-box, and so on.
If a widget has native scrolling abilities, such as the widgets
gtk-text-view,
gtk-tree-view or
gtk-icon-view, it can be added to a
gtk-scrolled-window widget with the function
gtk-container-add. If a widget does not, you must first add the widget to a
gtk-viewport widget, then add the viewport to the scrolled window. The function
gtk-container-add does this automatically if a child that does not implement the
gtk-scrollable interface is added to a
gtk-scrolled-window widget, so you can ignore the presence of the
viewport.
The
gtk-viewport widget will start scrolling content only if allocated
less than the child widget's minimum size in a given orientation.
CSS nodes
The
gtk-viewport widget has a single CSS node with name
viewport.