MenuItem
-
class MenuItem
- #include <MenuItem.h>
Represent single item in menu.
┌────────────────────────────┐ │ > T E X T │ └────────────────────────────┘
Subclassed by ItemRangeBase< float >, ItemRangeBase< int >, BaseItemManyWidgets, BaseItemZeroWidget, ItemInput, ItemList, ItemRangeBase< T >, ItemToggle
Public Functions
-
inline void setText(const char *text)
Set the text of the item.
Note
You need to call
LcdMenu::refresh
after this method to see the changes.- Parameters:
text – text to display for the item
Protected Functions
-
inline uint8_t getViewSize(MenuRenderer *renderer) const
The number of available columns for the potential value of the item.
visible area ┌───────────────┐ X X X X│X X X X █ X X X│X X ├───────────────┤ │<── viewSize ─>│
Effectively const, but initialized lately when renderer is injected.
-
inline virtual bool process(LcdMenu *menu, const unsigned char command)
Process a command decoded in 1 byte. It can be a printable character or a control command like
ENTER
orLEFT
. Return value is used to determine operation was successful or ignored. If the parent of item received that handle was ignored it can execute it’s own action on this command. Thus, the item always has priority in processing; if it is ignored, it is delegated to the parent element. Behaviour is very similar to Even Bubbling in JavaScript.- Parameters:
menu – the owner menu of the item, can be used to retrieve required object, such as
DisplayInterface
orMenuScreen
command – the character command, can be a printable character or a control command
- Returns:
true if command was successfully handled by item.
-
inline virtual void draw(MenuRenderer *renderer)
Draw this menu item on specified display on current row.
- Parameters:
renderer – The renderer to use for drawing.
Private Members
- friend MenuScreen
-
inline void setText(const char *text)