Tutorial
|
|
|
|
Viewports
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 can be created with one of the following constructors:
Viewport();
Viewport(Gtk::Adjustment *hadjustment, Gtk::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. The first constructor creates its own Adjustments.
You can set and get the adjustments after the viewport has been created
using the following four methods:
void
set_hadjustment(Gtk::Adjustment *adjustment);
void set_vadjustment(Gtk::Adjustment *adjustment);
Gtk::Adjustment* get_hadjustment() const;
Gtk::Adjustment* get_vadjustment() const;
|
The only other viewport method is used to alter its appearance:
void
set_shadow_type(Gtk::ShadowType type);
|
The type parameter can be one of the values in the Gtk::ShadowType
enumeration:
- SHADOW_NONE,
- SHADOW_IN,
- SHADOW_OUT,
- SHADOW_ETCHED_IN,
- SHADOW_ETCHED_OUT