Wt  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Member Functions
Wt::WPopupMenuItem Class Reference

An item in a popup menu. More...

#include <Wt/WPopupMenuItem>

Inheritance diagram for Wt::WPopupMenuItem:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 WPopupMenuItem (const WString &text)
 Creates a new item with given text.
 WPopupMenuItem (const std::string &iconPath, const WString &text)
 Creates a new item with given icon and text.
 ~WPopupMenuItem ()
 Destructor.
void setText (const WString &text)
 Sets the item text.
const WStringtext () const
 Returns the item text.
void setIcon (const std::string &path)
 Sets the item icon path.
std::string icon ()
 Returns the item icon path.
void setCheckable (bool checkable)
 Sets if the item is checkable.
bool isCheckable () const
 Returns whether the item is checkable.
void setLink (const WLink &link)
 Associates a link with the item.
WLink link () const
 Returns the associated link.
void setLinkTarget (AnchorTarget target)
 Sets the link target.
AnchorTarget linkTarget () const
 Returns the link target.
void setPopupMenu (WPopupMenu *menu)
 Sets a sub menu for the item.
WPopupMenupopupMenu () const
 Returns the sub menu.
void setChecked (bool checked)
 Sets the checked state.
bool isChecked () const
 Returns the checked state.
void setSelectable (bool selectable)
 Sets whether the menu item can be selected.
bool isSelectable () const
 Returns whether the menu item can be selected.
void setData (void *data)
 Sets associated additional data with the item.
void * data () const
 Returns additional data of the item.
Signal< WPopupMenuItem * > & triggered ()
 Signal emitted when an item is activated.
virtual void load ()
 Loads content just before the widget is used.
virtual void setDisabled (bool disabled)
 Sets whether the widget is disabled.
- Public Member Functions inherited from Wt::WCompositeWidget
 WCompositeWidget (WContainerWidget *parent=0)
 Creates a WCompositeWidget.
 WCompositeWidget (WWidget *implementation, WContainerWidget *parent)
 Creates a WCompositeWidget with given implementation.
virtual const std::string id () const
 Returns the (unique) identifier for this object.
virtual void setPositionScheme (PositionScheme scheme)
 Sets the CSS position scheme.
virtual PositionScheme positionScheme () const
 Returns the CSS position scheme.
virtual void setOffsets (const WLength &offset, WFlags< Side > sides=All)
 Sets CSS offsets for a non-statically positioned widget.
virtual WLength offset (Side s) const
 Returns a CSS offset.
virtual void resize (const WLength &width, const WLength &height)
 Resizes the widget.
virtual WLength width () const
 Returns the width.
virtual WLength height () const
 Returns the height.
virtual void setMinimumSize (const WLength &width, const WLength &height)
 Sets a minimum size.
virtual WLength minimumWidth () const
 Returns the minimum width.
virtual WLength minimumHeight () const
 Returns the minimum height.
virtual void setMaximumSize (const WLength &width, const WLength &height)
 Sets a maximum size.
virtual WLength maximumWidth () const
 Returns the maximum width.
virtual WLength maximumHeight () const
 Returns the maximum height.
virtual void setLineHeight (const WLength &height)
 Sets the CSS line height for contained text.
virtual WLength lineHeight () const
 Returns the CSS line height for contained text.
virtual void setFloatSide (Side s)
 Specifies a CSS float side.
virtual Side floatSide () const
 Returns the CSS float side.
virtual void setClearSides (WFlags< Side > sides)
 Sets the sides that should be cleared of floats.
virtual WFlags< SideclearSides () const
 Returns the sides that should remain empty.
virtual void setMargin (const WLength &margin, WFlags< Side > sides=All)
 Sets CSS margins around the widget.
virtual WLength margin (Side side) const
 Returns a CSS margin set.
virtual void setHiddenKeepsGeometry (bool enabled)
 Sets whether the widget keeps its geometry when hidden.
virtual bool hiddenKeepsGeometry () const
 Returns whether the widget keeps its geometry when hidden.
virtual void setHidden (bool hidden, const WAnimation &animation=WAnimation())
 Hides or shows the widget.
virtual bool isHidden () const
 Returns whether the widget is set hidden.
virtual bool isVisible () const
 Returns whether the widget is visible.
virtual bool isDisabled () const
 Returns whether the widget is set disabled.
virtual bool isEnabled () const
 Returns whether the widget is enabled.
virtual void setPopup (bool popup)
 Lets the widget overlay over other sibling widgets.
virtual bool isPopup () const
 Returns whether the widget is overlayed.
virtual void setInline (bool isInline)
 Sets whether the widget is displayed inline or as a block.
virtual bool isInline () const
 Returns whether the widget is displayed inline or as block.
virtual void setDecorationStyle (const WCssDecorationStyle &style)
 Sets a CSS decoration style.
virtual WCssDecorationStyledecorationStyle ()
 Returns the decoration style of this widget.
virtual void setStyleClass (const WString &styleClass)
 Sets (one or more) CSS style classes.
virtual WString styleClass () const
 Returns the CSS style class.
virtual void addStyleClass (const WString &styleClass, bool force=false)
 Adds a CSS style class.
virtual void removeStyleClass (const WString &styleClass, bool force=false)
 Removes a CSS style class.
virtual void setVerticalAlignment (AlignmentFlag alignment, const WLength &length=WLength::Auto)
 Sets the vertical alignment.
virtual AlignmentFlag verticalAlignment () const
 Returns the vertical alignment.
virtual WLength verticalAlignmentLength () const
 Returns the fixed vertical alignment that was set.
virtual void setToolTip (const WString &text, TextFormat textFormat=PlainText)
 Sets a tooltip.
virtual WString toolTip () const
 Returns the tooltip.
virtual void refresh ()
 Refresh the widget.
virtual void setAttributeValue (const std::string &name, const WString &value)
 Sets an attribute value.
virtual WString attributeValue (const std::string &name) const
 Returns an attribute value.
virtual void setJavaScriptMember (const std::string &name, const std::string &value)
 Sets a JavaScript member.
virtual std::string javaScriptMember (const std::string &name) const
 Returns the value of a JavaScript member.
virtual void callJavaScriptMember (const std::string &name, const std::string &args)
 Calls a JavaScript member.
virtual bool loaded () const
 Returns whether this widget has been loaded.
virtual void setTabIndex (int index)
 Sets the tab index.
virtual int tabIndex () const
 Returns the tab index.
virtual void setId (const std::string &id)
 Sets the CSS Id.
virtual WWidgetfind (const std::string &name)
 Finds a descendent widget by name.
virtual void doJavaScript (const std::string &js)
 Executes the given JavaScript statements when the widget is rendered or updated.
virtual void propagateSetEnabled (bool enabled)
 Propagates that a widget was enabled or disabled through children.
- Public Member Functions inherited from Wt::WWidget
virtual ~WWidget ()
 Destructor.
WWidgetparent () const
 Returns the parent widget.
void setWidth (const WLength &width)
 Sets the width.
void setHeight (const WLength &height)
 Sets the height.
virtual void positionAt (const WWidget *widget, Orientation orientation=Vertical)
 Positions a widget next to another widget.
std::string jsRef () const
 Returns a JavaScript expression to the corresponding DOM node.
virtual void acceptDrops (const std::string &mimeType, const WString &hoverStyleClass=WString())
 Sets a mime type to be accepted for dropping.
virtual void stopAcceptDrops (const std::string &mimeType)
 Indicates that a mime type is no longer accepted for dropping.
virtual void htmlText (std::ostream &out)
 Streams the (X)HTML representation.
bool isRendered () const
 Returns whether the widget is rendered.
void hide ()
 Hides the widget.
void animateHide (const WAnimation &animation)
 Hides the widget using an animation.
void show ()
 Shows the widget.
void animateShow (const WAnimation &animation)
 Shows the widget using an animation.
void enable ()
 Enables the widget.
void disable ()
 Disable thes widget.
bool layoutSizeAware () const
 Returns whether the widget is layout size aware.
- Public Member Functions inherited from Wt::WObject
 WObject (WObject *parent=0)
 Create a WObject with a given parent object.
virtual ~WObject ()
 Destructor.
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.

Additional Inherited Members

- Protected Member Functions inherited from Wt::WCompositeWidget
virtual void enableAjax ()
 Progresses to an Ajax-enabled widget.
void setImplementation (WWidget *widget)
 Set the implementation widget.
WWidgetimplementation ()
 Get the implementation widget.
virtual int boxPadding (Orientation orientation) const
 Returns the widget's built-in padding.
virtual int boxBorder (Orientation orientation) const
 Returns the widget's built-in border width.
- Protected Member Functions inherited from Wt::WWidget
void setLayoutSizeAware (bool sizeAware)
 Sets the widget to be aware of its size set by a layout manager.
virtual void layoutSizeChanged (int width, int height)
 Virtual method that indicates a size change.
 WWidget (WContainerWidget *parent=0)
 Creates a widget.
virtual void dropEvent (WDropEvent dropEvent)
 Handles a drop event.
virtual WStatelessSlot * getStateless (Method method)
 On-demand stateless slot implementation.

Detailed Description

An item in a popup menu.

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 "Wt-item" to "Wt-selected".

See also:
WPopupMenu

Constructor & Destructor Documentation

Wt::WPopupMenuItem::WPopupMenuItem ( const WString text)

Creates a new item with given text.

See also:
WPopupMenu::addItem(const WString& text)
Wt::WPopupMenuItem::WPopupMenuItem ( const std::string &  iconPath,
const WString text 
)

Creates a new item with given icon and text.

The icon is displayed left to the text.

Note:
The icon should have a width of 16 pixels.
See also:
WPopupMenu::addItem(const std::string& iconPath, const WString& text)

Member Function Documentation

std::string Wt::WPopupMenuItem::icon ( )

Returns the item icon path.

See also:
setIcon()
bool Wt::WPopupMenuItem::isCheckable ( ) const

Returns whether the item is checkable.

See also:
setCheckable()
bool Wt::WPopupMenuItem::isChecked ( ) const

Returns the checked state.

This is only used when isCheckable() == true.

See also:
setChecked(bool), isCheckable()
bool Wt::WPopupMenuItem::isSelectable ( ) const

Returns whether the menu item can be selected.

See also:
setSelectable()
WLink Wt::WPopupMenuItem::link ( ) const

Returns the associated link.

See also:
setLink()
AnchorTarget Wt::WPopupMenuItem::linkTarget ( ) const

Returns the link target.

See also:
setLinkTarget()
void Wt::WPopupMenuItem::load ( )
virtual

Loads content just before the widget is used.

When the widget is inserted in the widget hierarchy, this method is called. Widgets that get inserted in the widget hierarchy will be rendered. Visible widgets are rendered immediately, and invisible widgets in the back-ground (or not for a plain HTML session). 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 delay loading of resource-intensive contents.

During the life-time of a widget, this method may be called multiple times, so you should make sure that you do a deferred initializiation only once.

Reimplemented from Wt::WCompositeWidget.

WPopupMenu* Wt::WPopupMenuItem::popupMenu ( ) const

Returns the sub menu.

See also:
setPopupMenu()
void Wt::WPopupMenuItem::setCheckable ( bool  checkable)

Sets 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).

See also:
setChecked(), isChecked()
void Wt::WPopupMenuItem::setChecked ( bool  checked)

Sets the checked state.

This is only used when isCheckable() == true.

See also:
setCheckable(bool), isCheckable()
void Wt::WPopupMenuItem::setDisabled ( bool  disabled)
virtual

Sets whether the widget is disabled.

Enables or disables the widget (including all its descendant widgets). setDisabled(false) will enable this widget and all descendant widgets that are not disabled. A widget is only enabled if it and all its ancestors in the widget tree are disabled.

Typically, a disabled form widget will not allow changing the value, and disabled widgets will not react to mouse click events.

See also:
disable(), enable()

Reimplemented from Wt::WCompositeWidget.

void Wt::WPopupMenuItem::setIcon ( const std::string &  path)

Sets the item icon path.

The icon should have a width of 16 pixels.

See also:
setText()
void Wt::WPopupMenuItem::setLink ( const WLink link)

Associates a link with the item.

You may turn the item into an anchor by specifying an link for it. The link may point to a URL, a resource, or an internal path.

The default link is a null link, which disables the anchor-like functionality.

void Wt::WPopupMenuItem::setLinkTarget ( AnchorTarget  target)

Sets the link target.

See also:
setLink()
void Wt::WPopupMenuItem::setPopupMenu ( WPopupMenu menu)

Sets a sub menu for the item.

Sets a submenu for the item. Ownership of the submenu is transferred to the item.

See also:
popupMenu()
void Wt::WPopupMenuItem::setSelectable ( bool  selectable)
virtual

Sets whether the menu item can be selected.

Only a menu item that can be selected can be the result of a popup menu selection.

The default value is true for a normal menu item, and false for a menu item that has a submenu.

An item that is selectable but is disabled can still not be selected.

Reimplemented from Wt::WCompositeWidget.

void Wt::WPopupMenuItem::setText ( const WString text)

Sets the item text.

See also:
setIcon()
const WString & Wt::WPopupMenuItem::text ( ) const

Returns the item text.

See also:
setText()
Signal<WPopupMenuItem *>& Wt::WPopupMenuItem::triggered ( )

Signal emitted when an item is activated.

Returns this item as argument.

See also:
WPopupMenu::triggered()

Generated on Sun May 27 2012 for the C++ Web Toolkit (Wt) by doxygen 1.8.1