Main Page Namespace List Class Hierarchy Compound List File List Namespace Members Compound Members File Members Related Pages

# wkgl::PopupMenu Class Reference

This class allows you to display a popup menu. \Author Micheal Nooner. A popup menu is usually shown when the user right clicks in a specific area of a window. More...

`#include <PopupMenu.h>`

Inheritance diagram for wkgl::PopupMenu:

List of all members.

## Public Methods
| PopupMenu (Window *owner, BOOL autorespond=FALSE)
| Creates a new popup menu.
virtual | ~PopupMenu ()
virtual BOOL | showMenuAt (int x, int y)
| Shows the menu at the given screen coordinates.
virtual BOOL | showMenuHere ()
| Shows the menu at the current cursor location.
virtual BOOL | callBack (Component *com, UINT message, WPARAM wParam, LPARAM lParam)
| Implement this method to have a callback in your class.
virtual void | append (MenuItem *mitem)
| Appends the given menu item to the menu.
virtual BOOL | create (MenuItem *parent)
| Creates the menu.
virtual HMENU | getMenuHandle ()
| Returns the system handle for this item.
virtual UINT | getCommand ()
| Returns the command identifier of this item.
virtual char * | getLabelText ()
| Returns the label of this item.
virtual BOOL | fireMenuEvents (UINT message)
| Calls all the callbacks found in MenuItem::mcallbacks.
virtual void | addMenuCallBack (MENUCALLBACK mcallback)
| Adds a menu callback.
## Protected Attributes
Window * | owner
| The owner of this popup window.
BOOL | respond
| Flag saying whether to autmatically respond to WM_CONTEXTMENU events.
std::vector< MenuItem * > | child_items
| The menu items that have been appended into this menu.
HMENU | hmenu
| The system handle to the menu item, can be NULL.
String * | label
| The label of the menu.
UINT | command
| The command id of the menu.
std::vector< MENUCALLBACK > | mcallbacks
| The callbacks to use for this item.
## Static Protected Attributes
std::vector< MENUITEM * > | reg_menu_items
| A list of all menu items.
UINT | command_inc = 40001
| Increments for every item created.

## Detailed Description

This class allows you to display a popup menu. \Author Micheal Nooner. A popup menu is usually shown when the user right clicks in a specific area of a window.

## Constructor & Destructor Documentation

PopupMenu::PopupMenu | ( | Window * | owner,
|  | BOOL | autorespond = FALSE
| ) |

  | Creates a new popup menu. Parameters:
  owner | The window to recieve events from.
  autorespond | if TRUE then the menu will automatically show at the current cursor location when the owner receives the WM_CONTEXTMENU event.

PopupMenu::~PopupMenu | ( |  | ) | `[virtual]`

## Member Function Documentation

void MenuItem::addMenuCallBack | ( | MENUCALLBACK | mcallback | ) | `[virtual, inherited]`

  | Adds a menu callback. Parameters:
  mcallback | Adds it to the callbacks list.

void Menu::append | ( | MenuItem * | mitem | ) | `[virtual, inherited]`

  | Appends the given menu item to the menu. Parameters:
  mitem | The item to add to the menu.

BOOL PopupMenu::callBack | ( | Component * | com,
|  | UINT | message,
|  | WPARAM | wParam,
|  | LPARAM | lParam
| ) | `[virtual]`

  | Implement this method to have a callback in your class. Parameters:
  com | A pointer to the component that generated the message.
  message | The windows integer event.
  wParam | contain information about the event, see windows docs.
  lParam | contain information about the event, see windows docs.
Returns: TRUE if the event was handled, FALSE otherwise. Reimplemented from wkgl::Menu.

BOOL Menu::create | ( | MenuItem * | parent | ) | `[virtual, inherited]`

  | Creates the menu. Parameters:
  parent | The parent of this menu.
Returns: TRUE if this menu was created correctly and all the menu items were created correctly. Reimplemented from wkgl::MenuItem. Reimplemented in wkgl::MenuBar.

BOOL MenuItem::fireMenuEvents | ( | UINT | message | ) | `[virtual, inherited]`

  | Calls all the callbacks found in MenuItem::mcallbacks. Parameters:
  message | The message to pass to the callbacks.
Returns: TRUE if the event was handled at least once.

UINT MenuItem::getCommand | ( |  | ) | `[virtual, inherited]`

| Returns the command identifier of this item. Returns: The system command id for this item.

char * MenuItem::getLabelText | ( |  | ) | `[virtual, inherited]`

| Returns the label of this item. Returns: The label for this item.

HMENU MenuItem::getMenuHandle | ( |  | ) | `[virtual, inherited]`

| Returns the system handle for this item. Returns: The system handle for this item.

BOOL PopupMenu::showMenuAt | ( | int | x,
|  | int | y
| ) | `[virtual]`

  | Shows the menu at the given screen coordinates. Parameters:
  x | The number of pixels from the left side of the screen.
  y | The number of pixels from the right sid of the screen.
Returns: TRUE if the menu is shown.

BOOL PopupMenu::showMenuHere | ( |  | ) | `[virtual]`

| Shows the menu at the current cursor location. Returns: TRUE if the menu is shown.

## Member Data Documentation

std::vector<MenuItem*> wkgl::Menu::child_items`[protected, inherited]`

| The menu items that have been appended into this menu.

UINT wkgl::MenuItem::command`[protected, inherited]`

| The command id of the menu.

UINT MenuItem::command_inc = 40001`[static, protected, inherited]`

| Increments for every item created.

HMENU wkgl::MenuItem::hmenu`[protected, inherited]`

| The system handle to the menu item, can be NULL.

String* wkgl::MenuItem::label`[protected, inherited]`

| The label of the menu.

std::vector<MENUCALLBACK> wkgl::MenuItem::mcallbacks`[protected, inherited]`

| The callbacks to use for this item.

Window* wkgl::PopupMenu::owner`[protected]`

| The owner of this popup window.

std::vector< MENUITEM * > Menu::reg_menu_items`[static, protected, inherited]`

| A list of all menu items.

BOOL wkgl::PopupMenu::respond`[protected]`

| Flag saying whether to autmatically respond to WM_CONTEXTMENU events.

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

- PopupMenu.h
- PopupMenu.cpp