Xfce Foundation Classes
 « Main Page | Index

Viewports


It is unlikely that you will ever need to use the Viewport widget directly. You are much more likely to use the ScrolledWindow 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 Adjustment widgets 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);

The first constructor creates its own default Adjustments. The second constructor lets you specify the horizontal and vertical Adjustments that the Viewport should use.

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 from the Gtk::ShadowType enum:
  • SHADOW_NONE,
  • SHADOW_IN,
  • SHADOW_OUT,
  • SHADOW_ETCHED_IN,
  • SHADOW_ETCHED_OUT
See also the ScrolledWindow example.


Copyright © 2004-2005 The XFC Development Team Top
XFC 4.4