Class

GtkViewport

[]

Description [src]

final class Gtk.Viewport : Gtk.Widget
  implements Gtk.Accessible, Gtk.Buildable, Gtk.ConstraintTarget, Gtk.Scrollable {
  /* No available fields */
}

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 GTK_ACCESSIBLE_ROLE_GROUP role.

Starting from GTK 4.12, GtkViewport uses the GTK_ACCESSIBLE_ROLE_GENERIC role.

[]

Hierarchy

hierarchy this GtkViewport implements_0 GtkAccessible this--implements_0 implements_1 GtkBuildable this--implements_1 implements_2 GtkConstraintTarget this--implements_2 implements_3 GtkScrollable this--implements_3 ancestor_0 GtkWidget ancestor_0--this ancestor_1 GInitiallyUnowned ancestor_1--ancestor_0 ancestor_2 GObject ancestor_2--ancestor_1
[]

Constructors

gtk_viewport_new

Creates a new GtkViewport.

[]

Instance methods

gtk_viewport_get_child

Gets the child widget of viewport.

gtk_viewport_get_scroll_to_focus

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

gtk_viewport_scroll_to

Scrolls a descendant of the viewport into view.

since: 4.12

gtk_viewport_set_child

Sets the child widget of viewport.

gtk_viewport_set_scroll_to_focus

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

Methods inherited from GtkWidget (164)
Methods inherited from GObject (43)
Methods inherited from GtkAccessible (20)
Methods inherited from GtkBuildable (1)
Methods inherited from GtkScrollable (9)
[]

Properties

Gtk.Viewport:child

The child widget.

Gtk.Viewport:scroll-to-focus

Whether to scroll when the focus changes.

Properties inherited from GtkWidget (35)
Properties inherited from GtkAccessible (1)
Properties inherited from GtkScrollable (4)
[]

Signals

Signals inherited from GtkWidget (13)
Signals inherited from GObject (1)