Irrlicht Engine: irr::gui::IGUIContextMenu Class Reference

Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials

# irr::gui::IGUIContextMenu Class Reference

GUI Context menu interface. More...

`#include <IGUIContextMenu.h>`

Inheritance diagram for irr::gui::IGUIContextMenu:

List of all members.

## Public Member Functions
virtual u32 | addItem (const wchar_t *text, s32 commandId=-1, bool enabled=true, bool hasSubMenu=false, bool checked=false, bool autoChecking=false)=0
| Adds a menu item.
virtual void | addSeparator ()=0
| Adds a separator item to the menu.
virtual s32 | findItemWithCommandId (s32 commandId, u32 idxStartSearch=0) const =0
| Find an item by it's CommandID.
virtual ECONTEXT_MENU_CLOSE | getCloseHandling () const =0
| get current behaviour when the menu will be closed
virtual bool | getItemAutoChecking (u32 idx) const =0
| does the element change the checked status on clicking
virtual s32 | getItemCommandId (u32 idx) const =0
| Get the command id of a menu item.
virtual u32 | getItemCount () const =0
| Get amount of menu items.
virtual const wchar_t * | getItemText (u32 idx) const =0
| Get text of the menu item.
virtual s32 | getSelectedItem () const =0
| Get the selected item in the menu.
virtual IGUIContextMenu * | getSubMenu (u32 idx) const =0
| Get a pointer to the submenu of an item.
| IGUIContextMenu (IGUIEnvironment *environment, IGUIElement *parent, s32 id, core::rect< s32 > rectangle)
| constructor
virtual u32 | insertItem (u32 idx, const wchar_t *text, s32 commandId=-1, bool enabled=true, bool hasSubMenu=false, bool checked=false, bool autoChecking=false)=0
| Insert a menu item at specified position.
virtual bool | isItemChecked (u32 idx) const =0
| Check if a menu item is checked.
virtual bool | isItemEnabled (u32 idx) const =0
| Check if a menu item is enabled.
virtual void | removeAllItems ()=0
| Removes all menu items.
virtual void | removeItem (u32 idx)=0
| Removes a menu item.
virtual void | setCloseHandling (ECONTEXT_MENU_CLOSE onClose)=0
| set behaviour when menus are closed
virtual void | setEventParent (IGUIElement *parent)=0
| When an eventparent is set it receives events instead of the usual parent element.
virtual void | setItemAutoChecking (u32 idx, bool autoChecking)=0
| should the element change the checked status on clicking
virtual void | setItemChecked (u32 idx, bool enabled)=0
| Sets if the menu item should be checked.
virtual void | setItemCommandId (u32 idx, s32 id)=0
| Sets the command id of a menu item.
virtual void | setItemEnabled (u32 idx, bool enabled)=0
| Sets if the menu item should be enabled.
virtual void | setItemText (u32 idx, const wchar_t *text)=0
| Sets text of the menu item.

## Detailed Description

GUI Context menu interface.

Definition at line 31 of file IGUIContextMenu.h.

## Constructor & Destructor Documentation

irr::gui::IGUIContextMenu::IGUIContextMenu | ( | IGUIEnvironment * | environment,
|  | IGUIElement * | parent,
|  | s32 | id,
|  | core::rect< s32 > | rectangle |
| ) |  |  | `[inline]`

constructor

Definition at line 36 of file IGUIContextMenu.h.

## Member Function Documentation

virtual u32 irr::gui::IGUIContextMenu::addItem | ( | const wchar_t * | text,
|  | s32 | commandId = `-1`,
|  | bool | enabled = `true`,
|  | bool | hasSubMenu = `false`,
|  | bool | checked = `false`,
|  | bool | autoChecking = `false` |
| ) |  |  | `[pure virtual]`

Adds a menu item.

Parameters:

  | text,: | Text of menu item. Set this to 0 to create an separator instead of a real item, which is the same like calling addSeparator();
  | commandId,: | Command id of menu item, a simple id you may set to whatever you want.
  | enabled,: | Specifies if the menu item should be enabled.
  | hasSubMenu,: | Set this to true if there should be a submenu at this item. You can access this submenu via getSubMenu().
  | checked,: | Specifies if the menu item should be initially checked.
  | autoChecking,: | Specifies if the item should be checked by clicking

Returns:
  Returns the index of the new item

virtual void irr::gui::IGUIContextMenu::addSeparator | ( |  | ) | `[pure virtual]`

Adds a separator item to the menu.

virtual s32 irr::gui::IGUIContextMenu::findItemWithCommandId | ( | s32 | commandId,
|  | u32 | idxStartSearch = `0` |
| ) |  |  | const`[pure virtual]`

Find an item by it's CommandID.

Parameters:

  | commandId,: | We are looking for the first item which has this commandID
  | idxStartSearch,: | Start searching from this index.

Returns:
  Returns the index of the item when found or otherwise -1.

virtual ECONTEXT_MENU_CLOSE irr::gui::IGUIContextMenu::getCloseHandling | ( |  | ) | const`[pure virtual]`

get current behaviour when the menu will be closed

virtual bool irr::gui::IGUIContextMenu::getItemAutoChecking | ( | u32 | idx | ) | const`[pure virtual]`

does the element change the checked status on clicking

virtual s32 irr::gui::IGUIContextMenu::getItemCommandId | ( | u32 | idx | ) | const`[pure virtual]`

Get the command id of a menu item.

Parameters:

  | idx,: | Zero based index of the menu item

virtual u32 irr::gui::IGUIContextMenu::getItemCount | ( |  | ) | const`[pure virtual]`

Get amount of menu items.

virtual const wchar_t* irr::gui::IGUIContextMenu::getItemText | ( | u32 | idx | ) | const`[pure virtual]`

Get text of the menu item.

Parameters:

  | idx,: | Zero based index of the menu item

virtual s32 irr::gui::IGUIContextMenu::getSelectedItem | ( |  | ) | const`[pure virtual]`

Get the selected item in the menu.

Returns:
  Index of the selected item, -1 if none selected.

virtual IGUIContextMenu* irr::gui::IGUIContextMenu::getSubMenu | ( | u32 | idx | ) | const`[pure virtual]`

Get a pointer to the submenu of an item.

0 is returned if there is no submenu

Parameters:

  | idx,: | Zero based index of the menu item

Returns:
  Returns a pointer to the submenu of an item.

virtual u32 irr::gui::IGUIContextMenu::insertItem | ( | u32 | idx,
|  | const wchar_t * | text,
|  | s32 | commandId = `-1`,
|  | bool | enabled = `true`,
|  | bool | hasSubMenu = `false`,
|  | bool | checked = `false`,
|  | bool | autoChecking = `false` |
| ) |  |  | `[pure virtual]`

Insert a menu item at specified position.

Parameters:

  | idx,: | Position to insert the new element, should be smaller than itemcount otherwise the item is added to the end.
  | text,: | Text of menu item. Set this to 0 to create an separator instead of a real item, which is the same like calling addSeparator();
  | commandId,: | Command id of menu item, a simple id you may set to whatever you want.
  | enabled,: | Specifies if the menu item should be enabled.
  | hasSubMenu,: | Set this to true if there should be a submenu at this item. You can access this submenu via getSubMenu().
  | checked,: | Specifies if the menu item should be initially checked.
  | autoChecking,: | Specifies if the item should be checked by clicking

Returns:
  Returns the index of the new item

virtual bool irr::gui::IGUIContextMenu::isItemChecked | ( | u32 | idx | ) | const`[pure virtual]`

Check if a menu item is checked.

Parameters:

  | idx,: | Zero based index of the menu item

virtual bool irr::gui::IGUIContextMenu::isItemEnabled | ( | u32 | idx | ) | const`[pure virtual]`

Check if a menu item is enabled.

Parameters:

  | idx,: | Zero based index of the menu item

virtual void irr::gui::IGUIContextMenu::removeAllItems | ( |  | ) | `[pure virtual]`

Removes all menu items.

virtual void irr::gui::IGUIContextMenu::removeItem | ( | u32 | idx | ) | `[pure virtual]`

Removes a menu item.

Parameters:

  | idx,: | Zero based index of the menu item

virtual void irr::gui::IGUIContextMenu::setCloseHandling | ( | ECONTEXT_MENU_CLOSE | onClose | ) | `[pure virtual]`

set behaviour when menus are closed

virtual void irr::gui::IGUIContextMenu::setEventParent | ( | IGUIElement * | parent | ) | `[pure virtual]`

When an eventparent is set it receives events instead of the usual parent element.

virtual void irr::gui::IGUIContextMenu::setItemAutoChecking | ( | u32 | idx,
|  | bool | autoChecking |
| ) |  |  | `[pure virtual]`

should the element change the checked status on clicking

virtual void irr::gui::IGUIContextMenu::setItemChecked | ( | u32 | idx,
|  | bool | enabled |
| ) |  |  | `[pure virtual]`

Sets if the menu item should be checked.

Parameters:

  | idx,: | Zero based index of the menu item
  | enabled,: | True if it is enabled, otherwise false.

virtual void irr::gui::IGUIContextMenu::setItemCommandId | ( | u32 | idx,
|  | s32 | id |
| ) |  |  | `[pure virtual]`

Sets the command id of a menu item.

Parameters:

  | idx,: | Zero based index of the menu item
  | id,: | Command id of menu item, a simple id you may set to whatever you want.

virtual void irr::gui::IGUIContextMenu::setItemEnabled | ( | u32 | idx,
|  | bool | enabled |
| ) |  |  | `[pure virtual]`

Sets if the menu item should be enabled.

Parameters:

  | idx,: | Zero based index of the menu item
  | enabled,: | True if it is enabled, otherwise false.

virtual void irr::gui::IGUIContextMenu::setItemText | ( | u32 | idx,
|  | const wchar_t * | text |
| ) |  |  | `[pure virtual]`

Sets text of the menu item.

Parameters:

  | idx,: | Zero based index of the menu item
  | text,: | New text of the item.

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

- IGUIContextMenu.h

| The Irrlicht Engine Documentation © 2003-2010 by Nikolaus Gebhardt. Generated on Sun Oct 24 12:42:04 2010 by Doxygen (1.6.2)