LiquidMenu
1.6.0
Menu creation Arduino library for LCDs, wraps LiquidCrystal.
|
Represents a collection of screens forming a menu. More...
#include <LiquidMenu.h>
Public Member Functions | |
Constructors | |
LiquidMenu (DisplayClass &liquidCrystal, uint8_t startingScreen=1) | |
The main constructor. More... | |
LiquidMenu (DisplayClass &liquidCrystal, LiquidScreen &liquidScreen, uint8_t startingScreen=1) | |
Constructor for 1 LiquidScreen object. More... | |
LiquidMenu (DisplayClass &liquidCrystal, LiquidScreen &liquidScreen1, LiquidScreen &liquidScreen2, uint8_t startingScreen=1) | |
Constructor for 2 LiquidScreen objects. More... | |
LiquidMenu (DisplayClass &liquidCrystal, LiquidScreen &liquidScreen1, LiquidScreen &liquidScreen2, LiquidScreen &liquidScreen3, uint8_t startingScreen=1) | |
Constructor for 3 LiquidScreen objects. More... | |
LiquidMenu (DisplayClass &liquidCrystal, LiquidScreen &liquidScreen1, LiquidScreen &liquidScreen2, LiquidScreen &liquidScreen3, LiquidScreen &liquidScreen4, uint8_t startingScreen=1) | |
Constructor for 4 LiquidScreen objects. More... | |
Public methods | |
bool | add_screen (LiquidScreen &liquidScreen) |
Adds a LiquidScreen object to the 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... | |
void | init () const |
Initializes the menu object. More... | |
Friends | |
class | LiquidSystem |
Represents a collection of screens forming a menu.
A menu is made up of LiquidScreen objects. It holds pointers to them and calls their functions depending on which one is active. This is the class used for control. It is possible to use multiple menus, it that case this classes' objects go into a LiquidSystem object which controls them using the same public methods.
LiquidMenu::LiquidMenu | ( | DisplayClass & | liquidCrystal, |
uint8_t | startingScreen = 1 |
||
) |
The main constructor.
This is the main constructor that gets called every time.
&liquidCrystal | - pointer to the DisplayClass object |
startingScreen | - the number of the screen that will be shown first |
LiquidMenu::LiquidMenu | ( | DisplayClass & | liquidCrystal, |
LiquidScreen & | liquidScreen, | ||
uint8_t | startingScreen = 1 |
||
) |
Constructor for 1 LiquidScreen object.
&liquidCrystal | - pointer to the DisplayClass object |
&liquidScreen | - pointer to a LiquidScreen object |
startingScreen | - the number of the screen that will be shown first |
LiquidMenu::LiquidMenu | ( | DisplayClass & | liquidCrystal, |
LiquidScreen & | liquidScreen1, | ||
LiquidScreen & | liquidScreen2, | ||
uint8_t | startingScreen = 1 |
||
) |
Constructor for 2 LiquidScreen objects.
&liquidCrystal | - pointer to the DisplayClass object |
&liquidScreen1 | - pointer to a LiquidScreen object |
&liquidScreen2 | - pointer to a LiquidScreen object |
startingScreen | - the number of the screen that will be shown first |
LiquidMenu::LiquidMenu | ( | DisplayClass & | liquidCrystal, |
LiquidScreen & | liquidScreen1, | ||
LiquidScreen & | liquidScreen2, | ||
LiquidScreen & | liquidScreen3, | ||
uint8_t | startingScreen = 1 |
||
) |
Constructor for 3 LiquidScreen objects.
&liquidCrystal | - pointer to the DisplayClass object |
&liquidScreen1 | - pointer to a LiquidScreen object |
&liquidScreen2 | - pointer to a LiquidScreen object |
&liquidScreen3 | - pointer to a LiquidScreen object |
startingScreen | - the number of the screen that will be shown first |
LiquidMenu::LiquidMenu | ( | DisplayClass & | liquidCrystal, |
LiquidScreen & | liquidScreen1, | ||
LiquidScreen & | liquidScreen2, | ||
LiquidScreen & | liquidScreen3, | ||
LiquidScreen & | liquidScreen4, | ||
uint8_t | startingScreen = 1 |
||
) |
Constructor for 4 LiquidScreen objects.
&liquidCrystal | - pointer to the DisplayClass object |
&liquidScreen1 | - pointer to a LiquidScreen object |
&liquidScreen2 | - pointer to a LiquidScreen object |
&liquidScreen3 | - pointer to a LiquidScreen object |
&liquidScreen4 | - pointer to a LiquidScreen object |
startingScreen | - the number of the screen that will be shown first |
bool LiquidMenu::add_screen | ( | LiquidScreen & | liquidScreen | ) |
Adds a LiquidScreen object to the menu.
&liquidScreen | - pointer to a LiquidScreen object |
MAX_SCREENS
. The default is 16.bool LiquidMenu::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 LiquidMenu::change_screen | ( | LiquidScreen * | p_liquidScreen | ) |
Switches to the specified screen.
*p_liquidScreen | - pointer to the LiquidScreen object |
bool LiquidMenu::change_screen | ( | uint8_t | number | ) |
Switches to the specified screen.
number | - the number of the screen |
LiquidScreen * LiquidMenu::get_currentScreen | ( | ) | const |
Returns a reference to the current screen.
Call this method to obtain a reference to the current screen.
uint8_t LiquidMenu::get_focusedLine | ( | ) | const |
Get the index of the currently focused line.
void LiquidMenu::init | ( | ) | const |
Initializes the menu object.
Call this method to fully initialize the menu object.
bool LiquidMenu::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 LiquidMenu::next_screen | ( | ) |
Switches to the next screen.
void LiquidMenu::operator++ | ( | ) |
Switches to the next screen.
void LiquidMenu::operator++ | ( | int | ) |
Switches to the next screen.
void LiquidMenu::operator-- | ( | ) |
Switches to the previous screen.
void LiquidMenu::operator-- | ( | int | ) |
Switches to the previous screen.
bool LiquidMenu::operator= | ( | LiquidScreen * | p_liquidScreen | ) |
Switches to the specified screen.
&p_liquidScreen | - pointer to the screen |
bool LiquidMenu::operator= | ( | uint8_t | number | ) |
Switches to the specified screen.
number | - the number of the screen |
void LiquidMenu::previous_screen | ( | ) |
Switches to the previous screen.
bool LiquidMenu::set_focusedLine | ( | uint8_t | lineIndex | ) |
Directly select focused line.
lineIndex | - index of the focused line |
bool LiquidMenu::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 LiquidMenu::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 LiquidMenu::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 LiquidMenu::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 LiquidMenu::update | ( | ) | const |
Prints the current screen to the display.
Call this method when there is a change in some of the attached variables.