Base Framework
Classes | Public Types | Public Member Functions | List of all members
Menu Class Reference

Menu. More...

#include <base/ui/Menu.h>

Inherits Object.

Public Types

enum  Flag {
  ENABLED = 1, CHECKED = 2, HIGHLIGHTED = 4, SEPARATOR = 8,
  STRING = 16, MENU = 32
}
 

Public Member Functions

 Menu ()
 
 Menu (const Menu &copy) noexcept
 
Menuoperator= (const Menu &assign) noexcept
 
bool isValid () const noexcept
 
OperatingSystem::Handle getHandle () const noexcept
 
unsigned int getNumberOfItems () const
 
unsigned int getIdentifier (unsigned int index) const
 
int getIndex (unsigned int identifier) const
 
unsigned int getFlags (unsigned int index) const
 
bool isSeparator (unsigned int index) const
 
bool hasMenu (unsigned int index) const
 
bool isEnabled (unsigned int identifier) const
 
bool isChecked (unsigned int identifier) const
 
bool isHighlighted (unsigned int identifier) const
 
Menu getMenu (unsigned int index)
 
void setEnabled (unsigned int index, bool enabled)
 
void setChecked (unsigned int index, bool checked)
 
void setHighlighted (unsigned int index, bool highlighted)
 
void enable (unsigned int index)
 
void disable (unsigned int index)
 
void check (unsigned int index)
 
void uncheck (unsigned int index)
 
void highlight (unsigned int index)
 
void unhighlight (unsigned int index)
 
void setName (unsigned int index, const String &name)
 
void setSubmenu (unsigned int identifier, const Menu &menu)
 
void insertSeparator (unsigned int index)
 
void appendSeparator ()
 
void insert (unsigned int index, const String &name, unsigned int identifier, unsigned int flags=ENABLED)
 
void append (const String &name, unsigned int identifier, unsigned int flags=ENABLED)
 
void appendMenu (const String &name, const Menu &menu, unsigned int flags=ENABLED)
 
void remove (unsigned int index)
 

Detailed Description

Menu.

Menu.

Version
1.0

Member Enumeration Documentation

◆ Flag

enum Menu::Flag
Enumerator
ENABLED 

Enabled menu item.

CHECKED 

Checked menu item.

HIGHLIGHTED 

Highlighted menu item.

SEPARATOR 

A separator.

STRING 

A string menu item.

MENU 

A menu item with a sub menu.

Constructor & Destructor Documentation

◆ Menu() [1/2]

Menu::Menu ( )

Creates an empty menu.

◆ Menu() [2/2]

Menu::Menu ( const Menu copy)
inlinenoexcept

Initializes menu from other menu.

Member Function Documentation

◆ append()

void Menu::append ( const String name,
unsigned int  identifier,
unsigned int  flags = ENABLED 
)

Appends a menu item to the menu.

Parameters
nameThe string value of the menu item.
identifierThe identifier of the menu item.
flagsThe flags of the menu item (a conbination of ENABLED, CHECKED, and HIGHLIGHTED).

◆ appendMenu()

void Menu::appendMenu ( const String name,
const Menu menu,
unsigned int  flags = ENABLED 
)

Appends a sub menu to the menu.

Parameters
nameThe string value of the menu item.
menuThe sub menu.
flagsThe flags of the menu item (a conbination of ENABLED, CHECKED, and HIGHLIGHTED).

◆ appendSeparator()

void Menu::appendSeparator ( )

Appends a separator to the menu.

◆ check()

void Menu::check ( unsigned int  index)
inline

Checks the menu item.

Parameters
indexThe index of the menu item.

◆ disable()

void Menu::disable ( unsigned int  index)
inline

Disables the menu item.

Parameters
indexThe index of the menu item.

◆ enable()

void Menu::enable ( unsigned int  index)
inline

Enables the menu item.

Parameters
indexThe index of the menu item.

◆ getFlags()

unsigned int Menu::getFlags ( unsigned int  index) const

Returns the flags describing the menu item.

Parameters
indexThe index of the menu item.

◆ getHandle()

OperatingSystem::Handle Menu::getHandle ( ) const
inlinenoexcept

Returns the opaque menu handle.

◆ getIdentifier()

unsigned int Menu::getIdentifier ( unsigned int  index) const

Returns the identifier of the specified menu item.

Parameters
indexThe index of the menu item.

◆ getIndex()

int Menu::getIndex ( unsigned int  identifier) const

Returns the index of the specified menu item.

Parameters
identifierThe identifier of the menu item.

◆ getMenu()

Menu Menu::getMenu ( unsigned int  index)

Returns the sub menu associated with the menu item.

Parameters
indexThe index of the menu item.

◆ getNumberOfItems()

unsigned int Menu::getNumberOfItems ( ) const

Returns the number of menu items.

◆ hasMenu()

bool Menu::hasMenu ( unsigned int  index) const
inline

Returns true if the menu item has a sub menu.

Parameters
indexThe index of the menu item.

◆ highlight()

void Menu::highlight ( unsigned int  index)
inline

Highlights the menu item.

Parameters
indexThe index of the menu item.

◆ insert()

void Menu::insert ( unsigned int  index,
const String name,
unsigned int  identifier,
unsigned int  flags = ENABLED 
)

Inserts a menu item at the specified index.

Parameters
indexThe index of the new menu item.
nameThe string value of the menu item.
identifierThe identifier of the menu item.
flagsThe flags of the menu item (a conbination of ENABLED, CHECKED, and HIGHLIGHTED).

◆ insertSeparator()

void Menu::insertSeparator ( unsigned int  index)

Inserts a separator at the specified index.

Parameters
indexThe index of the menu item.

◆ isChecked()

bool Menu::isChecked ( unsigned int  identifier) const
inline

Returns true if the menu item is checked.

Parameters
indexThe index of the menu item.

◆ isEnabled()

bool Menu::isEnabled ( unsigned int  identifier) const
inline

Returns true if the menu item is enabled.

Parameters
indexThe index of the menu item.

◆ isHighlighted()

bool Menu::isHighlighted ( unsigned int  identifier) const
inline

Returns true if the menu item is highlighted.

Parameters
indexThe index of the menu item.

◆ isSeparator()

bool Menu::isSeparator ( unsigned int  index) const
inline

Returns true if the menu item is a separator.

◆ isValid()

bool Menu::isValid ( ) const
inlinenoexcept

Returns true if the menu is valid.

◆ operator=()

Menu& Menu::operator= ( const Menu assign)
inlinenoexcept

Assignment of menu from other menu.

◆ remove()

void Menu::remove ( unsigned int  index)

Removes the menu item at the specified index from the menu.

Parameters
indexThe index of the menu item.

◆ setChecked()

void Menu::setChecked ( unsigned int  index,
bool  checked 
)

Sets the checked flag of the menu item.

Parameters
indexThe index of the menu item.
enabledThe value of the flag.

◆ setEnabled()

void Menu::setEnabled ( unsigned int  index,
bool  enabled 
)

Sets the enable flag of the menu item.

Parameters
indexThe index of the menu item.
enabledThe value of the flag.

◆ setHighlighted()

void Menu::setHighlighted ( unsigned int  index,
bool  highlighted 
)

Sets the highlighted flag of the menu item.

Parameters
indexThe index of the menu item.
enabledThe value of the flag.

◆ setName()

void Menu::setName ( unsigned int  index,
const String name 
)

Sets the string value of the menu item.

Parameters
indexThe index of the menu item.
nameThe new string value of the menu item.

◆ setSubmenu()

void Menu::setSubmenu ( unsigned int  identifier,
const Menu menu 
)

Sets the sub menu of the menu item.

Parameters
indexThe index of the menu item.
menuThe new sub menu the menu item.

◆ uncheck()

void Menu::uncheck ( unsigned int  index)
inline

Unchecks the menu item.

Parameters
indexThe index of the menu item.

◆ unhighlight()

void Menu::unhighlight ( unsigned int  index)
inline

Resets the highlight flag of the menu item.

Parameters
indexThe index of the menu item.