Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: ViewportMeta

[246:14] static extends: object

Generated metadata helpers for Viewport class surfaces.

Methods

  • properties ()

    Returns property metadata for Viewport.

    • @r A list.

class: Viewport

[19:7] extends: object

Implements scrollability for widgets that don't support scrolling on their own. 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 Until GTK 4.10, GtkViewport used the [enum@Gtk.AccessibleRole.group] role. Starting from GTK 4.12, GtkViewport uses the [enum@Gtk.AccessibleRole.generic] role.

Members

  • handleObj
  • lib
  • retainedCallbacks
  • signalHandlerNames
  • signalSetterHandlers

Methods

  • Viewport (hadjustment = null, vadjustment = null)

    Creates a new GtkViewport. The new viewport uses the given adjustments, or default adjustments if none are given.

    • @p hadjustment is horizontal adjustment.
    • @p vadjustment is vertical adjustment.
  • toNativeHandle (Source)

    Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from fn.call(...), another generated wrapper exposing handle(), or null. Returns null when the argument carries no pointer.

    • @p Source is the raw handle, raw buffer, wrapper, or null.
    • @r A raw pointer carrier or null when no pointer is present.
  • getLib ()

    Returns the opened native library for this generated wrapper.

    • @r The opened native library.
  • handle ()

    Returns the wrapped NativeHandle.

    • @r The wrapped NativeHandle.
  • isNull ()

    Returns true when the wrapped handle is null.

    • @r A bool.
  • describe ()

    Returns a small string for debugging generated wrappers.

    • @r A string.
  • asWidget ()

    Wraps this handle as Widget.

    • @r A Widget object.
  • asAccessible ()

    Wraps this handle as Accessible.

    • @r A Accessible object.
  • asBuildable ()

    Wraps this handle as Buildable.

    • @r A Buildable object.
  • asConstraintTarget ()

    Wraps this handle as ConstraintTarget.

    • @r A ConstraintTarget object.
  • asScrollable ()

    Wraps this handle as Scrollable.

    • @r A Scrollable object.
  • getProperty (string Name)

    Reads one generated property by name.

  • setProperty (string Name, Value)

    Writes one generated property by name.

  • setChild (object Value)

    The child widget.

    • @p Value is the new property value.
    • @r None.
  • setScrolltofocus (bool Value)

    Whether to scroll when the focus changes. Before 4.6.2, this property was mistakenly defaulting to FALSE, so if your code needs to work with older versions, consider setting it explicitly to TRUE.

    • @p Value is the new property value.
    • @r None.
  • get_child ()

    Gets the child widget of @viewport.

  • get_scroll_to_focus ()

    Gets whether the viewport is scrolling to keep the focused child in view.

  • scroll_to (object descendant, object scroll)

    Scrolls a descendant of the viewport into view. The viewport and the descendant must be visible and mapped for this function to work, otherwise no scrolling will be performed.

    • @p descendant is a descendant widget of the viewport.
    • @p scroll is details of how to perform the scroll operation or NULL to scroll into view.
    • @r None.
  • set_child (object child)

    Sets the child widget of @viewport.

    • @p child is the child widget.
    • @r None.
  • set_scroll_to_focus (bool scroll_to_focus)

    Sets whether the viewport should automatically scroll to keep the focused child in view.

    • @p scroll_to_focus is whether to keep the focus widget scrolled to view.
    • @r None.