Woopsi 1.3
Nintendo DS Gui Framework
Public Member Functions
WoopsiUI::ContextMenu Class Reference

#include <libwoopsi/include/contextmenu.h>

Inheritance diagram for WoopsiUI::ContextMenu:
WoopsiUI::Gadget WoopsiUI::GadgetEventHandler

List of all members.

Public Member Functions

 ContextMenu (GadgetStyle *style=NULL)
virtual void addOption (const WoopsiString &text, u32 value)
virtual void reset ()
void setOpener (Gadget *gadget)
GadgetgetOpener ()
virtual void getPreferredDimensions (Rect &rect) const
virtual void handleReleaseEvent (const GadgetEventArgs &e)
virtual void handleReleaseOutsideEvent (const GadgetEventArgs &e)

Detailed Description

The context menu is implemented as a member of the Woopsi class. It should not be instantiated elsewhere. It offers a simple context-aware menu that opens when the user holds down a modifier key when tapping a gadget.


Constructor & Destructor Documentation

WoopsiUI::ContextMenu::ContextMenu ( GadgetStyle style = NULL)

Constructor.

Parameters:
styleThe style that the gadget should use. If this is not specified, the gadget will use the values stored in the global defaultGadgetStyle object. The gadget will copy the properties of the style into its own internal style object.

Member Function Documentation

virtual void WoopsiUI::ContextMenu::addOption ( const WoopsiString text,
u32  value 
) [virtual]

Add a new menu item to the gadget.

Parameters:
textText to show in the item.
valueThe value of the item.
Gadget* WoopsiUI::ContextMenu::getOpener ( ) [inline]

Get the gadget that opened the menu.

Returns:
Pointer to the gadget that opened the menu.
virtual void WoopsiUI::ContextMenu::getPreferredDimensions ( Rect rect) const [virtual]

Insert the dimensions that this gadget wants to have into the rect passed in as a parameter. All co-ordinates are relative to the gadget's parent. Value is based on the length of the largest string in the set of options.

Parameters:
rectReference to a rect to populate with data.

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::ContextMenu::handleReleaseEvent ( const GadgetEventArgs e) [virtual]

Handles events raised by the gadget's sub-gadgets.

Parameters:
eThe event arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::ContextMenu::handleReleaseOutsideEvent ( const GadgetEventArgs e) [virtual]

Handles events raised by the gadget's sub-gadgets.

Parameters:
eThe event arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::ContextMenu::reset ( ) [virtual]

Clear all items from the menu and reset it.

void WoopsiUI::ContextMenu::setOpener ( Gadget gadget) [inline]

Set the gadget that opened the menu.

Parameters:
gadgetPointer to the gadget that opened the menu.

The documentation for this class was generated from the following file:
 All Classes Functions Variables Enumerations Enumerator