Skip to content
Logo LogoLcdMenu
Docs Changelog License
⌘ K
Logo LogoLcdMenu
Docs Changelog License

Overview

  • Getting started
  • Menu Screen
  • Item overview
    • Basic menu item
    • Value display item
    • Command menu item
    • Sub-menu item
    • Item Widget
    • Item List
    • Item Range
    • Item Bool
    • Input item
    • Charset input item
  • Widget overview
    • WidgetBool
    • WidgetList
    • WidgetRange
  • Controlling the menu
    • Keyboard Adapter
    • Button Adapter
    • Rotary Encoder Adapter
    • Analog Button Adapter
  • Rendering the menu
    • Character display renderer

Reference

  • Code samples
    • InputRotary
    • SubMenu
    • SimpleRotary
    • IntFloatValues
    • SimpleInput
    • KeyboardAdapter
    • pcf8574_i2c
    • ItemValue
    • RTOS
    • KeypadShield
    • ViewShifting
    • MenuTimeout
    • DynamicMenu
    • ButtonWithRotaryAdapter
    • UseByRef
    • List
    • ItemBack
    • Basic
    • Widgets
    • Callbacks
    • CharsetInput
    • SSD1803A_I2C
    • ButtonAdapter
  • API reference
    • MenuItem
    • ItemCommand
    • MenuScreen
    • ItemBool
    • ItemInput
    • ItemSubMenu
    • ItemToggle
    • ItemInputCharset
    • ItemValue
    • ItemWidget
    • ItemRange
    • BaseItemManyWidgets
    • ItemList
    • ItemBack
    • LcdMenu
    • BaseItemZeroWidget
    • renderer
    • input
    • display
    • widget
  • Migration
  • FAQ

Star on GitHub
Edit on GitHub
Arduino Library Badge PlatformIO Badge Check Runs Badge Documentation Status Badge GitHub Commits Badge

LcdMenu
/
API reference
/
renderer
/
MenuRenderer

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

Initializes the display and starts the timer.

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, bool paddWithBlanks = true) = 0

Draws an item on the display.

Parameters:
  • text – Text of the item to be drawn.

  • value – Value of the item to be drawn.

  • paddWithBlanks – Flag indicating whether to pad the text with spaces.

virtual void clearBlinker() = 0

Function to clear the blinker from the display.

virtual void drawBlinker() = 0

Function to draw the blinker on the display.

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.

virtual void restartTimer()

Restarts the display timer and shows the display.

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.

uint8_t getMaxCols() const

Gets the maximum number of columns in the display.

Returns:

Maximum number of columns.

virtual uint8_t getEffectiveCols() const = 0

Calculates the available horizontal space for displaying content.

Returns:

The horizontal space available for displaying content.

Public Members

uint8_t viewShift = 0

Number of columns to shift the current item’s view by.

DisplayInterface *display

Pointer to the display interface used for rendering.

Protected Attributes

const uint8_t maxCols
const uint8_t maxRows
bool hasHiddenItemsAbove = false

Flag indicating that there are hidden items above the current view.

bool hasHiddenItemsBelow = false

Flag indicating that there are hidden items below the current view.

bool hasFocus = false

Flag indicating that the current item has focus.

uint8_t cursorCol
uint8_t cursorRow
bool inEditMode
unsigned long startTime = 0

Friends

friend class MenuScreen
renderer
CharacterDisplayRenderer

On this page

  • MenuRenderer
    • MenuRenderer()
    • begin()
    • draw()
    • drawItem()
    • clearBlinker()
    • drawBlinker()
    • moveCursor()
    • setEditMode()
    • restartTimer()
    • updateTimer()
    • isInEditMode()
    • getCursorCol()
    • getCursorRow()
    • getMaxRows()
    • getMaxCols()
    • getEffectiveCols()
    • viewShift
    • display
    • maxCols
    • maxRows
    • hasHiddenItemsAbove
    • hasHiddenItemsBelow
    • hasFocus
    • cursorCol
    • cursorRow
    • inEditMode
    • startTime

© 2025, Thomas Forntoh