Wt::Ext::TabWidget Class Reference
[Ext widgets]

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
 Get the panel at the given tab index.
WWidgetwidget (int index) const
 Get the content widget at the given tab index.
int indexOf (WWidget *widget) const
 Get the index of the given widget/panel.
void setCurrentIndex (int index)
 Activate the tab at index.
int currentIndex () const
 Get the index of the activated tab.
void setCurrentWidget (WWidget *widget)
 Activate the tab showing the given widget.
WWidgetcurrentWidget () const
 Get 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
 Get the label for a tab.
void setTabToolTip (int index, const WString &tip)
 Set the tooltip for a tab.
const WString tabToolTip (int index) const
 Get the tooltip for a tab.
virtual void refresh ()
 Refresh the widget.

Public Attributes

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&)

void Wt::Ext::TabWidget::removeTab ( int  index  ) 

Remove a tab.

See also:
addTab(Panel *), addTab(WWidget *, const WString&)

indexOf(WWidget *)

Panel * Wt::Ext::TabWidget::panel ( int  index  )  const

Get the panel at the given tab index.

See also:
widget(int)

WWidget * Wt::Ext::TabWidget::widget ( int  index  )  const

Get the content widget at the given tab index.

See also:
panel(int)

int Wt::Ext::TabWidget::indexOf ( WWidget widget  )  const

Get the index of the given widget/panel.

If the widget was not added to this tab widget, then -1 is returned.

void Wt::Ext::TabWidget::setCurrentIndex ( int  index  ) 

Activate the tab at index.

See also:
setCurrentWidget(WWidget *), currentIndex()

currentChanged signal

int Wt::Ext::TabWidget::currentIndex (  )  const

Get the index of the activated tab.

See also:
setCurrentIndex(int)

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)

WWidget * Wt::Ext::TabWidget::currentWidget (  )  const

Get the widget of the activated tab.

See also:
setCurrentWidget(WWidget *), currentIndex()

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)

const WString & Wt::Ext::TabWidget::tabText ( int  index  )  const

Get the label for a tab.

See also:
setTabText(int, const WString&)

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.

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.


Member Data Documentation

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.


Generated on Fri Jul 25 17:56:38 2008 for Wt by doxygen 1.5.3