Wt  3.2.3
Public Member Functions
Wt::Ext::TabWidget Class Reference

A widget that organizes contents in tab panes. More...

#include <Wt/Ext/TabWidget>

Inheritance diagram for Wt::Ext::TabWidget:
Inheritance graph
[legend]

List of all members.

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.
Panelpanel (int index) const
 Return t the panel at the given tab index.
WWidgetwidget (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
WWidgetcurrentWidget () 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 WStringtabText (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.

Detailed Description

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.

ExtTabWidget-1.png
Example of a TabWidget

Member Function Documentation

void Wt::Ext::TabWidget::addTab ( WWidget child,
const WString label 
)

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.

See also:
addTab(Panel *), removeTab(int), widget(int)
void Wt::Ext::TabWidget::addTab ( Panel panel)

Add a new tab panel.

The panel title is used as the tab label.

See also:
addTab(WWidget *, const WString&)
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.

See also:
setCurrentIndex(int)
WWidget * Wt::Ext::TabWidget::currentWidget ( ) const

Return the widget of the activated tab.

See also:
setCurrentWidget(WWidget *), currentIndex()
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.

See also:
widget(int)
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.

See also:
addTab(Panel *), addTab(WWidget *, const WString&)
indexOf(WWidget *)
void Wt::Ext::TabWidget::setCurrentIndex ( int  index)

Activate the tab at index.

See also:
setCurrentWidget(WWidget *), currentIndex()
currentChanged() signal
void Wt::Ext::TabWidget::setCurrentWidget ( WWidget widget)

Activate the tab showing the given widget

This is equivalent to setCurrentIndex(indexOf(widget))

See also:
currentWidget(), setCurrentIndex(int)
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);

See also:
tabText(int)
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.

See also:
setTabText(int, const WString&)
WWidget * Wt::Ext::TabWidget::widget ( int  index) const

Return the content widget at the given tab index.

See also:
panel(int)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator

Generated on Thu Nov 1 2012 for the C++ Web Toolkit (Wt) by doxygen 1.7.5.1