Viewport

The 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.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 Container.add. If a widget does not, you must first add the widget to a gtk.Viewport, then add the viewport to the scrolled window. Container.add does this automatically if a child that does not implement GtkScrollable is added to a gtk.ScrolledWindow, 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.

Constructors

this
this(GtkViewport* gtkViewport, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(Adjustment hadjustment, Adjustment vadjustment)

Creates a new gtk.Viewport with the given adjustments, or with default adjustments if none are given.

Members

Functions

getBinWindow
Window getBinWindow()

Gets the bin window of the gtk.Viewport

getHadjustment
Adjustment getHadjustment()

Returns the horizontal adjustment of the viewport.

getShadowType
GtkShadowType getShadowType()

Gets the shadow type of the gtk.Viewport See Viewport.setShadowType.

getStruct
void* getStruct()

the main Gtk struct as a void*

getVadjustment
Adjustment getVadjustment()

Returns the vertical adjustment of the viewport.

getViewWindow
Window getViewWindow()

Gets the view window of the gtk.Viewport

getViewportStruct
GtkViewport* getViewportStruct(bool transferOwnership)

Get the main Gtk struct

setHadjustment
void setHadjustment(Adjustment adjustment)

Sets the horizontal adjustment of the viewport.

setShadowType
void setShadowType(GtkShadowType type)

Sets the shadow type of the viewport.

setVadjustment
void setVadjustment(Adjustment adjustment)

Sets the vertical adjustment of the viewport.

Static functions

getType
GType getType()

Variables

gtkViewport
GtkViewport* gtkViewport;

the main Gtk struct

Inherited Members

From Bin

gtkBin
GtkBin* gtkBin;

the main Gtk struct

getBinStruct
GtkBin* getBinStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
getChild
Widget getChild()

Gets the child of the gtk.Bin, or NULL if the bin contains no child widget. The returned widget does not have a reference added, so you do not need to unref it.

From ScrollableIF

getScrollableStruct
GtkScrollable* getScrollableStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
getBorder
bool getBorder(Border border)

Returns the size of a non-scrolling border around the outside of the scrollable. An example for this would be treeview headers. GTK+ can use this information to display overlayed graphics, like the overshoot indication, at the right position.

getHadjustment
Adjustment getHadjustment()

Retrieves the gtk.Adjustment used for horizontal scrolling.

getHscrollPolicy
GtkScrollablePolicy getHscrollPolicy()

Gets the horizontal GtkScrollablePolicy

getVadjustment
Adjustment getVadjustment()

Retrieves the gtk.Adjustment used for vertical scrolling.

getVscrollPolicy
GtkScrollablePolicy getVscrollPolicy()

Gets the vertical GtkScrollablePolicy

setHadjustment
void setHadjustment(Adjustment hadjustment)

Sets the horizontal adjustment of the GtkScrollable

setHscrollPolicy
void setHscrollPolicy(GtkScrollablePolicy policy)

Sets the GtkScrollablePolicy to determine whether horizontal scrolling should start below the minimum width or below the natural width.

setVadjustment
void setVadjustment(Adjustment vadjustment)

Sets the vertical adjustment of the GtkScrollable

setVscrollPolicy
void setVscrollPolicy(GtkScrollablePolicy policy)

Sets the GtkScrollablePolicy to determine whether vertical scrolling should start below the minimum height or below the natural height.