Class Viewport

All Implemented Interfaces:
PointerInterface

public class Viewport extends Widget
`GtkViewport` implements scrollability for widgets that lack their
own scrolling capabilities.

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

`GtkViewport` uses the %GTK_ACCESSIBLE_ROLE_GROUP role.

https://docs.gtk.org/gtk4/class.Viewport.html

  • Constructor Details

    • Viewport

      public Viewport(PointerContainer pointer)
    • Viewport

      public Viewport(@Nullable Adjustment hadjustment, @Nullable Adjustment vadjustment)
      Creates a new `GtkViewport`.

      The new viewport uses the given adjustments, or default
      adjustments if none are given.
      Parameters:
      hadjustment - horizontal adjustment
      vadjustment - vertical adjustment
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getChild

      public Widget getChild()
      Gets the child widget of @viewport.
      Returns:
      the child widget of @viewport
    • getScrollToFocus

      public boolean 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
    • setChild

      public void setChild(@Nullable Widget child)
      Sets the child widget of @viewport.
      Parameters:
      child - the child widget
    • setScrollToFocus

      public void setScrollToFocus(boolean scroll_to_focus)
      Sets whether the viewport should automatically scroll
      to keep the focused child in view.
      Parameters:
      scroll_to_focus - whether to keep the focus widget scrolled to view
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class Widget
      Returns:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class Widget
      Returns:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class Widget
      Returns:
      ConstraintTarget
    • asScrollable

      public Scrollable asScrollable()
      Implements interface Scrollable. Call this to get access to interface functions.
      Returns:
      Scrollable
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()