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

# wkgl::MenuItem Class Reference

A single item in a menu. More...

`#include <MenuItem.h>`

Inheritance diagram for wkgl::MenuItem:

List of all members.

## Public Methods
| MenuItem (const char *label)
| Creates a new menu item.
virtual | ~MenuItem ()
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.
virtual BOOL | create (MenuItem *parent)
| Creates the menu item.
## Protected Attributes
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
UINT | command_inc = 40001
| Increments for every item created.

## Detailed Description

A single item in a menu.

Author:
  Micheal Nooner.

To allow navigation of a menu with the keyboard, place an & infront of the letter you want to the item to be associated with. The letter will be underlined to show you what letter is associated with what item. For example, if you passed, "&File" to a Menu and "E&xit" to a MenuItem, then when you pressed the ALT key followded with an F then the File menu would open. If you then pressed the X key the Exit menu item would be selected and the its callback would be called. Menu items recieve the following events:

1. WM_COMMAND -- the user selected a menu item.

## Constructor & Destructor Documentation

MenuItem::MenuItem | ( | const char * | label | ) |

  | Creates a new menu item. Parameters:
  label | The label for this menu item.

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

## Member Function Documentation

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

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

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

  | Creates the menu item. Parameters:
  parent | The parent of this menu item.
Returns: TRUE if this item was successfully created. Reimplemented in wkgl::Menu, and wkgl::MenuBar.

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

  | 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]`

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

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

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

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

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

## Member Data Documentation

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

| The command id of the menu.

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

| Increments for every item created.

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

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

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

| The label of the menu.

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

| The callbacks to use for this item.

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

- MenuItem.h
- MenuItem.cpp