gtkmm 3.4.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Related Functions
Gtk::ScrolledWindow Class Reference
Widgets | Container Widgets

Adds scrollbars to its child widget. More...

Inheritance diagram for Gtk::ScrolledWindow:
[legend]

List of all members.

## Public Member Functions
virtual | ~ScrolledWindow ()
GtkScrolledWindow* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkScrolledWindow* | gobj () const
| Provides access to the underlying C GtkObject.
| ScrolledWindow ()
| ScrolledWindow (const Glib::RefPtr< Adjustment >& hadjustment, const Glib::RefPtr< Adjustment >& vadjustment)
void | set_hadjustment (const Glib::RefPtr< Adjustment >& hadjustment)
| Sets the Gtk::Adjustment for the horizontal scrollbar.
void | set_vadjustment (const Glib::RefPtr< Adjustment >& vadjustment)
| Sets the Gtk::Adjustment for the vertical scrollbar.
Glib::RefPtr< Adjustment > | get_hadjustment ()
| Returns the horizontal scrollbar's adjustment, used to connect the horizontal scrollbar to the child widget's horizontal scroll functionality.
Glib::RefPtr< const Adjustment > | get_hadjustment () const
| Returns the horizontal scrollbar's adjustment, used to connect the horizontal scrollbar to the child widget's horizontal scroll functionality.
Glib::RefPtr< Adjustment > | get_vadjustment ()
| Returns the vertical scrollbar's adjustment, used to connect the vertical scrollbar to the child widget's vertical scroll functionality.
Glib::RefPtr< const Adjustment > | get_vadjustment () const
| Returns the vertical scrollbar's adjustment, used to connect the vertical scrollbar to the child widget's vertical scroll functionality.
void | set_policy (PolicyType hscrollbar_policy, PolicyType vscrollbar_policy)
| Sets the scrollbar policy for the horizontal and vertical scrollbars.
void | get_policy (PolicyType& hscrollbar_policy, PolicyType& vscrollbar_policy) const
| Retrieves the current policy values for the horizontal and vertical scrollbars.
void | set_placement (CornerType window_placement)
| Sets the placement of the contents with respect to the scrollbars for the scrolled window.
void | unset_placement ()
| Unsets the placement of the contents with respect to the scrollbars for the scrolled window.
CornerType | get_placement () const
| Gets the placement of the contents with respect to the scrollbars for the scrolled window.
void | set_shadow_type (ShadowType type)
| Changes the type of shadow drawn around the contents of scrolled_window.
ShadowType | get_shadow_type () const
| Gets the shadow type of the scrolled window.
virtual void | add (Gtk::Widget& widget)
| Puts the child inside a Gtk::Viewport if it doesn't have native scrolling capability.
Scrollbar* | get_vscrollbar ()
| Returns the vertical scrollbar of scrolled_window.
const Scrollbar* | get_vscrollbar () const
| Returns the vertical scrollbar of scrolled_window.
Scrollbar* | get_hscrollbar ()
| Returns the horizontal scrollbar of scrolled_window.
const Scrollbar* | get_hscrollbar () const
| Returns the horizontal scrollbar of scrolled_window.
int | get_min_content_width () const
| Gets the minimum content width of scrolled_window, or -1 if not set.
void | set_min_content_width (int width)
| Sets the minimum width that scrolled_window should keep visible.
int | get_min_content_height () const
| Gets the minimal content height of scrolled_window, or -1 if not set.
void | set_min_content_height (int height)
| Sets the minimum height that scrolled_window should keep visible.
void | set_kinetic_scrolling (bool kinetic_scrolling=true)
| Turns kinetic scrolling on or off.
bool | get_kinetic_scrolling () const
| Returns the specified kinetic scrolling behavior.
void | set_capture_button_press (bool capture_button_press)
| Changes the behaviour of scrolled_window wrt.
bool | get_capture_button_press () const
| Return whether button presses are captured during kinetic scrolling.
Glib::PropertyProxy < Glib::RefPtr< Adjustment > > | property_hadjustment ()
| The GtkAdjustment for the horizontal position.
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< Adjustment > > | property_hadjustment () const
| The GtkAdjustment for the horizontal position.
Glib::PropertyProxy < Glib::RefPtr< Adjustment > > | property_vadjustment ()
| The GtkAdjustment for the vertical position.
Glib::PropertyProxy_ReadOnly < Glib::RefPtr< Adjustment > > | property_vadjustment () const
| The GtkAdjustment for the vertical position.
Glib::PropertyProxy< PolicyType > | property_hscrollbar_policy ()
| When the horizontal scrollbar is displayed.
Glib::PropertyProxy_ReadOnly < PolicyType > | property_hscrollbar_policy () const
| When the horizontal scrollbar is displayed.
Glib::PropertyProxy< PolicyType > | property_vscrollbar_policy ()
| When the vertical scrollbar is displayed.
Glib::PropertyProxy_ReadOnly < PolicyType > | property_vscrollbar_policy () const
| When the vertical scrollbar is displayed.
Glib::PropertyProxy< CornerType > | property_window_placement ()
| Where the contents are located with respect to the scrollbars.
Glib::PropertyProxy_ReadOnly < CornerType > | property_window_placement () const
| Where the contents are located with respect to the scrollbars.
Glib::PropertyProxy< bool > | property_window_placement_set ()
| Whether 'window-placement' should be used to determine the location of the contents with respect to the scrollbars.
Glib::PropertyProxy_ReadOnly < bool > | property_window_placement_set () const
| Whether 'window-placement' should be used to determine the location of the contents with respect to the scrollbars.
Glib::PropertyProxy< ShadowType > | property_shadow_type ()
| Style of bevel around the contents.
Glib::PropertyProxy_ReadOnly < ShadowType > | property_shadow_type () const
| Style of bevel around the contents.
Glib::PropertyProxy< int > | property_min_content_width ()
| The minimum width that the scrolled window will allocate to its content.
Glib::PropertyProxy_ReadOnly< int > | property_min_content_width () const
| The minimum width that the scrolled window will allocate to its content.
Glib::PropertyProxy< int > | property_min_content_height ()
| The minimum height that the scrolled window will allocate to its content.
Glib::PropertyProxy_ReadOnly< int > | property_min_content_height () const
| The minimum height that the scrolled window will allocate to its content.
Glib::PropertyProxy< bool > | property_kinetic_scrolling ()
| Kinetic scrolling mode.
Glib::PropertyProxy_ReadOnly < bool > | property_kinetic_scrolling () const
| Kinetic scrolling mode.
## Related Functions
(Note that these are not member functions.)
Gtk::ScrolledWindow* | wrap (GtkScrolledWindow* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Adds scrollbars to its child widget.

This container accepts a single child widget. It adds scrollbars to the child widget and optionally draws a beveled frame around the child widget. The scrolled window can work in two ways: 1) Some widgets have native scrolling support; these widgets handle certain Gtk::Adjustment signals. Widgets with native scroll support include Gtk::TreeView, Gtk::TextView, and Gtk::Layout. 2) For widgets that lack native scrolling support, such as Gtk::Table, Gtk::Box, and so on, the widget will be placed inside a Gtk::Viewport.

The position of the scrollbars is controlled by the scroll adjustments. See Gtk::Adjustment for the fields in an adjustment - for Gtk::Scrollbar, used by Gtk::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 PageDown key).

If a Gtk::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 Gtk::Scrollbar and, for example, a Gtk::Table.

## Constructor & Destructor Documentation

virtual Gtk::ScrolledWindow::~ScrolledWindow | ( |  | ) | `[virtual]`

Gtk::ScrolledWindow::ScrolledWindow | ( |  | ) |

Gtk::ScrolledWindow::ScrolledWindow | ( | const Glib::RefPtr< Adjustment >& | hadjustment,
|  | const Glib::RefPtr< Adjustment >& | vadjustment
| ) |  | `[explicit]`

## Member Function Documentation

virtual void Gtk::ScrolledWindow::add | ( | Gtk::Widget& | widget | ) | `[virtual]`

Puts the child inside a Gtk::Viewport if it doesn't have native scrolling capability.

Reimplemented from Gtk::Container.

bool Gtk::ScrolledWindow::get_capture_button_press | ( |  | ) | const

Return whether button presses are captured during kinetic scrolling.

See set_capture_button_press().

Since gtkmm 3.4:

Returns:
  `true` if button presses are captured during kinetic scrolling.

Glib::RefPtr<Adjustment> Gtk::ScrolledWindow::get_hadjustment | ( |  | ) |

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

Returns:
  The horizontal Gtk::Adjustment.

Glib::RefPtr<const Adjustment> Gtk::ScrolledWindow::get_hadjustment | ( |  | ) | const

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

Returns:
  The horizontal Gtk::Adjustment.

Scrollbar* Gtk::ScrolledWindow::get_hscrollbar | ( |  | ) |

Returns the horizontal scrollbar of scrolled_window.

Since gtkmm 2.8:

Returns:
  The horizontal scrollbar of the scrolled window, or `0` if it does not have one.

const Scrollbar* Gtk::ScrolledWindow::get_hscrollbar | ( |  | ) | const

Returns the horizontal scrollbar of scrolled_window.

Since gtkmm 2.8:

Returns:
  The horizontal scrollbar of the scrolled window, or `0` if it does not have one.

bool Gtk::ScrolledWindow::get_kinetic_scrolling | ( |  | ) | const

Returns the specified kinetic scrolling behavior.

Since gtkmm 3.4:

Returns:
  The scrolling behavior flags.

int Gtk::ScrolledWindow::get_min_content_height | ( |  | ) | const

Gets the minimal content height of scrolled_window, or -1 if not set.

Since gtkmm 3.0:

Returns:
  The minimal content height.

int Gtk::ScrolledWindow::get_min_content_width | ( |  | ) | const

Gets the minimum content width of scrolled_window, or -1 if not set.

Since gtkmm 3.0:

Returns:
  The minimum content width.

CornerType Gtk::ScrolledWindow::get_placement | ( |  | ) | const

Gets the placement of the contents with respect to the scrollbars for the scrolled window.

See set_placement().

Returns:
  The current placement value.

See also set_placement() and unset_placement().

void 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_policy | Location to store the policy for the horizontal scrollbar, or `0`.
  vscrollbar_policy | Location to store the policy for the vertical scrollbar, or `0`.

ShadowType Gtk::ScrolledWindow::get_shadow_type | ( |  | ) | const

Gets the shadow type of the scrolled window.

See set_shadow_type().

Returns:
  The current shadow type.

Glib::RefPtr<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.

Returns:
  The vertical Gtk::Adjustment.

Glib::RefPtr<const Adjustment> Gtk::ScrolledWindow::get_vadjustment | ( |  | ) | const

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

Returns:
  The vertical Gtk::Adjustment.

Scrollbar* Gtk::ScrolledWindow::get_vscrollbar | ( |  | ) |

Returns the vertical scrollbar of scrolled_window.

Since gtkmm 2.8:

Returns:
  The vertical scrollbar of the scrolled window, or `0` if it does not have one.

const Scrollbar* Gtk::ScrolledWindow::get_vscrollbar | ( |  | ) | const

Returns the vertical scrollbar of scrolled_window.

Since gtkmm 2.8:

Returns:
  The vertical scrollbar of the scrolled window, or `0` if it does not have one.

GtkScrolledWindow* Gtk::ScrolledWindow::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Bin.

const GtkScrolledWindow* Gtk::ScrolledWindow::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Bin.

Glib::PropertyProxy< Glib::RefPtr<Adjustment> > Gtk::ScrolledWindow::property_hadjustment | ( |  | ) |

The GtkAdjustment for the horizontal position.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Adjustment> > Gtk::ScrolledWindow::property_hadjustment | ( |  | ) | const

The GtkAdjustment for the horizontal position.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< PolicyType > Gtk::ScrolledWindow::property_hscrollbar_policy | ( |  | ) |

When the horizontal scrollbar is displayed.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< PolicyType > Gtk::ScrolledWindow::property_hscrollbar_policy | ( |  | ) | const

When the horizontal scrollbar is displayed.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< bool > Gtk::ScrolledWindow::property_kinetic_scrolling | ( |  | ) |

Kinetic scrolling mode.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< bool > Gtk::ScrolledWindow::property_kinetic_scrolling | ( |  | ) | const

Kinetic scrolling mode.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< int > Gtk::ScrolledWindow::property_min_content_height | ( |  | ) |

The minimum height that the scrolled window will allocate to its content.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< int > Gtk::ScrolledWindow::property_min_content_height | ( |  | ) | const

The minimum height that the scrolled window will allocate to its content.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< int > Gtk::ScrolledWindow::property_min_content_width | ( |  | ) |

The minimum width that the scrolled window will allocate to its content.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< int > Gtk::ScrolledWindow::property_min_content_width | ( |  | ) | const

The minimum width that the scrolled window will allocate to its content.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< ShadowType > Gtk::ScrolledWindow::property_shadow_type | ( |  | ) |

Style of bevel around the contents.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< ShadowType > Gtk::ScrolledWindow::property_shadow_type | ( |  | ) | const

Style of bevel around the contents.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< Glib::RefPtr<Adjustment> > Gtk::ScrolledWindow::property_vadjustment | ( |  | ) |

The GtkAdjustment for the vertical position.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Adjustment> > Gtk::ScrolledWindow::property_vadjustment | ( |  | ) | const

The GtkAdjustment for the vertical position.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< PolicyType > Gtk::ScrolledWindow::property_vscrollbar_policy | ( |  | ) |

When the vertical scrollbar is displayed.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< PolicyType > Gtk::ScrolledWindow::property_vscrollbar_policy | ( |  | ) | const

When the vertical scrollbar is displayed.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< CornerType > Gtk::ScrolledWindow::property_window_placement | ( |  | ) |

Where the contents are located with respect to the scrollbars.

This property only takes effect if 'window-placement-set' is TRUE.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< CornerType > Gtk::ScrolledWindow::property_window_placement | ( |  | ) | const

Where the contents are located with respect to the scrollbars.

This property only takes effect if 'window-placement-set' is TRUE.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< bool > Gtk::ScrolledWindow::property_window_placement_set | ( |  | ) |

Whether 'window-placement' should be used to determine the location of the contents with respect to the scrollbars.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< bool > Gtk::ScrolledWindow::property_window_placement_set | ( |  | ) | const

Whether 'window-placement' should be used to determine the location of the contents with respect to the scrollbars.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gtk::ScrolledWindow::set_capture_button_press | ( | bool | capture_button_press | ) |

Changes the behaviour of scrolled_window wrt.

to the initial event that possibly starts kinetic scrolling. When capture_button_press is set to `true`, the event is captured by the scrolled window, and then later replayed if it is meant to go to the child widget.

This should be enabled if any child widgets perform non-reversible actions on Gtk::Widget::signal_button_press_event(). If they don't, and handle additionally handle Gtk::Widget::signal_grab_broken_event(), it might be better to set capture_button_press to `false`.

This setting only has an effect if kinetic scrolling is enabled.

Since gtkmm 3.4:

Parameters:

  capture_button_press | `true` to capture button presses.

void Gtk::ScrolledWindow::set_hadjustment | ( | const Glib::RefPtr< Adjustment >& | hadjustment | ) |

Sets the Gtk::Adjustment for the horizontal scrollbar.

Parameters:

  hadjustment | Horizontal scroll adjustment.

void Gtk::ScrolledWindow::set_kinetic_scrolling | ( | bool | kinetic_scrolling = `true` | ) |

Turns kinetic scrolling on or off.

Kinetic scrolling only applies to devices with source Gdk::SOURCE_TOUCHSCREEN.

Since gtkmm 3.4:

Parameters:

  kinetic_scrolling | `true` to enable kinetic scrolling.

void Gtk::ScrolledWindow::set_min_content_height | ( | int | height | ) |

Sets the minimum height that scrolled_window should keep visible.

Note that this can and (usually will) be smaller than the minimum size of the content.

Since gtkmm 3.0:

Parameters:

  height | The minimal content height.

void Gtk::ScrolledWindow::set_min_content_width | ( | int | width | ) |

Sets the minimum width that scrolled_window should keep visible.

Note that this can and (usually will) be smaller than the minimum size of the content.

Since gtkmm 3.0:

Parameters:

  width | The minimal content width.

void Gtk::ScrolledWindow::set_placement | ( | CornerType | window_placement | ) |

Sets the placement of the contents with respect to the scrollbars for the scrolled window.

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 Gtk::CornerType are Gtk::CORNER_TOP_RIGHT, Gtk::CORNER_BOTTOM_LEFT, and Gtk::CORNER_BOTTOM_RIGHT.

See also get_placement() and unset_placement().

Parameters:

  window_placement | Position of the child window.

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

Sets the scrollbar policy for the horizontal and vertical scrollbars.

The policy determines when the scrollbar should appear; it is a value from the Gtk::PolicyType 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).

Parameters:

  hscrollbar_policy | Policy for horizontal bar.
  vscrollbar_policy | Policy for vertical bar.

void Gtk::ScrolledWindow::set_shadow_type | ( | ShadowType | type | ) |

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

Parameters:

  type | Kind of shadow to draw around scrolled window contents.

void Gtk::ScrolledWindow::set_vadjustment | ( | const Glib::RefPtr< Adjustment >& | vadjustment | ) |

Sets the Gtk::Adjustment for the vertical scrollbar.

Parameters:

  vadjustment | Vertical scroll adjustment.

void Gtk::ScrolledWindow::unset_placement | ( |  | ) |

Unsets the placement of the contents with respect to the scrollbars for the scrolled window.

If no window placement is set for a scrolled window, it obeys the "gtk-scrolled-window-placement" XSETTING.

See also set_placement() and get_placement().

Since gtkmm 2.10:

## Friends And Related Function Documentation

Gtk::ScrolledWindow* wrap | ( | GtkScrolledWindow * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- gtkmm/scrolledwindow.h