![]() |
LiquidMenu
1.2.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 (LiquidCrystal &liquidCrystal, uint8_t startingScreen=1) | |
The main constructor. More... | |
LiquidMenu (LiquidCrystal &liquidCrystal, LiquidScreen &liquidScreen, uint8_t startingScreen=1) | |
Constructor for 1 LiquidScreen object. More... | |
LiquidMenu (LiquidCrystal &liquidCrystal, LiquidScreen &liquidScreen1, LiquidScreen &liquidScreen2, uint8_t startingScreen=1) | |
Constructor for 2 LiquidScreen objects. More... | |
LiquidMenu (LiquidCrystal &liquidCrystal, LiquidScreen &liquidScreen1, LiquidScreen &liquidScreen2, LiquidScreen &liquidScreen3, uint8_t startingScreen=1) | |
Constructor for 3 LiquidScreen objects. More... | |
LiquidMenu (LiquidCrystal &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... | |
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_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 | call_function (uint8_t number) 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... | |
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 | ( | LiquidCrystal & | liquidCrystal, |
uint8_t | startingScreen = 1 |
||
) |
The main constructor.
This is the main constructor that gets called every time.
&liquidCrystal | - pointer to the LiquidCrystal object |
startingScreen | - the number of the screen that will be shown first |
LiquidMenu::LiquidMenu | ( | LiquidCrystal & | liquidCrystal, |
LiquidScreen & | liquidScreen, | ||
uint8_t | startingScreen = 1 |
||
) |
Constructor for 1 LiquidScreen object.
&liquidCrystal | - pointer to the LiquidCrystal object |
&liquidScreen | - pointer to a LiquidScreen object |
startingScreen | - the number of the screen that will be shown first |
LiquidMenu::LiquidMenu | ( | LiquidCrystal & | liquidCrystal, |
LiquidScreen & | liquidScreen1, | ||
LiquidScreen & | liquidScreen2, | ||
uint8_t | startingScreen = 1 |
||
) |
Constructor for 2 LiquidScreen objects.
&liquidCrystal | - pointer to the LiquidCrystal 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 | ( | LiquidCrystal & | liquidCrystal, |
LiquidScreen & | liquidScreen1, | ||
LiquidScreen & | liquidScreen2, | ||
LiquidScreen & | liquidScreen3, | ||
uint8_t | startingScreen = 1 |
||
) |
Constructor for 3 LiquidScreen objects.
&liquidCrystal | - pointer to the LiquidCrystal 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 | ( | LiquidCrystal & | liquidCrystal, |
LiquidScreen & | liquidScreen1, | ||
LiquidScreen & | liquidScreen2, | ||
LiquidScreen & | liquidScreen3, | ||
LiquidScreen & | liquidScreen4, | ||
uint8_t | startingScreen = 1 |
||
) |
Constructor for 4 LiquidScreen objects.
&liquidCrystal | - pointer to the LiquidCrystal 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 | ) | 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 |
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 |
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_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 variable attached.