Gtk.Viewport
const Gtk = imports.gi.Gtk;
let viewport = new Gtk.Viewport({
shadow_type: value,
});
The Gtk.Viewport widget acts as an adaptor class, implementing scrollability for child widgets that lack their own scrolling capabilities. Use Gtk.Viewport to scroll child widgets such as Gtk.Grid, Gtk.Box, and so on.
If a widget has native scrolling abilities, such as Gtk.TextView, Gtk.TreeView or Gtk.IconView, it can be added to a Gtk.ScrolledWindow with Gtk.Container.prototype.add. If a widget does not, you must first add the widget to a Gtk.Viewport, then add the viewport to the scrolled window. Gtk.Container.prototype.add does this automatically if a child that does not implement Gtk.Scrollable is added to a Gtk.ScrolledWindow, so you can ignore the presence of the viewport.
The Gtk.Viewport will start scrolling content only if allocated less than the child widget's minimum size in a given orientation.
Hierarchy
-
GObject.Object
-
GObject.InitiallyUnowned
-
Gtk.Widget
-
Gtk.Container
-
Gtk.Bin
- Gtk.Viewport
-
-
-
-
Methods
- Gtk.Viewport.prototype.get_bin_window
- Gtk.Viewport.prototype.get_hadjustment
- Gtk.Viewport.prototype.get_shadow_type
- Gtk.Viewport.prototype.get_vadjustment
- Gtk.Viewport.prototype.get_view_window
- Gtk.Viewport.prototype.set_hadjustment
- Gtk.Viewport.prototype.set_shadow_type
- Gtk.Viewport.prototype.set_vadjustment