Wt::WMenuItem Class Reference

A WMenuItem represents one item in a WMenu. More...

Inherits Wt::WObject.

Inheritance diagram for Wt::WMenuItem:

Inheritance graph
[legend]
List of all members.

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 WStringtext () const
 Get the text for this item.

Protected Member Functions

WInteractWidgetitemWidget ()
 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 WInteractWidgetcreateItemWidget ()
 Create the widget that represents the item in the WMenu.

Detailed Description

A WMenuItem represents one item in a 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.

See also:
WMenu

WMenu::addItem(WMenuItem *)


Member Enumeration Documentation

enum Wt::WMenuItem::LoadPolicy

How should the item be loaded ?

Enumerator:
LazyLoading  Lazy loading: on first use.
PreLoading  Pre-loading: before first use.


Constructor & Destructor Documentation

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.


Member Function Documentation

WInteractWidget * Wt::WMenuItem::createItemWidget (  )  [private, virtual]

Create the widget that represents the item in the WMenu.

The default implementation will create and return a WText representation.

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.


The documentation for this class was generated from the following files:
Generated on Sun Jul 1 19:37:18 2007 for Wt by doxygen 1.4.7