Represents the individual lines printed on the display. More...
#include <LiquidMenu.h>
Public Member Functions | |
Constructors | |
LiquidLine (uint8_t column, uint8_t row) | |
The main constructor. More... | |
template<typename A > | |
LiquidLine (uint8_t column, uint8_t row, A &variableA) | |
Constructor for one variable/constant. More... | |
template<typename A , typename B > | |
LiquidLine (uint8_t column, uint8_t row, A &variableA, B &variableB) | |
Constructor for two variables/constants. More... | |
template<typename A , typename B , typename C > | |
LiquidLine (uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC) | |
Constructor for three variables/constants. More... | |
template<typename A , typename B , typename C , typename D > | |
LiquidLine (uint8_t column, uint8_t row, A &variableA, B &variableB, C &variableC, D &variableD) | |
Constructor for four variables/constants. More... | |
Public methods | |
template<typename T > | |
bool | add_variable (T &variable) |
Adds a variable to the line. More... | |
bool | attach_function (uint8_t number, void(*function)(void)) |
Attaches a callback function to the line. More... | |
bool | set_focusPosition (Position position, uint8_t column=0, uint8_t row=0) |
Configures the focus indicator position for the line. More... | |
bool | set_asGlyph (uint8_t number) |
Converts a byte variable into a glyph index. More... | |
bool | set_asProgmem (uint8_t number) |
Converts a const char pointer variable into const char pointer PROGMEM one. More... | |
Friends | |
class | LiquidScreen |
Detailed Description
Represents the individual lines printed on the display.
This is the lowest class in the hierarchy, it holds pointers to the variables/constants that will be printed, where the line is positioned, where the focus indicator is positioned and pointers to the callback functions. This classes' objects go into a LiquidScreen object which which controls them. The public methods are for configuration only.
- Examples:
- buttons_menu.ino, focus_menu.ino, functions_menu.ino, hello_menu.ino, serial_menu.ino, and system_menu.ino.
Constructor & Destructor Documentation
§ LiquidLine() [1/5]
|
inline |
The main constructor.
This is the main constructor that gets called every time.
- Parameters
-
column - the column at which the line starts row - the row at which the line is printed
§ LiquidLine() [2/5]
|
inline |
Constructor for one variable/constant.
- Parameters
-
column - the column at which the line starts row - the row at which the line is printed &variableA - variable/constant to be printed
§ LiquidLine() [3/5]
|
inline |
Constructor for two variables/constants.
- Parameters
-
column - the column at which the line starts row - the row at which the line is printed &variableA - variable/constant to be printed &variableB - variable/constant to be printed
§ LiquidLine() [4/5]
|
inline |
Constructor for three variables/constants.
- Parameters
-
column - the column at which the line starts row - the row at which the line is printed &variableA - variable/constant to be printed &variableB - variable/constant to be printed &variableC - variable/constant to be printed
§ LiquidLine() [5/5]
|
inline |
Constructor for four variables/constants.
- Parameters
-
column - the column at which the line starts row - the row at which the line is printed &variableA - variable/constant to be printed &variableB - variable/constant to be printed &variableC - variable/constant to be printed &variableD - variable/constant to be printed
Member Function Documentation
§ add_variable()
|
inline |
Adds a variable to the line.
- Parameters
-
&variable - reference to the variable
- Returns
- true on success and false if the maximum amount of variables has been reached
- Note
- The maximum amount of variable per line is specified in LiquidMenu_config.h as
MAX_VARIABLES
. The default is 5.
- See also
- LiquidMenu_config.h
- MAX_VARIABLES
§ attach_function()
bool LiquidLine::attach_function | ( | uint8_t | number, |
void(*)(void) | function | ||
) |
Attaches a callback function to the line.
The number is used for identification. The callback function can later be called when the line is focused with LiquidMenu::call_function(uint8_t number) const
.
- Parameters
-
number - function number used for identification *function - pointer to the function
- Returns
- true on success and false if maximum amount of functions has been reached
- Note
- Function numbering starts from 1.
-
The maximum amount of functions per line is specified in LiquidMenu_config.h as
MAX_FUNCTIONS
. The default is 8.
- Examples:
- functions_menu.ino, and system_menu.ino.
§ set_asGlyph()
bool LiquidLine::set_asGlyph | ( | uint8_t | number | ) |
Converts a byte variable into a glyph index.
If a custom character (glyph) was created using LiquidCrystal::createChar(byte index, byte character[8])
it can be displayed as a normal variable using this method.
- Parameters
-
number - the variable number that will be converted to an index
- Returns
- true on success and false if the variable with that number is not a
byte
.
§ set_asProgmem()
bool LiquidLine::set_asProgmem | ( | uint8_t | number | ) |
Converts a const char pointer variable into const char pointer PROGMEM one.
Use this function to tell the object that the attached const char pointer variable is saved in flash memory rather than in RAM like a normal variable.
- Parameters
-
number - the variable number that will be converted
- Returns
- true on success and false if the variable with that number is not a
const char[]
.
§ set_focusPosition()
bool LiquidLine::set_focusPosition | ( | Position | position, |
uint8_t | column = 0 , |
||
uint8_t | row = 0 |
||
) |
Configures the focus indicator position for the line.
The valid positions are LEFT
, RIGHT
and CUSTOM
. The CUSTOM
position is absolute so it also needs the column and row that it will be printed on.
- Parameters
-
position - LEFT
,RIGHT
orCUSTOM
column - if using CUSTOM
this specifies the columnrow - if using CUSTOM
this specifies the row
- Returns
- true on success and false if the position specified is invalid
- Note
- The
Position
is enum class. UsePosition::(member)
when specifying the position.
- See also
- Position
- Examples:
- system_menu.ino.
The documentation for this class was generated from the following files:
- LiquidMenu.h
- LiquidLine.cpp