43 #include <avr/pgmspace.h> 51 #include <LiquidCrystal_I2C.h> 52 #define DisplayClass LiquidCrystal_I2C 53 #warning "LiquidMenu: Configured for I2C. Edit 'LiquidMenu_config.h' file to change it." 55 #include <LiquidCrystal.h> 56 #define DisplayClass LiquidCrystal 57 #warning "LiquidMenu: Configured for Parallel. Edit 'LiquidMenu_config.h' file to change it." 61 #warning "LiquidMenu: Debugging messages are enabled." 72 BOOL = 1, BOOLEAN = 1,
74 UINT8_T = 9, BYTE = 9,
79 FLOAT = 50, DOUBLE = 50,
83 PROG_CONST_CHAR_PTR = 65,
92 RIGHT = 1, NORMAL = 1,
210 : _row(row), _column(column), _focusRow(row - 1),
211 _focusColumn(column - 1), _focusPosition(
Position::NORMAL),
212 _variableCount(0), _focusable(false) {
214 _variable[i] =
nullptr;
215 _variableType[i] = DataType::NOT_USED;
228 template <
typename A>
231 add_variable(variableA);
241 template <
typename A,
typename B>
243 A &variableA, B &variableB)
245 add_variable(variableB);
256 template <
typename A,
typename B,
typename C>
258 A &variableA, B &variableB, C &variableC)
259 :
LiquidLine(column, row, variableA, variableB) {
260 add_variable(variableC);
272 template <
typename A,
typename B,
typename C,
typename D>
274 A &variableA, B &variableB, C &variableC, D &variableD)
275 :
LiquidLine(column, row, variableA, variableB, variableC) {
276 add_variable(variableD);
297 template <
typename T>
301 _variable[_variableCount] = (
void*)&variable;
307 DEBUG(F(
"Adding variable "));
DEBUG(variable);
308 DEBUGLN(F(
" failed, edit LiquidMenu_config.h to allow for more variables"));
331 bool attach_function(uint8_t number,
void (*
function)(
void));
351 uint8_t column = 0, uint8_t row = 0);
363 bool set_asGlyph(uint8_t number);
374 bool set_asProgmem(uint8_t number);
387 void print(DisplayClass *p_liquidCrystal,
bool isFocused);
397 void print_variable(DisplayClass *p_liquidCrystal, uint8_t number);
408 bool call_function(uint8_t number)
const;
410 uint8_t _row, _column, _focusRow, _focusColumn;
412 uint8_t _variableCount;
523 void hide(
bool hide);
534 void print(DisplayClass *p_liquidCrystal)
const;
591 LiquidMenu(DisplayClass &liquidCrystal, uint8_t startingScreen = 1);
601 uint8_t startingScreen = 1);
612 LiquidScreen &liquidScreen2, uint8_t startingScreen = 1);
625 uint8_t startingScreen = 1);
639 LiquidScreen &liquidScreen4, uint8_t startingScreen = 1);
802 DisplayClass *_p_liquidCrystal;
804 uint8_t _screenCount;
805 uint8_t _currentScreen;
841 uint8_t startingMenu = 1);
851 LiquidMenu &liquidMenu3, uint8_t startingMenu = 1);
863 uint8_t startingMenu = 1);
904 void operator++(
int);
907 void previous_screen();
919 void operator--(
int);
934 bool change_screen(uint8_t number);
949 bool operator=(uint8_t number);
958 void switch_focus(
bool forward =
true);
975 bool set_focusPosition(
Position position);
991 bool set_focusSymbol(
Position position, uint8_t symbol[8]);
1005 bool call_function(uint8_t number)
const;
1011 void update()
const;
1020 void softUpdate()
const;
1027 uint8_t _currentMenu;
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC)
Constructor for three variables/constants.
Definition: LiquidMenu.h:257
void operator--()
Switches to the previous screen.
Definition: LiquidSystem.cpp:102
bool operator=(LiquidScreen &p_liquidScreen)
Switches to the specified screen.
Definition: LiquidSystem.cpp:122
Represents a collection of menus forming a menu system.
Definition: LiquidMenu.h:820
Represents the individual lines printed on the display.
Definition: LiquidMenu.h:195
void update() const
Prints the current screen to the display.
Definition: LiquidSystem.cpp:145
void softUpdate() const
Prints the current screen to the display (without clearing).
Definition: LiquidSystem.cpp:149
void switch_focus(bool forward=true)
Switches the focus.
Definition: LiquidSystem.cpp:126
bool add_variable(T &variable)
Adds a variable to the line.
Definition: LiquidMenu.h:298
void previous_screen()
Switches to the previous screen.
Definition: LiquidSystem.cpp:98
bool set_focusPosition(Position position)
Sets the focus position for the whole menu at once.
Definition: LiquidSystem.cpp:130
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB)
Constructor for two variables/constants.
Definition: LiquidMenu.h:242
Represents a screen shown on the display.
Definition: LiquidMenu.h:429
bool set_focusSymbol(Position position, uint8_t symbol[8])
Changes the focus indicator's symbol.
Definition: LiquidSystem.cpp:134
bool call_function(uint8_t number) const
Calls an attached function specified by the number.
Definition: LiquidSystem.cpp:138
bool change_screen(LiquidScreen &p_liquidScreen)
Switches to the specified screen.
Definition: LiquidSystem.cpp:114
LiquidLine(uint8_t column, uint8_t row)
The main constructor.
Definition: LiquidMenu.h:209
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC, D &variableD)
Constructor for four variables/constants.
Definition: LiquidMenu.h:273
void next_screen()
Switches to the next screen.
Definition: LiquidSystem.cpp:86
LiquidLine(uint8_t column, uint8_t row, A &variableA)
Constructor for one variable/constant.
Definition: LiquidMenu.h:229
void operator++()
Switches to the next screen.
Definition: LiquidSystem.cpp:90
bool set_focusPosition(Position position)
Sets the focus position for the whole screen at once.
Definition: LiquidScreen.cpp:71