LiquidMenu Class Reference

Represents a collection of screens forming a menu. More...

#include <LiquidMenu.h>

Public Member Functions

Constructors
 LiquidMenu (LiquidCrystal &liquidCrystal, uint8_t startingScreen=1)
 The main constructor. More...
 
 LiquidMenu (LiquidCrystal &liquidCrystal, LiquidScreen &liquidScreen, uint8_t startingScreen=1)
 Constructor for 1 LiquidScreen object. More...
 
 LiquidMenu (LiquidCrystal &liquidCrystal, LiquidScreen &liquidScreen1, LiquidScreen &liquidScreen2, uint8_t startingScreen=1)
 Constructor for 2 LiquidScreen objects. More...
 
 LiquidMenu (LiquidCrystal &liquidCrystal, LiquidScreen &liquidScreen1, LiquidScreen &liquidScreen2, LiquidScreen &liquidScreen3, uint8_t startingScreen=1)
 Constructor for 3 LiquidScreen objects. More...
 
 LiquidMenu (LiquidCrystal &liquidCrystal, LiquidScreen &liquidScreen1, LiquidScreen &liquidScreen2, LiquidScreen &liquidScreen3, LiquidScreen &liquidScreen4, uint8_t startingScreen=1)
 Constructor for 4 LiquidScreen objects. More...
 
Public methods
bool add_screen (LiquidScreen &liquidScreen)
 Adds a LiquidScreen object to the menu. More...
 
void next_screen ()
 Switches to the next screen. More...
 
void operator++ ()
 Switches to the next screen. More...
 
void operator++ (int)
 Switches to the next screen. More...
 
void previous_screen ()
 Switches to the previous screen. More...
 
void operator-- ()
 Switches to the previous screen. More...
 
void operator-- (int)
 Switches to the previous screen. More...
 
bool change_screen (LiquidScreen &p_liquidScreen)
 Switches to the specified screen. More...
 
bool change_screen (uint8_t number)
 Switches to the specified screen. More...
 
bool operator= (LiquidScreen &p_liquidScreen)
 Switches to the specified screen. More...
 
bool operator= (uint8_t number)
 Switches to the specified screen. More...
 
void switch_focus (bool forward=true)
 Switches the focus. More...
 
bool set_focusPosition (Position position)
 Sets the focus position for the whole menu at once. More...
 
bool set_focusSymbol (Position position, uint8_t symbol[8])
 Changes the focus indicator's symbol. More...
 
bool call_function (uint8_t number) const
 Calls an attached function specified by the number. More...
 
void update () const
 Prints the current screen to the display. More...
 
void softUpdate () const
 Prints the current screen to the display (without clearing). More...
 

Friends

class LiquidSystem
 

Detailed Description

Represents a collection of screens forming a menu.

A menu is made up of LiquidScreen objects. It holds pointers to them and calls their functions depending on which one is active. This is the class used for control. It is possible to use multiple menus, it that case this classes' objects go into a LiquidSystem object which controls them using the same public methods.

See also
LiquidScreen
Examples:
buttons_menu.ino, focus_menu.ino, functions_menu.ino, hello_menu.ino, serial_menu.ino, and system_menu.ino.

Constructor & Destructor Documentation

LiquidMenu::LiquidMenu ( LiquidCrystal &  liquidCrystal,
uint8_t  startingScreen = 1 
)

The main constructor.

This is the main constructor that gets called every time.

Parameters
&liquidCrystal- pointer to the LiquidCrystal object
startingScreen- the number of the screen that will be shown first
LiquidMenu::LiquidMenu ( LiquidCrystal &  liquidCrystal,
LiquidScreen liquidScreen,
uint8_t  startingScreen = 1 
)

Constructor for 1 LiquidScreen object.

Parameters
&liquidCrystal- pointer to the LiquidCrystal object
&liquidScreen- pointer to a LiquidScreen object
startingScreen- the number of the screen that will be shown first

+ Here is the call graph for this function:

LiquidMenu::LiquidMenu ( LiquidCrystal &  liquidCrystal,
LiquidScreen liquidScreen1,
LiquidScreen liquidScreen2,
uint8_t  startingScreen = 1 
)

Constructor for 2 LiquidScreen objects.

Parameters
&liquidCrystal- pointer to the LiquidCrystal object
&liquidScreen1- pointer to a LiquidScreen object
&liquidScreen2- pointer to a LiquidScreen object
startingScreen- the number of the screen that will be shown first

+ Here is the call graph for this function:

LiquidMenu::LiquidMenu ( LiquidCrystal &  liquidCrystal,
LiquidScreen liquidScreen1,
LiquidScreen liquidScreen2,
LiquidScreen liquidScreen3,
uint8_t  startingScreen = 1 
)

Constructor for 3 LiquidScreen objects.

Parameters
&liquidCrystal- pointer to the LiquidCrystal object
&liquidScreen1- pointer to a LiquidScreen object
&liquidScreen2- pointer to a LiquidScreen object
&liquidScreen3- pointer to a LiquidScreen object
startingScreen- the number of the screen that will be shown first

+ Here is the call graph for this function:

LiquidMenu::LiquidMenu ( LiquidCrystal &  liquidCrystal,
LiquidScreen liquidScreen1,
LiquidScreen liquidScreen2,
LiquidScreen liquidScreen3,
LiquidScreen liquidScreen4,
uint8_t  startingScreen = 1 
)

Constructor for 4 LiquidScreen objects.

Parameters
&liquidCrystal- pointer to the LiquidCrystal object
&liquidScreen1- pointer to a LiquidScreen object
&liquidScreen2- pointer to a LiquidScreen object
&liquidScreen3- pointer to a LiquidScreen object
&liquidScreen4- pointer to a LiquidScreen object
startingScreen- the number of the screen that will be shown first

+ Here is the call graph for this function:

Member Function Documentation

bool LiquidMenu::add_screen ( LiquidScreen liquidScreen)

Adds a LiquidScreen object to the menu.

Parameters
&liquidScreen- pointer to a LiquidScreen object
Returns
true on success and false if the maximum amount of screens has been reached
Note
The maximum amount of screens per menu is specified in LiquidMenu_config.h as MAX_SCREENS. The default is 16.
See also
LiquidMenu_config.h
MAX_SCREENS
Examples:
functions_menu.ino.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool LiquidMenu::call_function ( uint8_t  number) const

Calls an attached function specified by the number.

Calls the function specified by the number argument for the current screen and for the focused line.

Parameters
number- number of the function in the array
Returns
true if there is a function at the specified number
Note
Function numbering starts from 1.
See also
bool LiquidLine::attach_function(uint8_t number, void (*function)(void))
Examples:
functions_menu.ino.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool LiquidMenu::change_screen ( LiquidScreen p_liquidScreen)

Switches to the specified screen.

Parameters
*p_liquidScreen- pointer to the LiquidScreen object
Returns
true on success and false if the screen is not found

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool LiquidMenu::change_screen ( uint8_t  number)

Switches to the specified screen.

Parameters
number- the number of the screen
Returns
true on success and false if the number of the screen is invalid.

+ Here is the call graph for this function:

void LiquidMenu::next_screen ( )

Switches to the next screen.

Examples:
functions_menu.ino.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void LiquidMenu::operator++ ( )

Switches to the next screen.

Note
Prefix increment operator overloading.

+ Here is the call graph for this function:

void LiquidMenu::operator++ ( int  )

Switches to the next screen.

Note
Postfix increment operator overloading.

+ Here is the call graph for this function:

void LiquidMenu::operator-- ( )

Switches to the previous screen.

Note
Prefix decrement operator overloading.

+ Here is the call graph for this function:

void LiquidMenu::operator-- ( int  )

Switches to the previous screen.

Note
Postfix decrement operator overloading.

+ Here is the call graph for this function:

bool LiquidMenu::operator= ( LiquidScreen p_liquidScreen)

Switches to the specified screen.

Parameters
&p_liquidScreen- pointer to the screen
Returns
true on success and false if the screen is not found

+ Here is the call graph for this function:

bool LiquidMenu::operator= ( uint8_t  number)

Switches to the specified screen.

Parameters
number- the number of the screen
Returns
true on success and false if the number of the screen is invalid.

+ Here is the call graph for this function:

void LiquidMenu::previous_screen ( )

Switches to the previous screen.

Examples:
functions_menu.ino.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool LiquidMenu::set_focusPosition ( Position  position)

Sets the focus position for the whole menu at once.

The valid positions are LEFT and RIGHT. CUSTOM is not valid for this function because it needs individual colum and row for every line.

Parameters
position- LEFT or RIGHT
Returns
true on success and false if the position specified is invalid
Note
The Position is enum class. Use Position::(member) when specifeing the position.
See also
Position

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool LiquidMenu::set_focusSymbol ( Position  position,
uint8_t  symbol[8] 
)

Changes the focus indicator's symbol.

The symbol is changed for a particular position.

Parameters
position- the position for which the symbol will be changed
symbol[]- the symbol
Returns
true on success and false if the position specified is invalid
Note
The Position is enum class. Use Position::(member) when specifeing the position.
See also
Position

+ Here is the caller graph for this function:

void LiquidMenu::softUpdate ( ) const

Prints the current screen to the display (without clearing).

Call this method when there is a change in some of the variable attached and the new symbols cover all of the old symbols.

Note
This method doesn't clear the display.

+ Here is the caller graph for this function:

void LiquidMenu::switch_focus ( bool  forward = true)

Switches the focus.

Switches the focus to the next or previous line according to the passed parameter.

Parameters
forward- true for forward, false for backward
Examples:
functions_menu.ino.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void LiquidMenu::update ( ) const

Prints the current screen to the display.

Call this method when there is a change in some of the variable attached.

Examples:
functions_menu.ino.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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