PixelLightAPI  .
Public Member Functions | Protected Attributes
PLGui::Menu Class Reference

Abstract representation of a menu structure. More...

#include <Menu.h>

Inheritance diagram for PLGui::Menu:
Inheritance graph
[legend]

List of all members.

Public Member Functions

PLGUI_API Menu (Gui &cGui)
 Constructor.
virtual PLGUI_API ~Menu ()
 Destructor.
PLGUI_API void Clear ()
 Clear menu.
PLGUI_API const
PLCore::Container< MenuItem * > & 
GetItems () const
 Get items.
PLGUI_API PLCore::int32 GetShortcutItem (char nShortcut) const
 Get item that belongs to a certain shortcut.
PLGUI_API void AddItem (MenuItem *pItem, bool bDelete=true)
 Adds a new item to the menu.
PLGUI_API void AddItemAtIndex (PLCore::uint32 nIndex, MenuItem *pItem, bool bDelete=true)
 Adds a new item to the menu at a specific index.
PLGUI_API void RemoveItem (MenuItem *pItem)
 Removes an item from the menu.
PLGUI_API MenuItemAddItem (const PLCore::String &sText)
 Adds a standard item with a text.
PLGUI_API MenuItemAddItem (const PLCore::String &sText, const Image &cIcon)
 Adds a standard item with a text and an icon.
PLGUI_API MenuItemAddSeparator ()
 Adds a separator item to the menu.
PLGUI_API MenuItemAddSubMenu (Menu *pMenu, bool bDelete=true)
 Adds a sub menu to the menu.

Protected Attributes

PLCore::List< MenuItem * > m_lstItems
PLCore::List< MenuItem * > m_lstNoDeletion

Detailed Description

Abstract representation of a menu structure.


Constructor & Destructor Documentation

PLGUI_API PLGui::Menu::Menu ( Gui cGui)

Constructor.

Parameters:
[in]cGuiOwner GUI
virtual PLGUI_API PLGui::Menu::~Menu ( ) [virtual]

Destructor.


Member Function Documentation

PLGUI_API void PLGui::Menu::Clear ( )

Clear menu.

PLGUI_API const PLCore::Container<MenuItem*>& PLGui::Menu::GetItems ( ) const

Get items.

Returns:
List of items
PLGUI_API PLCore::int32 PLGui::Menu::GetShortcutItem ( char  nShortcut) const

Get item that belongs to a certain shortcut.

Parameters:
[in]nShortcutShortcut (ASCII)
Returns:
Index of item, or -1
PLGUI_API void PLGui::Menu::AddItem ( MenuItem pItem,
bool  bDelete = true 
)

Adds a new item to the menu.

Parameters:
[in]pItemPointer to the menu item (must be valid!)
[in]bDelete'true' if the menu item shall be deleted automatically, else 'false'
PLGUI_API void PLGui::Menu::AddItemAtIndex ( PLCore::uint32  nIndex,
MenuItem pItem,
bool  bDelete = true 
)

Adds a new item to the menu at a specific index.

Parameters:
[in]nIndexIndex at which the menu item will be inserted
[in]pItemPointer to the menu item (must be valid!)
[in]bDelete'true' if the menu item shall be deleted automatically, else 'false'
Remarks:
If nIndex is greater or equal to the number of elements in the menu, the new item will be added at the end of the menu.
PLGUI_API void PLGui::Menu::RemoveItem ( MenuItem pItem)

Removes an item from the menu.

Parameters:
[in]pItemPointer to the menu item (must be valid!)
PLGUI_API MenuItem* PLGui::Menu::AddItem ( const PLCore::String sText)

Adds a standard item with a text.

Parameters:
[in]sTextText of the menu item
Returns:
Item
PLGUI_API MenuItem* PLGui::Menu::AddItem ( const PLCore::String sText,
const Image cIcon 
)

Adds a standard item with a text and an icon.

Parameters:
[in]sTextText of the menu item
[in]cIconIcon of the menu item
Returns:
Item

Adds a separator item to the menu.

Returns:
Item
PLGUI_API MenuItem* PLGui::Menu::AddSubMenu ( Menu pMenu,
bool  bDelete = true 
)

Adds a sub menu to the menu.

Parameters:
[in]pMenuPointer to the sub menu (must be valid!)
[in]bDelete'true' if the menu item shall be deleted automatically, else 'false'
Returns:
Item
Remarks:
Usually, bDelete shall be set to 'true', so you don't have to think about deleting any create menu items at all. Only in rare cases, e.g. if you want a recursive menu structure (a menu is submenu of itself or one of it's submenus), you have to set bDelete to false to make sure that the submenu is deleted only once.

Member Data Documentation

List of menu items

List of menu items that are not automatically deleted


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:32
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported