MenuRenderer
-
class MenuRenderer
- #include <MenuRenderer.h>
Abstract base class for rendering a menu on a display.
This class provides the basic structure and functionality for rendering a menu on a display. It includes methods for drawing items, moving the cursor, and handling edit mode.
Subclassed by CharacterDisplayRenderer
Public Functions
-
MenuRenderer(DisplayInterface *display, uint8_t maxCols, uint8_t maxRows)
Constructor for MenuRenderer.
- Parameters:
display – Pointer to the display interface.
maxCols – Maximum number of columns in the display.
maxRows – Maximum number of rows in the display.
-
virtual void draw(uint8_t byte) = 0
Function to draw a byte on the display.
- Parameters:
byte – The byte to be drawn.
-
virtual void drawItem(const char *text, const char *value) = 0
Draws an item on the display.
- Parameters:
text – Text of the item to be drawn.
value – Value of the item to be drawn.
-
virtual void moveCursor(uint8_t cursorCol, uint8_t cursorRow)
Moves the cursor to a specified position.
- Parameters:
cursorCol – Column position to move the cursor to.
cursorRow – Row position to move the cursor to.
-
void setEditMode(bool inEditMode)
Sets the edit mode for the menu.
- Parameters:
inEditMode – Flag indicating whether to enter or exit edit mode.
-
inline virtual void updateTimer()
Updates the display timer and hides the display if the timeout is reached.
-
bool isInEditMode() const
Checks if the menu is in edit mode.
- Returns:
True if in edit mode, false otherwise.
-
uint8_t getCursorCol() const
Gets the current column position of the cursor.
- Returns:
Current column position of the cursor.
-
uint8_t getCursorRow() const
Gets the current row position of the cursor.
- Returns:
Current row position of the cursor.
-
uint8_t getMaxRows() const
Gets the maximum number of rows in the display.
- Returns:
Maximum number of rows.
Public Members
-
DisplayInterface *display
Pointer to the display interface used for rendering.
Protected Attributes
-
bool hasHiddenItemsAbove = false
Flag indicating that there are hidden items above the current view.
Friends
- friend class MenuScreen
-
MenuRenderer(DisplayInterface *display, uint8_t maxCols, uint8_t maxRows)