 |
LiquidMenu
1.6.0
Menu creation Arduino library for LCDs, wraps LiquidCrystal.
|
Go to the documentation of this file.
42 # include <avr/pgmspace.h>
51 #if LIQUIDMENU_LIBRARY == LiquidCrystal_LIBRARY
52 # pragma message ("LiquidMenu: Selected 'LiquidCrystal' (parallel) library. Edit 'LiquidMenu_config.h' file to change it.")
53 #include <LiquidCrystal.h>
54 #elif LIQUIDMENU_LIBRARY == LiquidCrystal_I2C_LIBRARY
55 # pragma message ("LiquidMenu: Selected 'LiquidCrystal_I2C' (I2C) library. Edit 'LiquidMenu_config.h' file to change it.")
56 #include <LiquidCrystal_I2C.h>
58 # pragma message ("LiquidMenu: Selected custom library. Edit 'LiquidMenu_config.h' file to change it.")
62 # warning "LiquidMenu: Debugging messages are enabled."
95 typedef char * (*charPtrFnPtr)();
97 typedef const char * (*constcharPtrFnPtr)();
107 BOOL = 1, BOOLEAN = 1,
114 FLOAT = 50, DOUBLE = 50,
118 PROG_CONST_CHAR_PTR = 65,
121 BOOL_GETTER = 201, BOOLEAN_GETTER = 201,
123 UINT8_T_GETTER = 209, BYTE_GETTER = 209,
124 INT16_T_GETTER = 216,
125 UINT16_T_GETTER = 217,
126 INT32_T_GETTER = 232,
127 UINT32_T_GETTER = 233,
128 FLOAT_GETTER = 240, DOUBLE_GETTER = 240,
130 CHAR_PTR_GETTER = 251,
131 CONST_CHAR_PTR_GETTER = 252
139 RIGHT = 1, NORMAL = 1,
341 : _row(row), _column(column), _focusRow(row - 1),
342 _focusColumn(column - 1), _focusPosition(
Position::NORMAL),
343 _floatDecimalPlaces(2), _variableCount(0), _focusable(false) {
346 _variable[i] =
nullptr;
347 _variableType[i] = DataType::NOT_USED;
361 template <
typename A>
374 template <
typename A,
typename B>
376 A &variableA, B &variableB)
389 template <
typename A,
typename B,
typename C>
391 A &variableA, B &variableB, C &variableC)
392 :
LiquidLine(column, row, variableA, variableB) {
405 template <
typename A,
typename B,
typename C,
typename D>
407 A &variableA, B &variableB, C &variableC, D &variableD)
408 :
LiquidLine(column, row, variableA, variableB, variableC) {
430 template <
typename T>
432 DEBUG(F(
"LLine "));
print_me(
reinterpret_cast<uintptr_t
>(
this));
438 if ((uint8_t)varType < (uint8_t)DataType::FIRST_GETTER) {
439 DEBUG(F(
"variable \""));
442 DEBUG(F(
"getter \"N/A"));
444 DEBUG(F(
"\" of DataType("));
449 _variable[_variableCount] = (
void*)&variable;
450 _variableType[_variableCount] = varType;
456 DEBUGLN(F(
" failed, edit LiquidMenu_config.h to allow for more variables"));
507 uint8_t column = 0, uint8_t row = 0);
543 void print(
DisplayClass *p_liquidCrystal,
bool isFocused);
553 void print_variable(
DisplayClass *p_liquidCrystal, uint8_t number);
564 bool is_callable(uint8_t number)
const;
575 bool call_function(uint8_t number)
const;
577 uint8_t _row, _column, _focusRow, _focusColumn;
579 uint8_t _floatDecimalPlaces;
580 uint8_t _variableCount;
770 uint8_t _displayLineCount;
811 uint8_t startingScreen = 1);
822 LiquidScreen &liquidScreen2, uint8_t startingScreen = 1);
835 uint8_t startingScreen = 1);
849 LiquidScreen &liquidScreen4, uint8_t startingScreen = 1);
1017 bool call_function(uint8_t number,
bool refresh =
true)
const;
1047 uint8_t _screenCount;
1048 uint8_t _currentScreen;
1084 uint8_t startingMenu = 1);
1094 LiquidMenu &liquidMenu3, uint8_t startingMenu = 1);
1106 uint8_t startingMenu = 1);
1281 bool call_function(uint8_t number,
bool refresh =
true)
const;
1303 uint8_t _currentMenu;
void previous_screen()
Switches to the previous screen.
Definition: LiquidSystem.cpp:108
bool call_function(uint8_t number, bool refresh=true) const
Calls an attached function specified by the number.
Definition: LiquidSystem.cpp:166
void next_screen()
Switches to the next screen.
Definition: LiquidSystem.cpp:96
void update() const
Prints the current screen to the display.
Definition: LiquidSystem.cpp:171
bool operator=(LiquidScreen *p_liquidScreen)
Switches to the specified screen.
Definition: LiquidSystem.cpp:132
bool set_asGlyph(uint8_t number)
Converts a byte variable into a glyph index.
Definition: LiquidLine.cpp:75
LiquidScreen * get_currentScreen() const
Returns a reference to the current screen.
Definition: LiquidSystem.cpp:92
LiquidScreen()
The main constructor.
Definition: LiquidScreen.cpp:50
void hide(bool hide)
Hides the screen.
Definition: LiquidScreen.cpp:124
Represents the individual lines printed on the display.
Definition: LiquidMenu.h:326
void set_decimalPlaces(uint8_t decimalPlaces)
Sets the decimal places for floating point variables.
Definition: LiquidLine.cpp:50
bool add_menu(LiquidMenu &liquidMenu)
Adds a LiquidMenu object to the menu system.
Definition: LiquidSystem.cpp:58
void switch_focus(bool forward=true)
Switches the focus.
Definition: LiquidSystem.cpp:136
Represents a collection of menus forming a menu system.
Definition: LiquidMenu.h:1063
LiquidSystem(uint8_t startingMenu=1)
The main constructor.
Definition: LiquidSystem.cpp:32
bool set_focusedLine(uint8_t lineIndex)
Directly select focused line.
Definition: LiquidSystem.cpp:140
bool set_focusPosition(Position position)
Sets the focus position for the whole screen at once.
Definition: LiquidScreen.cpp:105
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC)
Constructor for three variables/constants.
Definition: LiquidMenu.h:390
bool attach_function(uint8_t number, void(*function)(void))
Attaches a callback function to the line.
Definition: LiquidLine.cpp:33
bool set_focusSymbol(Position position, uint8_t symbol[8])
Changes the focus indicator's symbol.
Definition: LiquidSystem.cpp:155
Represents a screen shown on the display.
Definition: LiquidMenu.h:597
void operator++()
Switches to the next screen.
Definition: LiquidSystem.cpp:100
void operator--()
Switches to the previous screen.
Definition: LiquidSystem.cpp:112
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB)
Constructor for two variables/constants.
Definition: LiquidMenu.h:375
bool set_asProgmem(uint8_t number)
Converts a const char pointer variable into const char pointer PROGMEM one.
Definition: LiquidLine.cpp:87
uint8_t get_focusedLine() const
Get the index of the currently focused line.
Definition: LiquidSystem.cpp:144
bool add_variable(T &variable)
Adds a variable to the line.
Definition: LiquidMenu.h:431
void set_displayLineCount(uint8_t lineCount)
Specifies the line size of the display (required for scrolling).
Definition: LiquidScreen.cpp:120
LiquidLine(uint8_t column, uint8_t row, A &variableA)
Constructor for one variable/constant.
Definition: LiquidMenu.h:362
bool add_line(LiquidLine &liquidLine)
Adds a LiquidLine object to the screen.
Definition: LiquidScreen.cpp:75
bool change_screen(LiquidScreen *p_liquidScreen)
Switches to the specified screen.
Definition: LiquidSystem.cpp:124
bool change_menu(LiquidMenu &p_liquidMenu)
Switches to the specified menu.
Definition: LiquidSystem.cpp:76
LiquidLine(uint8_t column, uint8_t row)
The main constructor.
Definition: LiquidMenu.h:340
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC, D &variableD)
Constructor for four variables/constants.
Definition: LiquidMenu.h:406
bool is_callable(uint8_t number) const
Check if there is an attached function at the specified number.
Definition: LiquidSystem.cpp:162
bool set_focusPosition(Position position, uint8_t column=0, uint8_t row=0)
Configures the focus indicator position for the line.
Definition: LiquidLine.cpp:54
void softUpdate() const
Prints the current screen to the display (without clearing).
Definition: LiquidSystem.cpp:175
bool set_focusPosition(Position position)
Sets the focus position for the whole menu at once.
Definition: LiquidSystem.cpp:148