LiquidMenu  1.5.1
Menu creation Arduino library for LCDs, wraps LiquidCrystal.
List of all members
LiquidSystem Class Reference

Represents a collection of menus forming a menu system. More...

#include <LiquidMenu.h>

Public Member Functions

Constructors
 LiquidSystem (uint8_t startingMenu=1)
 The main constructor. More...
 
 LiquidSystem (LiquidMenu &liquidMenu1, LiquidMenu &liquidMenu2, uint8_t startingMenu=1)
 Constructor for 2 LiquidMenu objects. More...
 
 LiquidSystem (LiquidMenu &liquidMenu1, LiquidMenu &liquidMenu2, LiquidMenu &liquidMenu3, uint8_t startingMenu=1)
 Constructor for 3 LiquidMenu objects. More...
 
 LiquidSystem (LiquidMenu &liquidMenu1, LiquidMenu &liquidMenu2, LiquidMenu &liquidMenu3, LiquidMenu &liquidMenu4, uint8_t startingMenu=1)
 Constructor for 4 LiquidMenu objects. More...
 
Public methods
bool add_menu (LiquidMenu &liquidMenu)
 Adds a LiquidMenu object to the menu system. More...
 
bool change_menu (LiquidMenu &p_liquidMenu)
 Switches to the specified menu. More...
 
LiquidScreenget_currentScreen () const
 Returns a reference to the current screen. 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_focusedLine (uint8_t lineIndex)
 Directly select focused line. More...
 
uint8_t get_focusedLine () const
 Get the index of the currently focused line. 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 is_callable (uint8_t number) const
 Check if there is an attached function at the specified number. 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...
 

Detailed Description

Represents a collection of menus forming a menu system.

A menu system is made up of LiquidMenu objects. It holds pointers to them and calls their functions depending on which one is active. This class is uses the same public methods as LiquidMenu with the addition of a method for adding a LiquidMenu object and a method for changing the currently active menu. This class is optional, it is used only if there is a need for multiple menus.

See also
LiquidMenu

Constructor & Destructor Documentation

◆ LiquidSystem() [1/4]

LiquidSystem::LiquidSystem ( uint8_t  startingMenu = 1)
explicit

The main constructor.

This is the main constructor that gets called every time.

Parameters
startingMenu- the number of the menu that will be shown first

◆ LiquidSystem() [2/4]

LiquidSystem::LiquidSystem ( LiquidMenu liquidMenu1,
LiquidMenu liquidMenu2,
uint8_t  startingMenu = 1 
)

Constructor for 2 LiquidMenu objects.

Parameters
&liquidMenu1- pointer to a LiquidMenu object
&liquidMenu2- pointer to a LiquidMenu object
startingMenu- the number of the menu that will be shown first

◆ LiquidSystem() [3/4]

LiquidSystem::LiquidSystem ( LiquidMenu liquidMenu1,
LiquidMenu liquidMenu2,
LiquidMenu liquidMenu3,
uint8_t  startingMenu = 1 
)

Constructor for 3 LiquidMenu objects.

Parameters
&liquidMenu1- pointer to a LiquidMenu object
&liquidMenu2- pointer to a LiquidMenu object
&liquidMenu3- pointer to a LiquidMenu object
startingMenu- the number of the menu that will be shown first

◆ LiquidSystem() [4/4]

LiquidSystem::LiquidSystem ( LiquidMenu liquidMenu1,
LiquidMenu liquidMenu2,
LiquidMenu liquidMenu3,
LiquidMenu liquidMenu4,
uint8_t  startingMenu = 1 
)

Constructor for 4 LiquidMenu objects.

Parameters
&liquidMenu1- pointer to a LiquidMenu object
&liquidMenu2- pointer to a LiquidMenu object
&liquidMenu3- pointer to a LiquidMenu object
&liquidMenu4- pointer to a LiquidMenu object
startingMenu- the number of the menu that will be shown first

Member Function Documentation

◆ add_menu()

bool LiquidSystem::add_menu ( LiquidMenu liquidMenu)

Adds a LiquidMenu object to the menu system.

Parameters
&liquidMenu- pointer to a LiquidMenu object
Returns
true on success and false if the maximum amount of menus has been reached
Note
The maximum amount of menus per menu system is specified in LiquidMenu_config.h as MAX_MENUS. The default is 12.
See also
LiquidMenu_config.h
MAX_MENUS

◆ call_function()

bool LiquidSystem::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))

◆ change_menu()

bool LiquidSystem::change_menu ( LiquidMenu p_liquidMenu)

Switches to the specified menu.

Parameters
*p_liquidMenu- pointer to the LiquidMenu object
Returns
true on success and false if the menu is not found

◆ change_screen() [1/2]

bool LiquidSystem::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

◆ change_screen() [2/2]

bool LiquidSystem::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.

◆ get_currentScreen()

LiquidScreen * LiquidSystem::get_currentScreen ( ) const

Returns a reference to the current screen.

Call this method to obtain a reference to the current screen.

Returns
a pointer to the current screen.

◆ get_focusedLine()

uint8_t LiquidSystem::get_focusedLine ( ) const

Get the index of the currently focused line.

Returns
the index of the currently focused line

◆ is_callable()

bool LiquidSystem::is_callable ( uint8_t  number) const

Check if there is an attached function at the specified number.

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))

◆ next_screen()

void LiquidSystem::next_screen ( )

Switches to the next screen.

◆ operator++() [1/2]

void LiquidSystem::operator++ ( )

Switches to the next screen.

Note
Prefix increment operator overloading.

◆ operator++() [2/2]

void LiquidSystem::operator++ ( int  )

Switches to the next screen.

Note
Postfix increment operator overloading.

◆ operator--() [1/2]

void LiquidSystem::operator-- ( )

Switches to the previous screen.

Note
Prefix decrement operator overloading.

◆ operator--() [2/2]

void LiquidSystem::operator-- ( int  )

Switches to the previous screen.

Note
Postfix decrement operator overloading.

◆ operator=() [1/2]

bool LiquidSystem::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

◆ operator=() [2/2]

bool LiquidSystem::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.

◆ previous_screen()

void LiquidSystem::previous_screen ( )

Switches to the previous screen.

◆ set_focusedLine()

bool LiquidSystem::set_focusedLine ( uint8_t  lineIndex)

Directly select focused line.

Parameters
lineIndex- index of the focused line
Returns
true: on success, false: when the selected line doesn't exist or it isn't focusable

◆ set_focusPosition()

bool LiquidSystem::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 column 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 specifying the position.
See also
Position

◆ set_focusSymbol()

bool LiquidSystem::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 specifying the position.
See also
Position

◆ softUpdate()

void LiquidSystem::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.

◆ switch_focus()

void LiquidSystem::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

◆ update()

void LiquidSystem::update ( ) const

Prints the current screen to the display.

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


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