The Gtk.Viewport.Gtk_Viewport widget acts as an adaptor class, implementing scrollability for child widgets that lack their own scrolling capabilities. Use GtkViewport to scroll child widgets such as Gtk.Grid.Gtk_Grid, Gtk.Box.Gtk_Box, and so on.
If a widget has native scrolling abilities, such as Gtk.Text_View.Gtk_Text_View, Gtk.Tree_View.Gtk_Tree_View or Gtk.Icon_View.Gtk_Icon_View, it can be added to a Gtk.Scrolled_Window.Gtk_Scrolled_Window with Gtk.Container.Add. If a widget does not, you must first add the widget to a Gtk.Viewport.Gtk_Viewport, then add the viewport to the scrolled window. Gtk.Container.Add does this automatically if a child that does not implement Gtk.Scrollable.Gtk_Scrollable is added to a Gtk.Scrolled_Window.Gtk_Scrolled_Window, so you can ignore the presence of the viewport.
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.
<group>Scrolling</group>
function "+"
(Widget : access Gtk_Viewport_Record'Class)
return Gtk.Buildable.Gtk_Buildable
function "+"
(Widget : access Gtk_Viewport_Record'Class)
return Gtk.Scrollable.Gtk_Scrollable
function "-"
(Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Viewport
function "-"
(Interf : Gtk.Scrollable.Gtk_Scrollable)
return Gtk_Viewport
function Get_Bin_Window
(Viewport : not null access Gtk_Viewport_Record) return Gdk.Gdk_Window
Gets the bin window of the Gtk.Viewport.Gtk_Viewport. Since: gtk+ 2.20
a Gdk.Gdk_Window
function Get_Border
(Self : not null access Gtk_Viewport_Record;
Border : access Gtk.Style.Gtk_Border) return Boolean
function Get_Hadjustment
(Self : not null access Gtk_Viewport_Record)
return Gtk.Adjustment.Gtk_Adjustment
function Get_Hscroll_Policy
(Self : not null access Gtk_Viewport_Record)
return Gtk.Enums.Gtk_Scrollable_Policy
function Get_Shadow_Type
(Viewport : not null access Gtk_Viewport_Record)
return Gtk.Enums.Gtk_Shadow_Type
Gets the shadow type of the Gtk.Viewport.Gtk_Viewport. See Gtk.Viewport.Set_Shadow_Type.
the shadow type
function Get_Type return Glib.GType
function Get_Vadjustment
(Self : not null access Gtk_Viewport_Record)
return Gtk.Adjustment.Gtk_Adjustment
function Get_View_Window
(Viewport : not null access Gtk_Viewport_Record) return Gdk.Gdk_Window
Gets the view window of the Gtk.Viewport.Gtk_Viewport. Since: gtk+ 2.22
a Gdk.Gdk_Window
function Get_Vscroll_Policy
(Self : not null access Gtk_Viewport_Record)
return Gtk.Enums.Gtk_Scrollable_Policy
procedure Gtk_New
(Viewport : out Gtk_Viewport;
Hadjustment : Gtk.Adjustment.Gtk_Adjustment := null;
Vadjustment : Gtk.Adjustment.Gtk_Adjustment := null)
Creates a new Gtk.Viewport.Gtk_Viewport with the given adjustments, or with default adjustments if none are given. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
horizontal adjustment
vertical adjustment
type Gtk_Viewport is access all Gtk_Viewport_Record'Class;
function Gtk_Viewport_New
(Hadjustment : Gtk.Adjustment.Gtk_Adjustment := null;
Vadjustment : Gtk.Adjustment.Gtk_Adjustment := null)
return Gtk_Viewport
Creates a new Gtk.Viewport.Gtk_Viewport with the given adjustments, or with default adjustments if none are given.
horizontal adjustment
vertical adjustment
type Gtk_Viewport_Record is new Gtk_Bin_Record with null record;
package Implements_Gtk_Buildable is new Glib.Types.Implements
(Gtk.Buildable.Gtk_Buildable, Gtk_Viewport_Record, Gtk_Viewport);
package Implements_Gtk_Scrollable is new Glib.Types.Implements
(Gtk.Scrollable.Gtk_Scrollable, Gtk_Viewport_Record, Gtk_Viewport);
procedure Initialize
(Viewport : not null access Gtk_Viewport_Record'Class;
Hadjustment : Gtk.Adjustment.Gtk_Adjustment := null;
Vadjustment : Gtk.Adjustment.Gtk_Adjustment := null)
Creates a new Gtk.Viewport.Gtk_Viewport with the given adjustments, or with default adjustments if none are given. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
horizontal adjustment
vertical adjustment
procedure Set_Hadjustment
(Self : not null access Gtk_Viewport_Record;
Hadjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class)
procedure Set_Hscroll_Policy
(Self : not null access Gtk_Viewport_Record;
Policy : Gtk.Enums.Gtk_Scrollable_Policy)
procedure Set_Shadow_Type
(Viewport : not null access Gtk_Viewport_Record;
The_Type : Gtk.Enums.Gtk_Shadow_Type)
Sets the shadow type of the viewport.
the new shadow type.
procedure Set_Vadjustment
(Self : not null access Gtk_Viewport_Record;
Vadjustment : access Gtk.Adjustment.Gtk_Adjustment_Record'Class)
procedure Set_Vscroll_Policy
(Self : not null access Gtk_Viewport_Record;
Policy : Gtk.Enums.Gtk_Scrollable_Policy)
Shadow_Type_Property : constant Gtk.Enums.Property_Gtk_Shadow_Type;