OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ot::MenuCfg Class Reference

#include "MenuCfg.h"

Inheritance diagram for ot::MenuCfg:
ot::MenuClickableEntryCfg ot::MenuEntryCfg ot::Serializable

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 ()
 
MenuCfgoperator= (const MenuCfg &_other)
 
virtual MenuEntryCfgcreateCopy (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.
 
MenuCfgaddMenu (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.
 
MenuButtonCfgaddButton (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.
 
MenuButtonCfgfindMenuButton (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).
 
- Public Member Functions inherited from ot::MenuClickableEntryCfg
 MenuClickableEntryCfg ()
 
 MenuClickableEntryCfg (const std::string &_name, const std::string &_text, const std::string &_iconPath=std::string())
 
 MenuClickableEntryCfg (const MenuClickableEntryCfg &_other)
 
virtual ~MenuClickableEntryCfg ()
 
MenuClickableEntryCfgoperator= (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
 
- Public Member Functions inherited from ot::MenuEntryCfg
 MenuEntryCfg ()
 
 MenuEntryCfg (const MenuEntryCfg &_other)
 
virtual ~MenuEntryCfg ()
 
MenuEntryCfgoperator= (const MenuEntryCfg &_other)
 
- Public Member Functions inherited from ot::Serializable
 Serializable ()
 
virtual ~Serializable ()
 

Additional Inherited Members

- Public Types inherited from ot::MenuEntryCfg
enum  EntryType { Menu , Button , Separator }
 
- Static Public Member Functions inherited from ot::MenuEntryCfg
static std::string toString (EntryType _type)
 
static EntryType stringToEntryType (const std::string &_type)
 
static const std::string & entryTypeJsonKey (void)
 

Constructor & Destructor Documentation

◆ MenuCfg() [1/4]

ot::MenuCfg::MenuCfg ( )

◆ MenuCfg() [2/4]

ot::MenuCfg::MenuCfg ( const std::string & _name,
const std::string & _text,
const std::string & _iconPath = std::string() )

◆ MenuCfg() [3/4]

ot::MenuCfg::MenuCfg ( const MenuCfg & _other)

◆ MenuCfg() [4/4]

ot::MenuCfg::MenuCfg ( const ot::ConstJsonObject & _object)

◆ ~MenuCfg()

ot::MenuCfg::~MenuCfg ( )
virtual

Member Function Documentation

◆ add()

void ot::MenuCfg::add ( MenuEntryCfg * _entry)

Adds the provided entry to this menu.

Parameters
_entryEntry to add. The menu takes ownership of the entry.

◆ addButton()

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.

Parameters
_textItem text.
_iconPathItem icon path.
_shortcutItem shortcut.

◆ addMenu()

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.

Parameters
_textMenu text.
_iconPathMenu icon path.
_shortcutMenu shortcut.

◆ addSeparator()

void ot::MenuCfg::addSeparator ( void )

Creates and adds a separator.

◆ addToJsonObject()

void ot::MenuCfg::addToJsonObject ( ot::JsonValue & _object,
ot::JsonAllocator & _allocator ) const
overridevirtual

Add the object contents to the provided JSON object.

Parameters
_objectJson object reference to write the data to.
_allocatorAllocator.

Reimplemented from ot::MenuClickableEntryCfg.

◆ createCopy()

ot::MenuEntryCfg * ot::MenuCfg::createCopy ( void ) const
overridevirtual

Implements ot::MenuEntryCfg.

◆ findMenuButton()

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.

◆ getEntries()

const std::list< MenuEntryCfg * > & ot::MenuCfg::getEntries ( void ) const
inline

◆ getMenuEntryType()

virtual EntryType ot::MenuCfg::getMenuEntryType ( void ) const
inlineoverridevirtual

Implements ot::MenuEntryCfg.

◆ isEmpty()

bool ot::MenuCfg::isEmpty ( void ) const

Returns true if this menu has no buttons (child menus do not count).

◆ operator=()

ot::MenuCfg & ot::MenuCfg::operator= ( const MenuCfg & _other)

◆ setFromJsonObject()

void ot::MenuCfg::setFromJsonObject ( const ot::ConstJsonObject & _object)
overridevirtual

Set the object contents from the provided JSON object.

Parameters
_objectThe JSON object containing the information.
Exceptions
Maythrow an exception if the provided object is not valid (members missing or invalid types).

Reimplemented from ot::MenuClickableEntryCfg.


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