Wt: Wt::WScrollArea Class Reference

Wt 3.3.0

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

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions
Wt::WScrollArea Class Reference

A widget that adds scrolling capabilities to its content. More...

`#include <Wt/WScrollArea>`

Inheritance diagram for Wt::WScrollArea:
[legend]

List of all members.

## Public Types
enum | ScrollBarPolicy { ScrollBarAsNeeded, ScrollBarAlwaysOff, ScrollBarAlwaysOn }
## Public Member Functions
| WScrollArea (WContainerWidget *parent=0)
| Creates a scroll area.
void | setWidget (WWidget *widget)
| Sets the widget that is the content of the scroll area.
WWidget * | takeWidget ()
| Removes the widget content.
WWidget * | widget () const
| Returns the widget content.
WScrollBar * | horizontalScrollBar () const
| Returns the horizontal scrollbar.
WScrollBar * | verticalScrollBar () const
| Returns the vertical scrollbar.
void | setScrollBarPolicy (ScrollBarPolicy scrollBarPolicy)
| Sets the policy for both scrollbars.
void | setHorizontalScrollBarPolicy (ScrollBarPolicy scrollBarPolicy)
| Sets the horizontal scroll bar policy.
void | setVerticalScrollBarPolicy (ScrollBarPolicy scrollBarPolicy)
| Sets the vertical scroll bar policy.
ScrollBarPolicy | horizontalScrollBarPolicy ()
| Returns the horizontal scroll bar policy.
ScrollBarPolicy | verticalScrollBarPolicy ()
| Returns the vertical scroll bar policy.

## Detailed Description

A widget that adds scrolling capabilities to its content.

Use a WScrollArea to add scrolling capabilities to another widget. When the content is bigger than the WScrollArea, scrollbars are added so that the user can still view the entire content.

Use setScrollBarPolicy() to configure if and when the scrollbars may appear.

In many cases, it might be easier to use the CSS overflow property on a WContainerWidget (see WContainerWidget::setOverflow()). However, this class will behave better when used inside a layout manager: in that case it will make sure horizontal scrolling works properly, since otherwise the layout manager would overflow rather than scrollbars appear.

### CSS

This widget is rendered using a `<div>` with a CSS overflow attribute. When in a layout manager it is positioned absolutely. It can be styled using inline or external CSS as appropriate.

## Member Enumeration Documentation

enum Wt::WScrollArea::ScrollBarPolicy

brief Policy for showing a scrollbar.

Enumerator:

  ScrollBarAsNeeded | Automatic.
  ScrollBarAlwaysOff | Never show a scrollbar.
  ScrollBarAlwaysOn | Always show a scrollbar.

## Member Function Documentation

ScrollBarPolicy Wt::WScrollArea::horizontalScrollBarPolicy | ( |  | ) |

Returns the horizontal scroll bar policy.

See also:
  setHorizontalScrollBarPolicy()

void Wt::WScrollArea::setHorizontalScrollBarPolicy | ( | ScrollBarPolicy | scrollBarPolicy | ) |

Sets the horizontal scroll bar policy.

See also:
  setScrollBarPolicy()

void Wt::WScrollArea::setScrollBarPolicy | ( | ScrollBarPolicy | scrollBarPolicy | ) |

Sets the policy for both scrollbars.

See also:
  setHorizontalScrollBarPolicy(), setVerticalScrollBarPolicy()

void Wt::WScrollArea::setVerticalScrollBarPolicy | ( | ScrollBarPolicy | scrollBarPolicy | ) |

Sets the vertical scroll bar policy.

See also:
  setScrollBarPolicy()

void Wt::WScrollArea::setWidget | ( | WWidget * | widget | ) |

Sets the widget that is the content of the scroll area.

Setting a new widget will delete the previously set widget.

ScrollBarPolicy Wt::WScrollArea::verticalScrollBarPolicy | ( |  | ) |

Returns the vertical scroll bar policy.

See also:
  setVerticalScrollBarPolicy()

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator