LiquidMenu  1.6.0
Menu creation Arduino library for LCDs, wraps LiquidCrystal.
Friends | List of all members
LiquidLine Class Reference

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...
 
void set_decimalPlaces (uint8_t decimalPlaces)
 Sets the decimal places for floating point variables. 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 controls them. The public methods are for configuration only.

Constructor & Destructor Documentation

◆ LiquidLine() [1/5]

LiquidLine::LiquidLine ( uint8_t  column,
uint8_t  row 
)
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]

template<typename A >
LiquidLine::LiquidLine ( uint8_t  column,
uint8_t  row,
A &  variableA 
)
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]

template<typename A , typename B >
LiquidLine::LiquidLine ( uint8_t  column,
uint8_t  row,
A &  variableA,
B &  variableB 
)
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]

template<typename A , typename B , typename C >
LiquidLine::LiquidLine ( uint8_t  column,
uint8_t  row,
A &  variableA,
B &  variableB,
C &  variableC 
)
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]

template<typename A , typename B , typename C , typename D >
LiquidLine::LiquidLine ( uint8_t  column,
uint8_t  row,
A &  variableA,
B &  variableB,
C &  variableC,
D &  variableD 
)
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()

template<typename T >
bool LiquidLine::add_variable ( T &  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.
See also
LiquidMenu_config.h
MAX_FUNCTIONS
bool LiquidMenu::call_function(uint8_t number) const

◆ 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 DisplayClass::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_decimalPlaces()

void LiquidLine::set_decimalPlaces ( uint8_t  decimalPlaces)

Sets the decimal places for floating point variables.

Parameters
decimalPlaces- number of decimal places to show

◆ 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 or CUSTOM
column- if using CUSTOM this specifies the column
row- 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. Use Position::(member) when specifying the position.
See also
Position

The documentation for this class was generated from the following files: