omgui::MenuItem Class Reference

#include <omgui/menuitems.h>

Inherits omgui::Object.

Inherited by omgui::Separator.

List of all members.


Detailed Description

A MenuItem represents a selection within a menu. MenuItem's are given a menu_id when they are created. This identifier value is used in events to allow you to determine which MenuItem the user selected.

MenuItem labels can have a mnemonic character which is used to select the menu item when navigating the Menu with the keyboard. The mnemonic character within the label is identified by an & infront of that character. For example, in the label "&File", the 'F' character is the mnemonic. If you need to display a literal '&' within a label, using "&&File" which will not have a mnemonic and will display as "&File" on the menu item. If you want a '&' character to be a mnemonic, use three '&' characters. "&&&File" will create the menu item "&File" where '&' is the mnemonic character. Attempting to specify more than one mnemonic character within the label, like "&Fi&le", results in undefined behavior.

Mac OS does not support menu mnemonics in this fashion, so any '&' appearing in the menu name which would create a mnemonic will simply be ignored. The "&&" sequence still prints a literal '&'.

Public Types

typedef omgui::api::MenuItem api_type

Public Member Functions

void add_ref ()
void disable ()
void enable (bool value=true)
bool enabled () const
menu_id get_id () const
api_typeget_impl () const
string get_label () const
void release ()
void set_label (const string &label)
 ~MenuItem ()

Static Public Member Functions

static MenuItemcreate (menu_id id, const string &label)
static MenuItemcreate (object_id obj_id, menu_id id, const string &label)

Protected Member Functions

 MenuItem (object_id id, api_type *impl)
 MenuItem (object_id obj_id, menu_id id, const string &label)

Private Attributes

api_typem_impl


Member Typedef Documentation

Reimplemented in omgui::Separator.


Constructor & Destructor Documentation

omgui::MenuItem::MenuItem ( object_id  obj_id,
menu_id  id,
const string label 
) [protected]

Note:
This constructor is implemented by the current platform

omgui::MenuItem::MenuItem ( object_id  id,
api_type impl 
) [protected]

omgui::MenuItem::~MenuItem (  ) 


Member Function Documentation

void omgui::MenuItem::add_ref (  )  [inline, virtual]

Implements omgui::RefCountable.

static MenuItem* omgui::MenuItem::create ( menu_id  id,
const string label 
) [inline, static]

Creates a MenuItem with the given menu_id and label. The MenuItem will be creating with an automatically generated object_id.

MenuItem * omgui::MenuItem::create ( object_id  obj_id,
menu_id  id,
const string label 
) [static]

Creates a MenuItem with the given object_id, menu_id and label.

void omgui::MenuItem::disable (  )  [inline]

Disables the menu item

void omgui::MenuItem::enable ( bool  value = true  ) 

Enables or disables the menu item. Disabled menu items cannot be selected by the user.

bool omgui::MenuItem::enabled (  )  const

Returns:
Whether the menu is enabled or not

menu_id omgui::MenuItem::get_id (  )  const

Returns:
The menu idenfitier for this menu

Reimplemented from omgui::Object.

MenuItem::api_type * omgui::MenuItem::get_impl (  )  const

string omgui::MenuItem::get_label (  )  const

Returns:
This MenuItem's label

void omgui::MenuItem::release (  )  [inline, virtual]

Implements omgui::RefCountable.

void omgui::MenuItem::set_label ( const string label  ) 

Sets the label for this menu item.


Member Data Documentation


doxygen SourceForge.net Logo