tcMenu
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
MenuItem Class Reference

#include <MenuItems.h>

Inheritance diagram for MenuItem:
ActionMenuItem FloatMenuItem RuntimeMenuItem ValueMenuItem ActivateSubMenuItem BackMenuItem EditableMultiPartMenuItem ListRuntimeMenuItem LocalDialogButtonMenuItem ScrollChoiceMenuItem SubMenuItem tcgfx::RuntimeTitleMenuItem AnalogMenuItem BooleanMenuItem EnumMenuItem

Public Member Functions

uint8_t copyNameToBuffer (char *sz, int size) const
 
uint8_t copyNameToBuffer (char *sz, int offset, int size) const
 
menuid_t getId () const
 
uint16_t getMaximumValue () const
 
uint16_t getEepromPosition () const
 
MenuType getMenuType () const
 
void triggerCallback () const
 
bool isInfoProgMem () const
 
void setChanged (bool changed)
 
bool isChanged () const
 
bool isSendRemoteNeeded (uint8_t remoteNo) const
 
void setSendRemoteNeededAll ()
 
void clearSendRemoteNeededAll ()
 
void setSendRemoteNeeded (uint8_t remoteNo, bool needed)
 
void setActive (bool active)
 
bool isActive () const
 
void setEditing (bool active)
 
bool isEditing () const
 
void setReadOnly (bool active)
 
bool isReadOnly () const
 
void setLocalOnly (bool localOnly)
 
bool isLocalOnly () const
 
void setSecured (bool secured)
 
bool isSecured () const
 
void setVisible (bool visible)
 
bool isVisible () const
 
MenuItemgetNext () const
 
void setNext (MenuItem *next)
 
void changeOccurred (bool silent)
 

Protected Member Functions

 MenuItem (MenuType menuType, const AnyMenuInfo *menuInfo, MenuItem *next, bool infoProgMem)
 

Protected Attributes

uint16_t flags
 
MenuItemnext
 
union {
const AnyMenuInfoinfo
 
RuntimeRenderingFn renderFn
 
}; 
 
MenuType menuType
 

Detailed Description

This is the base class of all menu items, containing functionality to hold the current state of the menu and determine which is the next menu in the chain. It also defines a few functions that all implementations implement.

As there is limited memory on the device, most of the static information is stored in a paired AnyMenuInfo structure, saving quite a lot of RAM, also each menu item is in a chain, where getNext() will returned the next available item. NULL represents the end of the chain.

Constructor & Destructor Documentation

◆ MenuItem()

MenuItem::MenuItem ( MenuType  menuType,
const AnyMenuInfo menuInfo,
MenuItem next,
bool  infoProgMem 
)
protected

Do not directly create menu items, always use the leaf classes, such as AnalogMenuItem etc.

Member Function Documentation

◆ copyNameToBuffer() [1/2]

uint8_t MenuItem::copyNameToBuffer ( char *  sz,
int  size 
) const
inline

Copies the name into the provided buffer starting at position 0.

Parameters
szthe buffer space
sizethe size of sz, generally obtained using sizeof

◆ copyNameToBuffer() [2/2]

uint8_t MenuItem::copyNameToBuffer ( char *  sz,
int  offset,
int  size 
) const

Copies the name info the provided buffer starting at the specified position.

Parameters
szthe buffer space
offsetthe offset to start at relative to the buffer
sizethe size of sz, generally obtained using sizeof

◆ getId()

uint16_t MenuItem::getId ( ) const

Retrieves the ID from the info block

◆ getMaximumValue()

uint16_t MenuItem::getMaximumValue ( ) const

Retrieves the maximum value for this menu type

◆ getEepromPosition()

uint16_t MenuItem::getEepromPosition ( ) const

Retrieves the eeprom storage position for this menu (or 0xffff if not applicable)

◆ getMenuType()

MenuType MenuItem::getMenuType ( ) const
inline

returns the menu type as one of the above menu type enumeration

◆ triggerCallback()

void MenuItem::triggerCallback ( ) const

triggers the event callback associated with this item

◆ setChanged()

void MenuItem::setChanged ( bool  changed)
inline

set the item to be changed, this lets the renderer know it needs painting

◆ isChanged()

bool MenuItem::isChanged ( ) const
inline

returns the changed state of the item

◆ isSendRemoteNeeded()

bool MenuItem::isSendRemoteNeeded ( uint8_t  remoteNo) const

returns if the menu item needs to be sent remotely

◆ setSendRemoteNeededAll()

void MenuItem::setSendRemoteNeededAll ( )

Set all the flags indicating that a remote refresh is needed for all remotes

◆ clearSendRemoteNeededAll()

void MenuItem::clearSendRemoteNeededAll ( )

Clears all the flags indicating that a remote send is needed for all remotes.

◆ setSendRemoteNeeded()

void MenuItem::setSendRemoteNeeded ( uint8_t  remoteNo,
bool  needed 
)

set the flag indicating that a remote refresh is needed for a specific remote

◆ setActive()

void MenuItem::setActive ( bool  active)

sets this to be the active item, so that the renderer shows it highlighted

◆ isActive()

bool MenuItem::isActive ( ) const
inline

returns the active status of the item

◆ setEditing()

void MenuItem::setEditing ( bool  active)

sets this item as the currently being edited, so that the renderer shows it as being edited

◆ isEditing()

bool MenuItem::isEditing ( ) const
inline

returns true if the status is currently being edited

◆ setReadOnly()

void MenuItem::setReadOnly ( bool  active)
inline

sets this item to be read only, so that the manager will not allow it to be edited

◆ isReadOnly()

bool MenuItem::isReadOnly ( ) const
inline

returns true if this item is read only

◆ setLocalOnly()

void MenuItem::setLocalOnly ( bool  localOnly)
inline

sets this item to be available only locally

◆ isLocalOnly()

bool MenuItem::isLocalOnly ( ) const
inline

returns true if this item is only available locally

◆ setSecured()

void MenuItem::setSecured ( bool  secured)
inline

sets this item to need pin security in order to display, currently only available locally

◆ isSecured()

bool MenuItem::isSecured ( ) const
inline

returns true if this item requires a pin to display, , currently only available locally

◆ setVisible()

void MenuItem::setVisible ( bool  visible)
inline

sets this item to need pin security in order to display, currently only available locally

◆ isVisible()

bool MenuItem::isVisible ( ) const
inline

returns true if this item requires a pin to display, , currently only available locally

◆ getNext()

MenuItem* MenuItem::getNext ( ) const
inline

gets the next menu (sibling) at this level

◆ setNext()

void MenuItem::setNext ( MenuItem next)
inline

sets or changes the menu item that comes after this one, nullptr means this is the last item

◆ changeOccurred()

void MenuItem::changeOccurred ( bool  silent)

Marks the menu item as having updated locally and remotely and also calls the callback if not silent

Member Data Documentation

◆ @5

union { ... }

we only have either an info structure or a runtime menu callback function


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