Wt
3.2.3
|
A widget that organizes contents in tab panes. More...
#include <Wt/Ext/TabWidget>
Public Member Functions | |
TabWidget (WContainerWidget *parent=0) | |
Create a new TabWidget. | |
void | addTab (WWidget *child, const WString &label) |
Add a new tab, with child as content, and the given label. | |
void | addTab (Panel *panel) |
Add a new tab panel. | |
void | removeTab (int index) |
Remove a tab. | |
int | count () const |
Return the number of tabs. | |
Panel * | panel (int index) const |
Return t the panel at the given tab index. | |
WWidget * | widget (int index) const |
Return the content widget at the given tab index. | |
int | indexOf (WWidget *widget) const |
Return the index of the given widget/panel. | |
void | setCurrentIndex (int index) |
Activate the tab at index. | |
int | currentIndex () const |
Return the index of the activated tab. | |
void | setCurrentWidget (WWidget *widget) |
Activate the tab showing the given widget | |
WWidget * | currentWidget () const |
Return the widget of the activated tab. | |
void | setTabEnabled (int index, bool enable) |
Enable or disable a tab. | |
bool | isTabEnabled (int index) const |
Returns if a tab is enabled. | |
void | setTabHidden (int index, bool hidden) |
Hide or show a tab. | |
bool | isTabHidden (int index) const |
Return if a tab is hidden. | |
void | setTabText (int index, const WString &label) |
Change the label for a tab. | |
const WString & | tabText (int index) const |
Return the label for a tab. | |
void | setTabToolTip (int index, const WString &tip) |
Set the tooltip for a tab. | |
const WString | tabToolTip (int index) const |
Return the tooltip for a tab. | |
virtual void | refresh () |
Refresh the widget. | |
Signal< int > & | currentChanged () |
Signal emitted when the user activates a tab. |
A widget that organizes contents in tab panes.
This widget has an API that is similar to the WTabWidget.
Unlike WTabWidget, each tab is actually represented by a Panel, and methods are provided to add a panel directly (see addTab(Panel *)). The panel titles are then used as the tab labels.
The widget inherits from Panel, and uses a WDefaultLayout to contain the tab panels. Adding panels to the layout is equivalent to adding tabs to the tab widget.
Add a new tab, with child as content, and the given label.
This is implemented by creating a panel for the widget, and setting the panel title to be the label.
void Wt::Ext::TabWidget::addTab | ( | Panel * | panel | ) |
Add a new tab panel.
The panel title is used as the tab label.
Signal<int>& Wt::Ext::TabWidget::currentChanged | ( | ) |
Signal emitted when the user activates a tab.
The index of the newly activated tab is passed as an argument.
int Wt::Ext::TabWidget::currentIndex | ( | ) | const |
Return the index of the activated tab.
WWidget * Wt::Ext::TabWidget::currentWidget | ( | ) | const |
Return the widget of the activated tab.
int Wt::Ext::TabWidget::indexOf | ( | WWidget * | widget | ) | const |
Return the index of the given widget/panel.
If the widget was not added to this tab widget, then -1 is returned.
Panel * Wt::Ext::TabWidget::panel | ( | int | index | ) | const |
Return t the panel at the given tab index.
void Wt::Ext::TabWidget::refresh | ( | ) | [virtual] |
Refresh the widget.
The refresh method is invoked when the locale is changed using WApplication::setLocale() or when the user hit the refresh button.
The widget must actualize its contents in response.
Reimplemented from Wt::Ext::Panel.
void Wt::Ext::TabWidget::removeTab | ( | int | index | ) |
Remove a tab.
void Wt::Ext::TabWidget::setCurrentIndex | ( | int | index | ) |
Activate the tab at index.
void Wt::Ext::TabWidget::setCurrentWidget | ( | WWidget * | widget | ) |
Activate the tab showing the given widget
This is equivalent to setCurrentIndex(indexOf(widget))
void Wt::Ext::TabWidget::setTabEnabled | ( | int | index, |
bool | enable | ||
) |
Enable or disable a tab.
Enables or disables the tab at index. A disabled tab cannot be activated.
void Wt::Ext::TabWidget::setTabHidden | ( | int | index, |
bool | hidden | ||
) |
Hide or show a tab.
Hides are shows the tab at index.
void Wt::Ext::TabWidget::setTabText | ( | int | index, |
const WString & | label | ||
) |
Change the label for a tab.
This is equivalent to panel(index)->setTitle(label);
void Wt::Ext::TabWidget::setTabToolTip | ( | int | index, |
const WString & | tip | ||
) |
Set the tooltip for a tab.
The tooltip is shown when the user hovers over the label.
This seems currently broken in extjs 2.0.
const WString & Wt::Ext::TabWidget::tabText | ( | int | index | ) | const |
Return the label for a tab.
WWidget * Wt::Ext::TabWidget::widget | ( | int | index | ) | const |
Return the content widget at the given tab index.