#include <Wt/WPopupMenuItem>
Public Member Functions | |
WPopupMenuItem (const WString &text) | |
Create a new item with given text. | |
WPopupMenuItem (const std::string &iconPath, const WString &text) | |
Create a new item with given icon and text. | |
~WPopupMenuItem () | |
Destructor. | |
void | setText (const WString &text) |
Set the item text. | |
const WString & | text () const |
Returns the item text. | |
void | setIcon (const std::string &path) |
Set the item icon path. | |
const std::string & | icon () |
Returns the item icon path. | |
void | setCheckable (bool how) |
Set if the item is checkable. | |
bool | isCheckable () const |
Returns whether the item is checkable. | |
void | setPopupMenu (WPopupMenu *menu) |
Set a sub menu for the item. | |
void | setChecked (bool how) |
Change the checked state. | |
bool | isChecked () const |
Return the checked state. | |
void | setData (void *data) |
Associated additional data with the item. | |
void * | data () const |
Returns additional data of the item. | |
virtual void | load () |
Load content just before the widget's content is rendered. | |
Public Attributes | |
Signal | triggered |
Signal emitted when an item is activated. |
An item may have a text, icon, and can be checkable or lead to a submenu.
When the mouse hovers over the item, its class is changed from "unselected" to "selected".
Wt::WPopupMenuItem::WPopupMenuItem | ( | const WString & | text | ) |
Wt::WPopupMenuItem::WPopupMenuItem | ( | const std::string & | iconPath, | |
const WString & | text | |||
) |
Create a new item with given icon and text.
The icon is displayed left to the text.
void Wt::WPopupMenuItem::setIcon | ( | const std::string & | path | ) |
const std::string & Wt::WPopupMenuItem::icon | ( | ) |
void Wt::WPopupMenuItem::setCheckable | ( | bool | how | ) |
Set if the item is checkable.
When an item is checkable, a checkbox is displayed to the left of the item text (instead of an icon).
bool Wt::WPopupMenuItem::isCheckable | ( | ) | const [inline] |
void Wt::WPopupMenuItem::setPopupMenu | ( | WPopupMenu * | menu | ) |
Set a sub menu for the item.
Sets a submenu for the item. Ownership of the submenu is transferred to the item.
void Wt::WPopupMenuItem::setChecked | ( | bool | how | ) |
Change the checked state.
This is only used when isCheckable() == true.
bool Wt::WPopupMenuItem::isChecked | ( | ) | const |
Return the checked state.
This is only used when isCheckable() == true.
void Wt::WPopupMenuItem::load | ( | ) | [virtual] |
Load content just before the widget's content is rendered.
As soon as a widget is inserted into the widget hierarchy, it is rendered. Visible widgets are rendered immediately, and invisible widgets in the back-ground. This method is called when the widget is directly or indirectly inserted into the widget tree.
The default implementation simply propagates the load signal to its children. You may want to override this method to load resource-intensive content only when the widget is loaded into the browser.
Reimplemented from Wt::WCompositeWidget.