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< V > EditableMultiPartMenuItem< char *> EditableMultiPartMenuItem< DateStorage > EditableMultiPartMenuItem< LargeFixedNumber > EditableMultiPartMenuItem< RgbColor32 > EditableMultiPartMenuItem< TimeStorage > EditableMultiPartMenuItem< uint8_t[4]> ListRuntimeMenuItem LocalDialogButtonMenuItem ScrollChoiceMenuItem SubMenuItem tcgfx::RuntimeTitleMenuItem AnalogMenuItem BooleanMenuItem EnumMenuItem

Public Member Functions

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

Protected Member Functions

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

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 
)
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 
)
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 
)

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 ( )

Retrieves the ID from the info block

◆ getMaximumValue()

uint16_t MenuItem::getMaximumValue ( )

Retrieves the maximum value for this menu type

◆ getEepromPosition()

uint16_t MenuItem::getEepromPosition ( )

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

◆ getMenuType()

MenuType MenuItem::getMenuType ( )
inline

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

◆ triggerCallback()

void MenuItem::triggerCallback ( )

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 ( )
inline

returns the changed state of the item

◆ isSendRemoteNeeded()

bool MenuItem::isSendRemoteNeeded ( uint8_t  remoteNo)

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)
inline

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

◆ isActive()

bool MenuItem::isActive ( )
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 ( )
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 ( )
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 ( )
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 ( )
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 ( )
inline

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

◆ getNext()

MenuItem* MenuItem::getNext ( )
inline

gets the next menu (sibling) at this level

Member Data Documentation

◆ @3

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: