Woopsi 1.0
GUI Framework for Nintendo DS Homebrew
|
#include <contextmenu.h>
Public Member Functions | |
ContextMenu (GadgetStyle *style=NULL) | |
virtual void | addOption (const WoopsiString &text, u32 value) |
virtual void | reset () |
void | setOpener (Gadget *gadget) |
Gadget * | getOpener () |
virtual void | getPreferredDimensions (Rect &rect) const |
virtual void | handleReleaseEvent (const GadgetEventArgs &e) |
virtual void | handleReleaseOutsideEvent (const GadgetEventArgs &e) |
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.
WoopsiUI::ContextMenu::ContextMenu | ( | GadgetStyle * | style = NULL | ) |
Constructor.
style | The 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. |
virtual void WoopsiUI::ContextMenu::addOption | ( | const WoopsiString & | text, |
u32 | value | ||
) | [virtual] |
Add a new menu item to the gadget.
text | Text to show in the item. |
value | The value of the item. |
Gadget* WoopsiUI::ContextMenu::getOpener | ( | ) | [inline] |
Get 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.
rect | Reference 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.
e | The event arguments. |
Reimplemented from WoopsiUI::GadgetEventHandler.
virtual void WoopsiUI::ContextMenu::handleReleaseOutsideEvent | ( | const GadgetEventArgs & | e | ) | [virtual] |
Handles events raised by the gadget's sub-gadgets.
e | The 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.
gadget | Pointer to the gadget that opened the menu. |