Inherits Wt::WObject.
Inheritance diagram for Wt::WMenuItem:

Public Types | |
| LazyLoading | |
| Lazy loading: on first use. | |
| PreLoading | |
| Pre-loading: before first use. | |
| enum | LoadPolicy { LazyLoading, PreLoading } |
| How should the item be loaded ? More... | |
Public Slots | |
| void | select () |
| Select this item. | |
Public Member Functions | |
| WMenuItem (const WString &text, WWidget *contents, LoadPolicy policy) | |
| Create a new WMenuItem. | |
| const WString & | text () const |
| Get the text for this item. | |
Protected Member Functions | |
| WInteractWidget * | itemWidget () |
| Get the widget that represents the item in the WMenu. | |
| virtual void | renderSelected (bool selected) |
| Render the item selected or unselected. | |
Private Member Functions | |
| virtual WInteractWidget * | createItemWidget () |
| Create the widget that represents the item in the WMenu. | |
The WMenuItem is rendered as a plain WText widget.
To provide another look for the menu items (such as perhaps adding an icon), you can specialize this class, and reimplement the virtual methods createItemWidget() and perhaps also renderSelected(bool) if you want something more than changing style classes.
| Wt::WMenuItem::WMenuItem | ( | const WString & | text, | |
| WWidget * | contents, | |||
| LoadPolicy | policy | |||
| ) |
Create a new WMenuItem.
The text specifies the item text. The contents is the widget that must be shown in the WMenu contents stack when the item is selected.
The load policy specifies whether the contents widgets is transmitted only when it the item is activated for the first time (LazyLoading) or transmitted prior to first rendering.
| WInteractWidget * Wt::WMenuItem::createItemWidget | ( | ) | [private, virtual] |
| WInteractWidget * Wt::WMenuItem::itemWidget | ( | ) | [protected] |
Get the widget that represents the item in the WMenu.
This returns the widget that was previously created using createItemWidget().
| void Wt::WMenuItem::renderSelected | ( | bool | selected | ) | [protected, virtual] |
Render the item selected or unselected.
The default implementation will set the styleclass to 'item' for an unselected, and 'itemselected' for a selected item.
Note that this methods is called from within a stateless slot implementation, and thus should be stateless as well.
1.4.7