#include "MenuCfg.h"
Public Member Functions | |
MenuCfg () | |
MenuCfg (const std::string &_name, const std::string &_text, const std::string &_iconPath=std::string()) | |
MenuCfg (const MenuCfg &_other) | |
MenuCfg (const ot::ConstJsonObject &_object) | |
virtual | ~MenuCfg () |
MenuCfg & | operator= (const MenuCfg &_other) |
virtual MenuEntryCfg * | createCopy (void) const override |
virtual EntryType | getMenuEntryType (void) const override |
virtual void | addToJsonObject (ot::JsonValue &_object, ot::JsonAllocator &_allocator) const override |
Add the object contents to the provided JSON object. | |
virtual void | setFromJsonObject (const ot::ConstJsonObject &_object) override |
Set the object contents from the provided JSON object. | |
void | add (MenuEntryCfg *_entry) |
Adds the provided entry to this menu. | |
MenuCfg * | addMenu (const std::string &_name, const std::string &_text, const std::string &_iconPath=std::string()) |
Creates and adds a child menu. The menu takes ownership of the created child menu. | |
MenuButtonCfg * | addButton (const std::string &_name, const std::string &_text, const std::string &_iconPath=std::string(), MenuButtonCfg::ButtonAction _action=MenuButtonCfg::ButtonAction::NotifyOwner) |
Creates and adds a child item. The menu takes ownership of the created child item. | |
void | addSeparator (void) |
Creates and adds a separator. | |
MenuButtonCfg * | findMenuButton (const std::string &_name) const |
Searches for the menu button with the given name in this menu and all of its child menus. The menu keeps ownership of the button. | |
const std::list< MenuEntryCfg * > & | getEntries (void) const |
bool | isEmpty (void) const |
Returns true if this menu has no buttons (child menus do not count). | |
![]() | |
MenuClickableEntryCfg () | |
MenuClickableEntryCfg (const std::string &_name, const std::string &_text, const std::string &_iconPath=std::string()) | |
MenuClickableEntryCfg (const MenuClickableEntryCfg &_other) | |
virtual | ~MenuClickableEntryCfg () |
MenuClickableEntryCfg & | operator= (const MenuClickableEntryCfg &_other) |
void | setName (const std::string &_name) |
const std::string & | getName (void) const |
void | setText (const std::string &_text) |
const std::string & | getText (void) const |
void | setIconPath (const std::string &_iconPath) |
const std::string & | getIconPath (void) const |
void | setToolTip (const std::string &_toolTip) |
const std::string & | getToolTip (void) const |
![]() | |
MenuEntryCfg () | |
MenuEntryCfg (const MenuEntryCfg &_other) | |
virtual | ~MenuEntryCfg () |
MenuEntryCfg & | operator= (const MenuEntryCfg &_other) |
![]() | |
Serializable () | |
virtual | ~Serializable () |
Additional Inherited Members | |
![]() | |
enum | EntryType { Menu , Button , Separator } |
![]() | |
static std::string | toString (EntryType _type) |
static EntryType | stringToEntryType (const std::string &_type) |
static const std::string & | entryTypeJsonKey (void) |
ot::MenuCfg::MenuCfg | ( | ) |
ot::MenuCfg::MenuCfg | ( | const std::string & | _name, |
const std::string & | _text, | ||
const std::string & | _iconPath = std::string() ) |
ot::MenuCfg::MenuCfg | ( | const MenuCfg & | _other | ) |
ot::MenuCfg::MenuCfg | ( | const ot::ConstJsonObject & | _object | ) |
|
virtual |
void ot::MenuCfg::add | ( | MenuEntryCfg * | _entry | ) |
Adds the provided entry to this menu.
_entry | Entry to add. The menu takes ownership of the entry. |
ot::MenuButtonCfg * ot::MenuCfg::addButton | ( | const std::string & | _name, |
const std::string & | _text, | ||
const std::string & | _iconPath = std::string(), | ||
MenuButtonCfg::ButtonAction | _action = MenuButtonCfg::ButtonAction::NotifyOwner ) |
Creates and adds a child item. The menu takes ownership of the created child item.
_text | Item text. |
_iconPath | Item icon path. |
_shortcut | Item shortcut. |
ot::MenuCfg * ot::MenuCfg::addMenu | ( | const std::string & | _name, |
const std::string & | _text, | ||
const std::string & | _iconPath = std::string() ) |
Creates and adds a child menu. The menu takes ownership of the created child menu.
_text | Menu text. |
_iconPath | Menu icon path. |
_shortcut | Menu shortcut. |
void ot::MenuCfg::addSeparator | ( | void | ) |
Creates and adds a separator.
|
overridevirtual |
Add the object contents to the provided JSON object.
_object | Json object reference to write the data to. |
_allocator | Allocator. |
Reimplemented from ot::MenuClickableEntryCfg.
|
overridevirtual |
Implements ot::MenuEntryCfg.
ot::MenuButtonCfg * ot::MenuCfg::findMenuButton | ( | const std::string & | _name | ) | const |
Searches for the menu button with the given name in this menu and all of its child menus. The menu keeps ownership of the button.
|
inline |
|
inlineoverridevirtual |
Implements ot::MenuEntryCfg.
bool ot::MenuCfg::isEmpty | ( | void | ) | const |
Returns true if this menu has no buttons (child menus do not count).
ot::MenuCfg & ot::MenuCfg::operator= | ( | const MenuCfg & | _other | ) |
|
overridevirtual |
Set the object contents from the provided JSON object.
_object | The JSON object containing the information. |
May | throw an exception if the provided object is not valid (members missing or invalid types). |
Reimplemented from ot::MenuClickableEntryCfg.