LcdMenu

class LcdMenu
#include <LcdMenu.h>

Represents the main menu object.

The LcdMenu class is the main object that manages the menu system. It is responsible for displaying the menu on the screen, processing user input, and updating the display based on the user’s actions.

Public Functions

inline LcdMenu(MenuRenderer &renderer)

Construct new instance of LcdMenu.

MenuRenderer *getRenderer()

Get the renderer.

Returns:

the renderer

MenuScreen *getScreen()

Get the screen that currently on display.

Returns:

currently active screen

void setScreen(MenuScreen *screen)

Set new screen to display. The only place that clears whole screen. Then it Will draw of new screen screen using the renderer.

Parameters:

screen – the new screen to display

bool process(const unsigned char c)

Process the input character.

Parameters:

c – the input character

Returns:

true if the input was processed successfully

void reset()

Reset current screen to initial state. Moves cursor and view positions to zero.

void hide()

Hide the menu. When you want to display any other content on the screen then call this function then display your content, later call show() to show the menu.

void show()

Show the menu.

uint8_t getCursor()

Get the current cursor position of current screen.

Returns:

the 0-based cursor position

void setCursor(uint8_t cursor)

Set the current cursor position.

Parameters:

cursor – the 0-based cursor position

MenuItem *getItemAt(uint8_t position)

Get MenuItem at position on current screen.

Returns:

MenuItem item at position

void refresh()

Refresh the current screen.

Private Members

MenuRenderer &renderer

The renderer used to display the menu on the screen.

MenuScreen *screen = NULL

Currently visible menu screen.

bool enabled = true

Enabled flag of menu. Determines whether the screen should be updated after an action. Set it to false when you want to display any other content on the screen then set it back to true to show the menu.