43 #include <LiquidCrystal.h> 45 #include <avr/pgmspace.h> 52 #ifndef LiquidCrystal_h 53 #warning "LiquidMenu: LiquidCrystal library is required!" 57 #warning "LiquidMenu: Debugging messages are enabled." 68 BOOL = 1, BOOLEAN = 1,
70 UINT8_T = 9, BYTE = 9,
75 FLOAT = 50, DOUBLE = 50,
79 PROG_CONST_CHAR_PTR = 65,
88 RIGHT = 1, NORMAL = 1,
206 : _row(row), _column(column), _focusRow(row - 1),
207 _focusColumn(column - 1), _focusPosition(
Position::NORMAL),
208 _variableCount(0), _focusable(false) {
210 _variable[i] =
nullptr;
211 _variableType[i] = DataType::NOT_USED;
224 template <
typename A>
227 add_variable(variableA);
237 template <
typename A,
typename B>
239 A &variableA, B &variableB)
241 add_variable(variableB);
252 template <
typename A,
typename B,
typename C>
254 A &variableA, B &variableB, C &variableC)
255 :
LiquidLine(column, row, variableA, variableB) {
256 add_variable(variableC);
268 template <
typename A,
typename B,
typename C,
typename D>
270 A &variableA, B &variableB, C &variableC, D &variableD)
271 :
LiquidLine(column, row, variableA, variableB, variableC) {
272 add_variable(variableD);
293 template <
typename T>
297 _variable[_variableCount] = (
void*)&variable;
303 DEBUG(F(
"Adding variable "));
DEBUG(variable);
304 DEBUGLN(F(
" failed, edit LiquidMenu_config.h to allow for more variables"));
327 bool attach_function(uint8_t number,
void (*
function)(
void));
347 uint8_t column = 0, uint8_t row = 0);
359 bool set_asGlyph(uint8_t number);
370 bool set_asProgmem(uint8_t number);
383 void print(LiquidCrystal *p_liquidCrystal,
bool isFocused);
393 void print_variable(LiquidCrystal *p_liquidCrystal, uint8_t number);
404 bool call_function(uint8_t number)
const;
406 uint8_t _row, _column, _focusRow, _focusColumn;
408 uint8_t _variableCount;
519 void hide(
bool hide);
530 void print(LiquidCrystal *p_liquidCrystal)
const;
587 LiquidMenu(LiquidCrystal &liquidCrystal, uint8_t startingScreen = 1);
597 uint8_t startingScreen = 1);
608 LiquidScreen &liquidScreen2, uint8_t startingScreen = 1);
621 uint8_t startingScreen = 1);
635 LiquidScreen &liquidScreen4, uint8_t startingScreen = 1);
790 LiquidCrystal *_p_liquidCrystal;
792 uint8_t _screenCount;
793 uint8_t _currentScreen;
829 uint8_t startingMenu = 1);
839 LiquidMenu &liquidMenu3, uint8_t startingMenu = 1);
851 uint8_t startingMenu = 1);
892 void operator++(
int);
895 void previous_screen();
907 void operator--(
int);
922 bool change_screen(uint8_t number);
937 bool operator=(uint8_t number);
946 void switch_focus(
bool forward =
true);
963 bool set_focusPosition(
Position position);
979 bool set_focusSymbol(
Position position, uint8_t symbol[8]);
993 bool call_function(uint8_t number)
const;
1008 void softUpdate()
const;
1015 uint8_t _currentMenu;
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC)
Constructor for three variables/constants.
Definition: LiquidMenu.h:253
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:808
Represents the individual lines printed on the display.
Definition: LiquidMenu.h:191
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:294
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:238
Represents a screen shown on the display.
Definition: LiquidMenu.h:425
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:205
LiquidLine(uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC, D &variableD)
Constructor for four variables/constants.
Definition: LiquidMenu.h:269
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:225
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