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

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

#include <LiquidMenu.h>

Public Member Functions

Constructors
 LiquidMenu (DisplayClass &liquidCrystal, uint8_t startingScreen=1)
 The main constructor. More...
 
 LiquidMenu (DisplayClass &liquidCrystal, LiquidScreen &liquidScreen, uint8_t startingScreen=1)
 Constructor for 1 LiquidScreen object. More...
 
 LiquidMenu (DisplayClass &liquidCrystal, LiquidScreen &liquidScreen1, LiquidScreen &liquidScreen2, uint8_t startingScreen=1)
 Constructor for 2 LiquidScreen objects. More...
 
 LiquidMenu (DisplayClass &liquidCrystal, LiquidScreen &liquidScreen1, LiquidScreen &liquidScreen2, LiquidScreen &liquidScreen3, uint8_t startingScreen=1)
 Constructor for 3 LiquidScreen objects. More...
 
 LiquidMenu (DisplayClass &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...
 
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, bool refresh=true) 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...
 
void init () const
 Initializes the menu object. 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

Constructor & Destructor Documentation

◆ LiquidMenu() [1/5]

LiquidMenu::LiquidMenu ( DisplayClass liquidCrystal,
uint8_t  startingScreen = 1 
)

The main constructor.

This is the main constructor that gets called every time.

Parameters
&liquidCrystal- pointer to the DisplayClass object
startingScreen- the number of the screen that will be shown first

◆ LiquidMenu() [2/5]

LiquidMenu::LiquidMenu ( DisplayClass liquidCrystal,
LiquidScreen liquidScreen,
uint8_t  startingScreen = 1 
)

Constructor for 1 LiquidScreen object.

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

◆ LiquidMenu() [3/5]

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

Constructor for 2 LiquidScreen objects.

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

◆ LiquidMenu() [4/5]

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

Constructor for 3 LiquidScreen objects.

Parameters
&liquidCrystal- pointer to the DisplayClass 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

◆ LiquidMenu() [5/5]

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

Constructor for 4 LiquidScreen objects.

Parameters
&liquidCrystal- pointer to the DisplayClass 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

Member Function Documentation

◆ add_screen()

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

◆ call_function()

bool LiquidMenu::call_function ( uint8_t  number,
bool  refresh = true 
) 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
refresh- enable/disable updating the display
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_screen() [1/2]

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

◆ change_screen() [2/2]

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.

◆ get_currentScreen()

LiquidScreen * LiquidMenu::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 LiquidMenu::get_focusedLine ( ) const

Get the index of the currently focused line.

Returns
the index of the currently focused line

◆ init()

void LiquidMenu::init ( ) const

Initializes the menu object.

Call this method to fully initialize the menu object.

Note
Needed when using an I2C display library.

◆ is_callable()

bool LiquidMenu::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 LiquidMenu::next_screen ( )

Switches to the next screen.

◆ operator++() [1/2]

void LiquidMenu::operator++ ( )

Switches to the next screen.

Note
Prefix increment operator overloading.

◆ operator++() [2/2]

void LiquidMenu::operator++ ( int  )

Switches to the next screen.

Note
Postfix increment operator overloading.

◆ operator--() [1/2]

void LiquidMenu::operator-- ( )

Switches to the previous screen.

Note
Prefix decrement operator overloading.

◆ operator--() [2/2]

void LiquidMenu::operator-- ( int  )

Switches to the previous screen.

Note
Postfix decrement operator overloading.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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.

◆ previous_screen()

void LiquidMenu::previous_screen ( )

Switches to the previous screen.

◆ set_focusedLine()

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

◆ softUpdate()

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.

◆ switch_focus()

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

◆ update()

void LiquidMenu::update ( ) const

Prints the current screen to the display.

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


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