Base Framework
|
#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 ©) noexcept | |
Menu & | operator= (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) |
enum Menu::Flag |
Menu::Menu | ( | ) |
Creates an empty menu.
|
inlinenoexcept |
Initializes menu from other menu.
Appends a menu item to the menu.
name | The string value of the menu item. |
identifier | The identifier of the menu item. |
flags | The flags of the menu item (a conbination of ENABLED, CHECKED, and HIGHLIGHTED). |
Appends a sub menu to the menu.
name | The string value of the menu item. |
menu | The sub menu. |
flags | The flags of the menu item (a conbination of ENABLED, CHECKED, and HIGHLIGHTED). |
void Menu::appendSeparator | ( | ) |
Appends a separator to the menu.
|
inline |
Checks the menu item.
index | The index of the menu item. |
|
inline |
Disables the menu item.
index | The index of the menu item. |
|
inline |
Enables the menu item.
index | The index of the menu item. |
unsigned int Menu::getFlags | ( | unsigned int | index | ) | const |
Returns the flags describing the menu item.
index | The index of the menu item. |
|
inlinenoexcept |
Returns the opaque menu handle.
unsigned int Menu::getIdentifier | ( | unsigned int | index | ) | const |
Returns the identifier of the specified menu item.
index | The index of the menu item. |
int Menu::getIndex | ( | unsigned int | identifier | ) | const |
Returns the index of the specified menu item.
identifier | The identifier of the menu item. |
Menu Menu::getMenu | ( | unsigned int | index | ) |
Returns the sub menu associated with the menu item.
index | The index of the menu item. |
unsigned int Menu::getNumberOfItems | ( | ) | const |
Returns the number of menu items.
|
inline |
Returns true if the menu item has a sub menu.
index | The index of the menu item. |
|
inline |
Highlights the menu item.
index | The index of the menu item. |
void Menu::insert | ( | unsigned int | index, |
const String & | name, | ||
unsigned int | identifier, | ||
unsigned int | flags = ENABLED |
||
) |
Inserts a menu item at the specified index.
index | The index of the new menu item. |
name | The string value of the menu item. |
identifier | The identifier of the menu item. |
flags | The flags of the menu item (a conbination of ENABLED, CHECKED, and HIGHLIGHTED). |
void Menu::insertSeparator | ( | unsigned int | index | ) |
Inserts a separator at the specified index.
index | The index of the menu item. |
|
inline |
Returns true if the menu item is checked.
index | The index of the menu item. |
|
inline |
Returns true if the menu item is enabled.
index | The index of the menu item. |
|
inline |
Returns true if the menu item is highlighted.
index | The index of the menu item. |
|
inline |
Returns true if the menu item is a separator.
|
inlinenoexcept |
Returns true if the menu is valid.
void Menu::remove | ( | unsigned int | index | ) |
Removes the menu item at the specified index from the menu.
index | The index of the menu item. |
void Menu::setChecked | ( | unsigned int | index, |
bool | checked | ||
) |
Sets the checked flag of the menu item.
index | The index of the menu item. |
enabled | The value of the flag. |
void Menu::setEnabled | ( | unsigned int | index, |
bool | enabled | ||
) |
Sets the enable flag of the menu item.
index | The index of the menu item. |
enabled | The value of the flag. |
void Menu::setHighlighted | ( | unsigned int | index, |
bool | highlighted | ||
) |
Sets the highlighted flag of the menu item.
index | The index of the menu item. |
enabled | The value of the flag. |
void Menu::setName | ( | unsigned int | index, |
const String & | name | ||
) |
Sets the string value of the menu item.
index | The index of the menu item. |
name | The new string value of the menu item. |
void Menu::setSubmenu | ( | unsigned int | identifier, |
const Menu & | menu | ||
) |
Sets the sub menu of the menu item.
index | The index of the menu item. |
menu | The new sub menu the menu item. |
|
inline |
Unchecks the menu item.
index | The index of the menu item. |
|
inline |
Resets the highlight flag of the menu item.
index | The index of the menu item. |