# WoopsiUI::ContextMenu Class Reference

`#include <contextmenu.h>`

Inheritance diagram for WoopsiUI::ContextMenu:

List of all members.

## 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 ()

## 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 | ( | FontBase * | font = `NULL` | ) |

Constructor.

Parameters:

  | font | The font to use with the context menu.

## Member Function Documentation

virtual bool WoopsiUI::ContextMenu::blur | ( |  | ) | `[inline, virtual]`

Remove focus from the gadget.

Returns:
  True if the gadget lost focus correctly.

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::ContextMenu::draw | ( | Rect | clipRect | ) | `[virtual]`

Draw the region of the menu within the clipping rect.

Parameters:

  | clipRect | The clipping rect to limit drawing to.

Reimplemented from WoopsiUI::Gadget.

virtual bool WoopsiUI::ContextMenu::focus | ( |  | ) | `[inline, virtual]`

Give the gadget focus.

Returns:
  True if the gadget received focus correctly.

Reimplemented from WoopsiUI::Gadget.

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::handleReleaseEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

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

Parameters:

  | e | The event arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual ContextMenuItem* WoopsiUI::ContextMenu::newMenuItem | ( | const char * | text,
|  | u32 | value |
| ) |  |  | `[virtual]`

Add a new menu item to the gadget.

Parameters:

  | text | Text to show in the item.
  | value | The value of the item.

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

Clear all items from the menu and reset it.

virtual bool WoopsiUI::ContextMenu::resize | ( | u16 | width,
|  | u16 | height |
| ) |  |  | `[virtual]`

Resize the gadget to the new dimensions.

Parameters:

  | width | The new width.
  | height | The new height.

Returns:
  True if the resize was successful.

Reimplemented from WoopsiUI::Gadget.

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

Set the gadget that opened the menu.

Parameters:

  | gadget | Pointer to the gadget that opened the menu.

The documentation for this class was generated from the following file:

- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.40/Woopsi/libwoopsi/include/contextmenu.h