Wt: Wt::WStackedWidget Class Reference

Wt 3.3.0

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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions
Wt::WStackedWidget Class Reference

A container widget that stacks its widgets on top of each other. More...

`#include <Wt/WStackedWidget>`

Inheritance diagram for Wt::WStackedWidget:
[legend]

List of all members.

## Public Member Functions
| WStackedWidget (WContainerWidget *parent=0)
| Creates a new stack.
virtual void | addWidget (WWidget *widget)
| Adds a child widget to this container.
int | currentIndex () const
| Returns the index of the widget that is currently shown.
WWidget * | currentWidget () const
| Returns the widget that is currently shown.
void | insertWidget (int index, WWidget *widget)
| Insert a widget at a given index.
void | setCurrentIndex (int index)
| Changes the current widget.
void | setCurrentIndex (int index, const WAnimation &animation, bool autoReverse=true)
| Changes the current widget using a custom animation.
void | setCurrentWidget (WWidget *widget)
| Changes the current widget.
void | setTransitionAnimation (const WAnimation &animation, bool autoReverse=false)
| Specifies an animation used during transitions.
## Protected Member Functions
virtual void | render (WFlags< RenderFlag > flags)
| Renders the widget.

## Detailed Description

A container widget that stacks its widgets on top of each other.

This is a container widget which at all times has only one item visible. The widget accomplishes this using setHidden(bool) on the children.

Using currentIndex() and setCurrentIndex(int index) you can retrieve or set the visible widget.

WStackedWidget, like WContainerWidget, is by default not inline.

### CSS

The widget is rendered using an HTML `<div>` tag and does not provide styling. It can be styled using inline or external CSS as appropriate.

See also:
  WMenu

## Member Function Documentation

void Wt::WStackedWidget::addWidget | ( | WWidget * | widget | ) | `[virtual]`

Adds a child widget to this container.

This is equivalent to passing this container as the parent when constructing the child. The widget is appended to the list of children, and thus also layed-out at the end.

Reimplemented from Wt::WContainerWidget.

int Wt::WStackedWidget::currentIndex | ( |  | ) | const

Returns the index of the widget that is currently shown.

See also:
  setCurrentIndex(), currentWidget()

WWidget * Wt::WStackedWidget::currentWidget | ( |  | ) | const

Returns the widget that is currently shown.

See also:
  setCurrentWidget(), currentIndex()

void Wt::WStackedWidget::render | ( | WFlags< RenderFlag > | flags | ) | `[protected, virtual]`

Renders the widget.

This function renders the widget (or an update for the widget), after this has been scheduled using scheduleRender().

The default implementation will render the widget by serializing changes to JavaScript and HTML. You may want to reimplement this widget if you have been postponing some of the layout / rendering implementation until the latest moment possible. In that case you should make sure you call the base implementation however.

Reimplemented from Wt::WWebWidget.

void Wt::WStackedWidget::setCurrentIndex | ( | int | index | ) |

Changes the current widget.

The widget with index `index` is made visible, while all other widgets are hidden.

The change of current widget is done using the animation settings specified by setTransitionAnimation().

The default value for current index is 0 (provided thath

See also:
  currentIndex(), setCurrentWidget()

void Wt::WStackedWidget::setCurrentIndex | ( | int | index,
|  | const WAnimation & | animation,
|  | bool | autoReverse = `true`
| ) |  |

Changes the current widget using a custom animation.

See also:
  currentIndex(), setCurrentWidget()

void Wt::WStackedWidget::setCurrentWidget | ( | WWidget * | widget | ) |

Changes the current widget.

The widget `widget`, which must have been added before, is made visible, while all other widgets are hidden.

See also:
  currentWidget(), setCurrentIndex()

void Wt::WStackedWidget::setTransitionAnimation | ( | const WAnimation & | animation,
|  | bool | autoReverse = `false`
| ) |  |

Specifies an animation used during transitions.

The animation is used to hide the previously current widget and show the next current widget using setCurrentIndex().

The initial value for `animation` is WAnimation(), specifying no animation.

When `autoReverse` is set to `true`, then the reverse animation is chosen when the new index precedes the current index. This only applies to WAnimation::SlideLeft, WAnimation::SlideRight, WAnimation::SlideUp or WAnimation::SlideDown transition effects.

See also:
  setCurrentIndex()

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator