LiquidMenu
1.6.0
Menu creation Arduino library for LCDs, wraps LiquidCrystal.
|
Represents a collection of menus forming a menu system. More...
#include <LiquidMenu.h>
Public Member Functions | |
Constructors | |
LiquidSystem (uint8_t startingMenu=1) | |
The main constructor. More... | |
LiquidSystem (LiquidMenu &liquidMenu1, LiquidMenu &liquidMenu2, uint8_t startingMenu=1) | |
Constructor for 2 LiquidMenu objects. More... | |
LiquidSystem (LiquidMenu &liquidMenu1, LiquidMenu &liquidMenu2, LiquidMenu &liquidMenu3, uint8_t startingMenu=1) | |
Constructor for 3 LiquidMenu objects. More... | |
LiquidSystem (LiquidMenu &liquidMenu1, LiquidMenu &liquidMenu2, LiquidMenu &liquidMenu3, LiquidMenu &liquidMenu4, uint8_t startingMenu=1) | |
Constructor for 4 LiquidMenu objects. More... | |
Public methods | |
bool | add_menu (LiquidMenu &liquidMenu) |
Adds a LiquidMenu object to the menu system. More... | |
bool | change_menu (LiquidMenu &p_liquidMenu) |
Switches to the specified menu. More... | |
LiquidScreen * | get_currentScreen () const |
Returns a reference to the current screen. More... | |
void | next_screen () |
Switches to the next screen. More... | |
void | operator++ () |
Switches to the next screen. More... | |
void | operator++ (int) |
Switches to the next screen. More... | |
void | previous_screen () |
Switches to the previous screen. More... | |
void | operator-- () |
Switches to the previous screen. More... | |
void | operator-- (int) |
Switches to the previous screen. More... | |
bool | change_screen (LiquidScreen *p_liquidScreen) |
Switches to the specified screen. More... | |
bool | change_screen (uint8_t number) |
Switches to the specified screen. More... | |
bool | operator= (LiquidScreen *p_liquidScreen) |
Switches to the specified screen. More... | |
bool | operator= (uint8_t number) |
Switches to the specified screen. More... | |
void | switch_focus (bool forward=true) |
Switches the focus. More... | |
bool | set_focusedLine (uint8_t lineIndex) |
Directly select focused line. More... | |
uint8_t | get_focusedLine () const |
Get the index of the currently focused line. More... | |
bool | set_focusPosition (Position position) |
Sets the focus position for the whole menu at once. More... | |
bool | set_focusSymbol (Position position, uint8_t symbol[8]) |
Changes the focus indicator's symbol. More... | |
bool | is_callable (uint8_t number) const |
Check if there is an attached function at the specified number. More... | |
bool | call_function (uint8_t number, bool refresh=true) const |
Calls an attached function specified by the number. More... | |
void | update () const |
Prints the current screen to the display. More... | |
void | softUpdate () const |
Prints the current screen to the display (without clearing). More... | |
Represents a collection of menus forming a menu system.
A menu system is made up of LiquidMenu objects. It holds pointers to them and calls their functions depending on which one is active. This class is uses the same public methods as LiquidMenu with the addition of a method for adding a LiquidMenu object and a method for changing the currently active menu. This class is optional, it is used only if there is a need for multiple menus.
|
explicit |
The main constructor.
This is the main constructor that gets called every time.
startingMenu | - the number of the menu that will be shown first |
LiquidSystem::LiquidSystem | ( | LiquidMenu & | liquidMenu1, |
LiquidMenu & | liquidMenu2, | ||
uint8_t | startingMenu = 1 |
||
) |
Constructor for 2 LiquidMenu objects.
&liquidMenu1 | - pointer to a LiquidMenu object |
&liquidMenu2 | - pointer to a LiquidMenu object |
startingMenu | - the number of the menu that will be shown first |
LiquidSystem::LiquidSystem | ( | LiquidMenu & | liquidMenu1, |
LiquidMenu & | liquidMenu2, | ||
LiquidMenu & | liquidMenu3, | ||
uint8_t | startingMenu = 1 |
||
) |
Constructor for 3 LiquidMenu objects.
&liquidMenu1 | - pointer to a LiquidMenu object |
&liquidMenu2 | - pointer to a LiquidMenu object |
&liquidMenu3 | - pointer to a LiquidMenu object |
startingMenu | - the number of the menu that will be shown first |
LiquidSystem::LiquidSystem | ( | LiquidMenu & | liquidMenu1, |
LiquidMenu & | liquidMenu2, | ||
LiquidMenu & | liquidMenu3, | ||
LiquidMenu & | liquidMenu4, | ||
uint8_t | startingMenu = 1 |
||
) |
Constructor for 4 LiquidMenu objects.
&liquidMenu1 | - pointer to a LiquidMenu object |
&liquidMenu2 | - pointer to a LiquidMenu object |
&liquidMenu3 | - pointer to a LiquidMenu object |
&liquidMenu4 | - pointer to a LiquidMenu object |
startingMenu | - the number of the menu that will be shown first |
bool LiquidSystem::add_menu | ( | LiquidMenu & | liquidMenu | ) |
Adds a LiquidMenu object to the menu system.
&liquidMenu | - pointer to a LiquidMenu object |
MAX_MENUS
. The default is 12.bool LiquidSystem::call_function | ( | uint8_t | number, |
bool | refresh = true |
||
) | const |
Calls an attached function specified by the number.
Calls the function specified by the number argument for the current screen and for the focused line.
number | - number of the function in the array |
refresh | - enable/disable updating the display |
bool LiquidSystem::change_menu | ( | LiquidMenu & | p_liquidMenu | ) |
Switches to the specified menu.
*p_liquidMenu | - pointer to the LiquidMenu object |
bool LiquidSystem::change_screen | ( | LiquidScreen * | p_liquidScreen | ) |
Switches to the specified screen.
*p_liquidScreen | - pointer to the LiquidScreen object |
bool LiquidSystem::change_screen | ( | uint8_t | number | ) |
Switches to the specified screen.
number | - the number of the screen |
LiquidScreen * LiquidSystem::get_currentScreen | ( | ) | const |
Returns a reference to the current screen.
Call this method to obtain a reference to the current screen.
uint8_t LiquidSystem::get_focusedLine | ( | ) | const |
Get the index of the currently focused line.
bool LiquidSystem::is_callable | ( | uint8_t | number | ) | const |
Check if there is an attached function at the specified number.
number | - number of the function in the array |
void LiquidSystem::next_screen | ( | ) |
Switches to the next screen.
void LiquidSystem::operator++ | ( | ) |
Switches to the next screen.
void LiquidSystem::operator++ | ( | int | ) |
Switches to the next screen.
void LiquidSystem::operator-- | ( | ) |
Switches to the previous screen.
void LiquidSystem::operator-- | ( | int | ) |
Switches to the previous screen.
bool LiquidSystem::operator= | ( | LiquidScreen * | p_liquidScreen | ) |
Switches to the specified screen.
&p_liquidScreen | - pointer to the screen |
bool LiquidSystem::operator= | ( | uint8_t | number | ) |
Switches to the specified screen.
number | - the number of the screen |
void LiquidSystem::previous_screen | ( | ) |
Switches to the previous screen.
bool LiquidSystem::set_focusedLine | ( | uint8_t | lineIndex | ) |
Directly select focused line.
lineIndex | - index of the focused line |
bool LiquidSystem::set_focusPosition | ( | Position | position | ) |
Sets the focus position for the whole menu at once.
The valid positions are LEFT
and RIGHT
. CUSTOM
is not valid for this function because it needs individual column and row for every line.
position | - LEFT or RIGHT |
Position
is enum class. Use Position::(member)
when specifying the position.bool LiquidSystem::set_focusSymbol | ( | Position | position, |
uint8_t | symbol[8] | ||
) |
Changes the focus indicator's symbol.
The symbol is changed for a particular position.
position | - the position for which the symbol will be changed |
symbol[] | - the symbol |
Position
is enum class. Use Position::(member)
when specifying the position.void LiquidSystem::softUpdate | ( | ) | const |
Prints the current screen to the display (without clearing).
Call this method when there is a change in some of the variable attached and the new symbols cover all of the old symbols.
void LiquidSystem::switch_focus | ( | bool | forward = true | ) |
Switches the focus.
Switches the focus to the next or previous line according to the passed parameter.
forward | - true for forward, false for backward |
void LiquidSystem::update | ( | ) | const |
Prints the current screen to the display.
Call this method when there is a change in some of the variable attached.