#include <contextmenu.h>
Public Member Functions | |
ContextMenu (FontBase *font=NULL) | |
virtual void | handleReleaseEvent (const GadgetEventArgs &e) |
virtual ContextMenuItem * | newMenuItem (const char *text, u32 value) |
virtual void | draw (Rect clipRect) |
virtual bool | resize (u16 width, u16 height) |
virtual void | reset () |
void | setOpener (Gadget *gadget) |
Gadget * | getOpener () |
virtual bool | focus () |
virtual bool | blur () |
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.
ContextMenu::ContextMenu | ( | FontBase * | font = NULL |
) |
Constructor.
font | The font to use with the context menu. |
virtual bool WoopsiUI::ContextMenu::blur | ( | ) | [inline, virtual] |
Remove focus from the gadget.
Reimplemented from WoopsiUI::Gadget.
void ContextMenu::draw | ( | Rect | clipRect | ) | [virtual] |
Draw the region of the menu within the clipping rect.
clipRect | The clipping rect to limit drawing to. |
Reimplemented from WoopsiUI::Gadget.
virtual bool WoopsiUI::ContextMenu::focus | ( | ) | [inline, virtual] |
Give the gadget focus.
Reimplemented from WoopsiUI::Gadget.
Gadget* WoopsiUI::ContextMenu::getOpener | ( | ) | [inline] |
Get the gadget that opened the menu.
void ContextMenu::handleReleaseEvent | ( | const GadgetEventArgs & | e | ) | [virtual] |
Handles events raised by the gadget's sub-gadgets.
e | The event arguments. |
Reimplemented from WoopsiUI::GadgetEventHandler.
ContextMenuItem * ContextMenu::newMenuItem | ( | const char * | 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. |
void ContextMenu::reset | ( | ) | [virtual] |
Clear all items from the menu and reset it.
bool ContextMenu::resize | ( | u16 | width, | |
u16 | height | |||
) | [virtual] |
Resize the gadget to the new dimensions.
width | The new width. | |
height | The new height. |
Reimplemented from WoopsiUI::Gadget.
void WoopsiUI::ContextMenu::setOpener | ( | Gadget * | gadget | ) | [inline] |
Set the gadget that opened the menu.
gadget | Pointer to the gadget that opened the menu. |