Wt
3.3.0
|
A WPanel provides a container with a title bar. More...
#include <Wt/WPanel>
Public Member Functions | |
WPanel (WContainerWidget *parent=0) | |
Creates a panel. | |
void | setTitle (const WString &title) |
Sets a title. | |
WString | title () const |
Returns the title. | |
void | setTitleBar (bool enable) |
Shows or hides the title bar for the panel. | |
bool | titleBar () const |
Returns if a title bar is set. | |
WContainerWidget * | titleBarWidget () const |
Returns the title bar widget. | |
void | setCollapsible (bool on) |
Makes the panel collapsible. | |
bool | isCollapsible () const |
Returns if the panel can be collapsed by the user. | |
void | setCollapsed (bool on) |
Sets the panel expanded or collapsed. | |
bool | isCollapsed () const |
Returns if the panel is collapsed. | |
void | collapse () |
Collapses the panel. | |
void | expand () |
Collapses the panel. | |
void | setAnimation (const WAnimation &transition) |
Sets an animation. | |
void | setCentralWidget (WWidget *) |
Sets the central widget. | |
WWidget * | centralWidget () const |
Returns the central widget. | |
Signal & | collapsed () |
Signal emitted when the panel is collapsed. | |
Signal & | expanded () |
Signal emitted when the panel is expanded. |
A WPanel provides a container with a title bar.
The panel provides a container with an optional title bar, and an optional collapse icon.
Usage example:
Wt::WPanel *panel = new Wt::WPanel(); panel->setTitle("A panel"); panel->setCentralWidget(new Wt::WText("This is the panel contents")); panel->setCollapsible(true);
WWidget* Wt::WPanel::centralWidget | ( | ) | const |
Returns the central widget.
void Wt::WPanel::collapse | ( | ) |
Collapses the panel.
When isCollapsible() is true, the panel is collapsed to minimize screen real-estate.
Signal& Wt::WPanel::collapsed | ( | ) |
Signal emitted when the panel is collapsed.
Signal emitted when the panel is collapsed. The signal is only emitted when the panel is collapsed by the user using the collapse icon in the tible bar, not when calling setCollapsed(bool).
void Wt::WPanel::expand | ( | ) |
Collapses the panel.
When isCollapsible() is true, the panel is expanded to its original state.
Signal& Wt::WPanel::expanded | ( | ) |
Signal emitted when the panel is expanded.
Signal emitted when the panel is expanded. The signal is only emitted when the panel is expanded by the user using the expand icon in the title bar, not when calling setCollapsed(bool).
bool Wt::WPanel::isCollapsed | ( | ) | const |
Returns if the panel is collapsed.
bool Wt::WPanel::isCollapsible | ( | ) | const |
Returns if the panel can be collapsed by the user.
void Wt::WPanel::setAnimation | ( | const WAnimation & | transition | ) |
Sets an animation.
The animation is used when collapsing or expanding the panel.
void Wt::WPanel::setCentralWidget | ( | WWidget * | w | ) |
Sets the central widget.
Sets the widget that is the contents of the panel. When a widget was previously set, the old widget is deleted first.
The default value is 0
(no widget set).
void Wt::WPanel::setCollapsed | ( | bool | on | ) |
Sets the panel expanded or collapsed.
When on
is true
, equivalent to collapse(), otherwise to expand().
The default value is false
.
void Wt::WPanel::setCollapsible | ( | bool | on | ) |
Makes the panel collapsible.
When on
is true
, a collapse/expand icon is added to the title bar. This also calls setTitleBar(true) to enable the title bar.
The default value is false
.
void Wt::WPanel::setTitle | ( | const WString & | title | ) |
Sets a title.
The panel title is set in the title bar. This method also makes the title bar visible by calling setTitleBar(true).
The default value is "" (no title).
void Wt::WPanel::setTitleBar | ( | bool | enable | ) |
Shows or hides the title bar for the panel.
The title bar appears at the top of the panel.
The default value is false:
the title bar is not shown unless a title is set or the panel is made collapsible.
WString Wt::WPanel::title | ( | ) | const |
Returns the title.
bool Wt::WPanel::titleBar | ( | ) | const |
Returns if a title bar is set.
WContainerWidget * Wt::WPanel::titleBarWidget | ( | ) | const |
Returns the title bar widget.
The title bar widget contains the collapse/expand icon (if the panel isCollapsible()), and the title text (if a title was set using setTitle()). You can access the title bar widget to customize the contents of the title.
The method returns 0
if titleBar() is false
. You need to call setTitleBar() first.