Gtk-- Reference: Gtk::ScrolledWindow

Class Index | Cross Index | Namespace Index

# Class Gtk::ScrolledWindow

Adds scrollbars to its child widget.
Contained in: Gtk
Derived from: Gtk::Bin
Derived by: none

#include <gtk--/scrolledwindow.h>

### public function member index:
`` | `ScrolledWindow` | `(`Adjustment`& `hadjustment`, `Adjustment`& `vadjustment`)`;
`` | `ScrolledWindow` | `()`;
``void`` | `add_with_viewport` | `(`Widget`& `child`)`;
``Adjustment`*` | `get_hadjustment` | `() `const``;
``HScrollbar`*` | `get_hscrollbar` | `() `const``;
``GtkPolicyType`` | `get_hscrollbar_policy` | `() `const``;
``bool`` | `get_hscrollbar_visible` | `() `const``;
``GtkCornerType`` | `get_placement` | `() `const``;
``Adjustment`*` | `get_vadjustment` | `() `const``;
``VScrollbar`*` | `get_vscrollbar` | `() `const``;
``GtkPolicyType`` | `get_vscrollbar_policy` | `() `const``;
``bool`` | `get_vscrollbar_visible` | `() `const``;
``GtkScrolledWindow`*` | `gtkobj` | `()`;
``const` `GtkScrolledWindow`*` | `gtkobj` | `() `const``;
``static` `bool`` | `isA` | `(`Object`* `object`)`;
``void`` | `set_hadjustment` | `(`Adjustment`* `hadjustment`=0)`;
``void`` | `set_hadjustment` | `(`Adjustment`& `hadjustment`)`;
``void`` | `set_placement` | `(`GtkCornerType` `window_placement`)`;
``void`` | `set_policy` | `(`GtkPolicyType` `hscrollbar_policy`, `GtkPolicyType` `vscrollbar_policy`)`;
``void`` | `set_vadjustment` | `(`Adjustment`* `vadjustment`=0)`;
``void`` | `set_vadjustment` | `(`Adjustment`& `vadjustment`)`;
``virtual`` | `~ScrolledWindow` | `()`;

## Description:

`Gtk::ScrolledWindow` is a ``Gtk`::`Bin`` subclass: it's a container that accepts a single child widget. `Gtk::ScrolledWindow` adds scrollbars to the child widget.

The scrolled window can work in two ways. Some widgets have native scrolling support; these widgets have slots for ``Gtk`::`Adjustment`` objects. The scrolled window installs ``Gtk`::`Adjustment`` objects in the child window's slots using the set_scroll_adjustments_signal, found in the ``Gtk`::`Widget`` Class. (This is how it works in GTK+, not sure about GTK--).

The second way to use the scrolled window is useful with widgets that lack the set_scroll_adjustments_signal. The ``Gtk`::`Viewport`` widget acts as a proxy, implementing scrollability for child widgets that lack their own scrolling capabilities.

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

## Function Member Descriptions:

Gtk::ScrolledWindow::add_with_viewport - Used to add children without native scrolling capabilities.

``void`` `add_with_viewport``(`Widget`& `child`)`;

> 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 `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 ``Gtk`::`CList`` with a viewport, the whole widget will scroll, including the column headings. Thus ``Gtk`::`CList`` supports scrolling already, and should not be used with the ``Gtk`::`Viewport`` proxy. `child`: Widget you want to scroll.

Gtk::ScrolledWindow::get_hadjustment - Returns the horizontal scrollbar's adjustment, used to connect the horizontal scrollbar to the child widget's horizontal scroll functionality.

``Adjustment`*` `get_hadjustment``() `const``;

> `Returns`: The horizontal ``Gtk`::`Adjustment``.

Gtk::ScrolledWindow::get_vadjustment - Returns the vertical scrollbar's adjustment, used to connect the vertical scrollbar to the child widget's vertical scroll functionality.

``Adjustment`*` `get_vadjustment``() `const``;

> `Returns`: The vertical ``Gtk`::`Adjustment``.

Gtk::ScrolledWindow::gtkobj - Returns the underlaying gtk+ object.

``GtkScrolledWindow`*` `gtkobj``()`;
Gtk::ScrolledWindow::isA - Returns true if object is this type.

``static` `bool`` `isA``(`Object`* `object`)`;
Gtk::ScrolledWindow::set_hadjustment - Sets the ``Gtk`::`Adjustment`` for the horizontal scrollbar.

``void`` `set_hadjustment``(`Adjustment`* `hadjustment`=0)`;

> `hadjustment`: Horizontal scroll adjustment.

Gtk::ScrolledWindow::set_hadjustment - Sets the ``Gtk`::`Adjustment`` for the horizontal scrollbar.

``void`` `set_hadjustment``(`Adjustment`& `hadjustment`)`;

> `hadjustment`: Horizontal scroll adjustment.

Gtk::ScrolledWindow::set_placement - Determines the location of the child widget with respect to the scrollbars.

``void`` `set_placement``(`GtkCornerType` `window_placement`)`;

> The default is `GTK_CORNER_TOP_LEFT`, meaning the child is in the top left, with the scrollbars underneath and to the right. Other values in `GtkCornerType` are `GTK_CORNER_TOP_RIGHT`, `GTK_CORNER_BOTTOM_LEFT`, and `GTK_CORNER_BOTTOM_RIGHT`. `window_placement`: Position of the child window.

Gtk::ScrolledWindow::set_policy - Sets the scrollbar policy for the horizontal and vertical scrollbars.

``void`` `set_policy``(`GtkPolicyType` `hscrollbar_policy`, `GtkPolicyType` `vscrollbar_policy`)`;

> The policy determines when the scrollbar should appear; it is a value from the `GtkPolicyType` enumeration. If `GTK_POLICY_ALWAYS`, the scrollbar is always present. If `GTK_POLICY_NEVER`, the scrollbar is never present. If `GTK_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).

> `hscrollbar_policy`: Policy for horizontal bar. `vscrollbar_policy`: Policy for vertical bar.

Gtk::ScrolledWindow::set_vadjustment - Sets the ``Gtk`::`Adjustment`` for the vertical scrollbar.

``void`` `set_vadjustment``(`Adjustment`* `vadjustment`=0)`;

> `vadjustment`: Vertical scroll adjustment.

Gtk::ScrolledWindow::set_vadjustment - Sets the ``Gtk`::`Adjustment`` for the vertical scrollbar.

``void`` `set_vadjustment``(`Adjustment`& `vadjustment`)`;

> `vadjustment`: Vertical scroll adjustment.