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

GtkWidget *gtk_viewport_new( GtkAdjustment *hadjustment,
                             GtkAdjustment *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:

GtkAdjustment *gtk_viewport_get_hadjustment( GtkViewport *viewport );

GtkAdjustment *gtk_viewport_get_vadjustment( GtkViewport *viewport );

void gtk_viewport_set_hadjustment( GtkViewport   *viewport,
                                   GtkAdjustment *adjustment );

void gtk_viewport_set_vadjustment( GtkViewport   *viewport,
                                   GtkAdjustment *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: