Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Public Member Functions
Xfc::Gtk::ScrolledWindow Class Reference

A GtkScrolledWindow C++ wrapper class. More...

#include <xfc/gtk/scrolledwindow.hh>

Inheritance diagram for Xfc::Gtk::ScrolledWindow:
Xfc::Gtk::Bin Xfc::Gtk::Container Xfc::Gtk::Widget Xfc::Gtk::Object Xfc::Atk::Implementor Xfc::G::Object Xfc::G::TypeInterface Xfc::G::TypeInstance Xfc::G::TypeInstance Xfc::Trackable Xfc::Trackable

List of all members.

Public Member Functions

Constructors


Detailed Description

A GtkScrolledWindow C++ wrapper class.

ScrolledWindow is a Bin subclass: it's a container that holds a single child widget. ScrolledWindow adds scrollbars to the child widget and optionally draws a beveled frame around the child widget.

The scrolled window can work in two ways. Some widgets have native scrolling support; these widgets have "slots" for Adjustment objects. The scrolled window installs Adjustment objects in the child window's slots using the set_scroll_adjustments_signal. Widgets with native scroll support include TreeView, TextView, and Layout.

For widgets that lack native scrolling support, the Viewport widget acts as an adaptor class, implementing scrollability for child widgets that lack their own scrolling capabilities. Use Viewport to scroll child widgets such as Table, Box, and so on.

If a widget has native scrolling abilities, it can be added to the ScrolledWindow with Gtk::Container::add(). If a widget does not, you must first add the widget to a Viewport, then add the Viewport to the scrolled window. The convenience function add_with_viewport() does exactly this, so you can ignore the presence of the viewport.

The position of the scrollbars is controlled by the scroll adjustments. See Adjustment for the fields in an adjustment - for Scrollbar, used by ScrolledWindow, the "value" field represents the position of the scrollbar, which must be between the lower field and upper - page_size. The page_size field represents the size of the visible scrollable area. The step_increment and "page_increment" fields are used when the user asks to step down (using the small stepper arrows) or page down (using for example the Page Down key).

If a ScrolledWindow doesn't behave quite as you would like, or doesn't have exactly the right layout, it's very possible to set up your own scrolling with Scrollbar and for example a Table.

See also: the ScrolledWindow and Viewport HOWTOs.


Constructor & Destructor Documentation

Xfc::Gtk::ScrolledWindow::ScrolledWindow ( GtkScrolledWindow *  scrolled_window,
bool  owns_reference = false 
) [explicit, protected]

Construct a new ScrolledWindow from an existing GtkScrolledWindow.

Parameters:
scrolled_windowA pointer to a GtkScrolledWindow.
owns_referenceSet false if the initial reference count is floating, set true if it's not.

The scrolled_window can be a newly created GtkScrolledWindow or an existing GtkScrolledWindow (see G::Object::Object).

Xfc::Gtk::ScrolledWindow::ScrolledWindow ( )

Construct a new scrolled window.

The scrolled window will create both adjustments for you. The adjustments can be retrieved by calling get_hadjustment() and get_vadjustment().

Xfc::Gtk::ScrolledWindow::ScrolledWindow ( Adjustment hadjustment,
Adjustment vadjustment 
)

Construct a new scrolled window with the specified adjustments.

Parameters:
hadjustmentThe Horizontal adjustment.
vadjustmentThe Vertical adjustment.

The two adjustments will be shared with the scrollbars and the child widget to keep the bars in sync with the child. If you pass null for an adjustment the scrolled window will create that adjustment for you.


Member Function Documentation

Used to add children without native scrolling capabilities.

Parameters:
childThe wdget you want to scroll.

This is simply a convenience function; it is equivalent to adding the unscrollable child to a viewport, then adding the viewport to the scrolled window. If a child has native scrolling, use Gtk::Container::add() instead of this function. The viewport scrolls the child by moving its Gdk::Window, and takes the size of the child to be the size of its toplevel Gdk::Window. This will be very wrong for most widgets that support native scrolling; for example, if you add a widget such as TreeView with a viewport, the whole widget will scroll, including the column headings. Thus, widgets with native scrolling support should not be used with the Viewport proxy.

A widget supports scrolling natively if the set_scroll_adjustments_signal is declared in its class declaration.

Returns the horizontal scrollbar's adjustment, used to connect the horizontal scrollbar to the child widget's horizontal scroll functionality.

Returns:
The horizontal Adjustment.

Gets the placement of the scrollbars for the scrolled window (see set_placement()).

Returns:
The current placement value.
void Xfc::Gtk::ScrolledWindow::get_policy ( PolicyType hscrollbar_policy,
PolicyType vscrollbar_policy 
) const

Retrieves the current policy values for the horizontal and vertical scrollbars (see set_policy()).

Parameters:
hscrollbar_policyThe location to store the policy for the horizontal scrollbar, or null.
vscrollbar_policyThe location to store the policy for the horizontal scrollbar, or null.

Gets the shadow type of the scrolled window (see set_shadow_type()).

Returns:
The current shadow type.

Returns the vertical scrollbar's adjustment, used to connect the vertical scrollbar to the child widget's vertical scroll functionality.

Returns:
The vertical Adjustment.

Sets the Adjustment for the horizontal scrollbar.

Parameters:
hadjustmentThe horizontal scroll adjustment.

Determines the location of the child widget with respect to the scrollbars.

Parameters:
window_placementThe position of the child window.

The default is CORNER_TOP_LEFT, meaning the child is in the top left, with the scrollbars underneath and to the right. Other values in CornerType are CORNER_TOP_RIGHT, CORNER_BOTTOM_LEFT, and CORNER_BOTTOM_RIGHT.

void Xfc::Gtk::ScrolledWindow::set_policy ( PolicyType  hscrollbar_policy,
PolicyType  vscrollbar_policy 
)

Sets the scrollbar policy for the horizontal and vertical scrollbars.

Parameters:
hscrollbar_policyThe policy for horizontal bar.
vscrollbar_policyThe policy for vertical bar.

The policy determines when the scrollbar should appear; it is a value from the Gtk::PolicyType enumeration. If POLICY_ALWAYS, the scrollbar is always present; if POLICY_NEVER, the scrollbar is never present; if POLICY_AUTOMATIC, the scrollbar is present only if needed (that is, if the slider part of the bar would be smaller than the trough - the display is larger than the page size).

Sets the scrollbar policy for the horizontal and vertical scrollbars to POLICY_AUTOMATIC, which means the scrollbars are present only if needed.

Changes the type of shadow drawn around the contents of scrolled_window.

Parameters:
typeThe kind of shadow to draw around scrolled window contents.

Sets the Adjustment for the vertical scrollbar.

Parameters:
vadjustmentThe vertical scroll adjustment.

The documentation for this class was generated from the following file:
Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC