GTK#

Container Widgets

Viewport

It is unlikely that you will ever need to use the Viewport widget directly. You are much more likely to use the Scrolled Window widget which itself uses the Viewport.

A viewport widget allows you to place a larger widget within it such that you can view a part of it at a time. It uses Adjustments to define the area that is currently in view.

A Viewport is created with the function

Viewport viewport1 = new Gtk.Viewport( Adjustment hadjustment,
                                       Adjustment vadjustment );
As you can see you can specify the horizontal and vertical Adjustments that the widget is to use when you create the widget. It will create its own if you pass "null" as the value of the arguments.

You can get and set the adjustments after the widget has been created using the following four functions:

Adjustment viewport1.Hadjustment;

Adjustment viewport1.Vadjustment;

viewport1.Hadjustment = Adjustment adjustment;

viewport1.Vadjustment = Adjustment adjustment;
The only other viewport function is used to alter its appearance:
void gtk_viewport_set_shadow_type( GtkViewport   *viewport,
                                   GtkShadowType  type );
Possible values for the type parameter are:
  Gtk.Shadow.None
  Gtk.Shadow.In
  Gtk.Shadow.Out
  Gtk.Shadow.EtchedIn
  Gtk.Shadow.EtchedOut