Wt
3.2.1
|
A menu item that contains a nested sub menu. More...
Public Member Functions | |
WSubMenuItem (const WString &text, WWidget *contents, LoadPolicy policy=LazyLoading) | |
Creates a new item. | |
void | setSubMenu (WMenu *subMenu) |
Sets a sub menu. | |
WMenu * | subMenu () |
Returns the sub menu. | |
virtual std::string | pathComponent () const |
Returns the path component for this item. | |
![]() | |
WMenuItem (const WString &text, WWidget *contents, LoadPolicy policy=LazyLoading) | |
Creates a new item. | |
void | setText (const WString &text) |
Sets the text for this item. | |
const WString & | text () const |
Returns the text for this item. | |
void | setPathComponent (const std::string &path) |
Sets the path component for this item. | |
void | setCloseable (bool closeable) |
Make it possible to close this item interactively or by close(). | |
bool | isCloseable () const |
Returns whether the item is closeable. | |
void | close () |
Closes this item. | |
void | setHidden (bool hidden) |
Sets whether the item widget is hidden. | |
bool | isHidden () const |
Returns whether the item widget is hidden. | |
void | hide () |
Hides the item widget. | |
void | show () |
Shows the item widget. | |
void | setDisabled (bool disabled) |
Enables or disables an item. | |
bool | isDisabled () const |
Returns whether an item is enabled. | |
void | enable () |
Enables the item. | |
void | disable () |
Disables the item. | |
void | setToolTip (const WString &tip) |
Sets a tooltip. | |
const WString & | toolTip () const |
Returns the tooltip. | |
WMenu * | menu () const |
Returns the menu. | |
WWidget * | contents () const |
Returns the contents widget for this item. | |
WWidget * | itemWidget () |
Returns the widget that represents the item. | |
void | select () |
Selects this item. | |
![]() | |
WObject (WObject *parent=0) | |
Create a WObject with a given parent object. | |
virtual | ~WObject () |
Destructor. | |
virtual const std::string | id () const |
Returns the (unique) identifier for this object. | |
void | setObjectName (const std::string &name) |
Sets an object name. | |
virtual std::string | objectName () const |
Returns the object name. | |
void | resetLearnedSlots () |
Resets learned stateless slot implementations. | |
template<class T > | |
void | resetLearnedSlot (void(T::*method)()) |
Resets a learned stateless slot implementation. | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)()) |
Declares a slot to be stateless and learn client-side behaviour on first invocation. | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)()) |
Declares a slot to be stateless and learn client-side behaviour in advance. | |
template<class T > | |
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
Provides a JavaScript implementation for a method. | |
void | addChild (WObject *child) |
Adds a child object. | |
virtual void | removeChild (WObject *child) |
Removes a child object. | |
const std::vector< WObject * > & | children () const |
Returns the children. | |
WObject * | parent () const |
Returns the parent object. |
Protected Member Functions | |
virtual WWidget * | createItemWidget () |
Creates the widget that represents the item. | |
virtual void | updateItemWidget (WWidget *itemWidget) |
Updates the widget that represents the item. | |
virtual void | renderSelected (bool selected) |
Renders the item as selected or unselected. | |
virtual SignalBase & | activateSignal () |
Returns the signal used to activate the item. | |
![]() | |
virtual SignalBase & | closeSignal () |
Returns the signal used to close the item. | |
virtual void | enableAjax () |
Progresses to an Ajax-enabled widget. | |
![]() | |
virtual WStatelessSlot * | getStateless (Method method) |
On-demand stateless slot implementation. |
Additional Inherited Members | |
![]() | |
enum | LoadPolicy { LazyLoading, PreLoading } |
Enumeration that determines when contents should be loaded. More... | |
![]() | |
static WObject * | sender () |
Returns the sender of the current slot call. |
A menu item that contains a nested sub menu.
This class specializes menu item to have an optional sub menu.
When the item is shown and hidden when the item is selected respectively deselected.
Usage example:
Wt::WSubMenuItem::WSubMenuItem | ( | const WString & | text, |
WWidget * | contents, | ||
LoadPolicy | policy = LazyLoading |
||
) |
Creates a new item.
|
protectedvirtual |
Returns the signal used to activate the item.
The default implementation will tries to cast the itemWidget() or its first child if item is closeable to a WInteractWidget and returns the clicked signal.
Reimplemented from Wt::WMenuItem.
|
protectedvirtual |
Creates the widget that represents the item.
The default implementation will return:
A call to createItemWidget() is immediately followed by updateItemWidget().
If you reimplement this method, you should probably also reimplement updateItemWidget().
Reimplemented from Wt::WMenuItem.
|
virtual |
Returns the path component for this item.
You may want to reimplement this to customize the path component set by the item in the application internal path.
\note the \p path component is UTF8 encoded (we may fix the API to use WString in the future).
Reimplemented from Wt::WMenuItem.
|
protectedvirtual |
Renders the item as selected or unselected.
The default implementation sets the styleclass for itemWidget() to 'item' for an unselected not closeable, 'itemselected' for selected not closeable, 'citem' for an unselected closeable and 'citemselected' for selected closeable item.
Note that this method is called from within a stateless slot implementation, and thus should be stateless as well.
Reimplemented from Wt::WMenuItem.
void Wt::WSubMenuItem::setSubMenu | ( | WMenu * | subMenu | ) |
Sets a sub menu.
Ownership of the subMenu
is transferred to the item. In most cases, the sub menu would use the same contents stack as the parent menu.
The default submenu is 0
, in which case the item behaves as a plain WMenuItem.
WMenu* Wt::WSubMenuItem::subMenu | ( | ) |
Returns the sub menu.
|
protectedvirtual |
Updates the widget that represents the item.
The default implementation will cast the itemWidget
to a WAnchor, and set the anchor's text and destination according to text() and pathComponent().
Reimplemented from Wt::WMenuItem.