BaseItemZeroWidget

class BaseItemZeroWidget : public MenuItem
#include <BaseItemZeroWidget.h>

A base class for menu items that either require custom commit handling or no commit handling.

This class extends the MenuItem class and provides a framework for menu items that either need no commit handling or need to handle commit actions in a specific way. It requires derived classes to implement the handleCommit method for custom commit handling.

Note

This class is intended to be used as a base class for other menu items. It should not be instantiated directly.

Subclassed by ItemBack, ItemCommand, ItemSubMenu

Public Functions

virtual ~BaseItemZeroWidget() = default
inline explicit BaseItemZeroWidget(const char *text)

Construct a new BaseItemZeroWidget object.

Parameters:

text – The text to display for the menu item.

Protected Functions

virtual void handleCommit(LcdMenu *menu) = 0
inline virtual void draw(MenuRenderer *renderer) override

Draw this menu item on specified display on current row.

Parameters:

renderer – The renderer to use for drawing.

inline virtual bool process(LcdMenu *menu, const unsigned char command) override

Process a command decoded in 1 byte. It can be a printable character or a control command like ENTER or LEFT. 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 or MenuScreen

  • command – the character command, can be a printable character or a control command

Returns:

true if command was successfully handled by item.