LCDGFX LCD display driver  1.2.0
Lightweight graphics library for SSD1306, SSD1325, SSD1327, SSD1331, SSD1351, SH1106, SH1107, IL9163, ST7735, ST7789, ILI9341, PCD8544 displays over I2C/SPI
NanoMenu< T > Class Template Referenceabstract

This is base class for user menu implementations. More...

#include <menu.h>

Inheritance diagram for NanoMenu< T >:
Collaboration diagram for NanoMenu< T >:

Public Member Functions

 NanoMenu (const NanoPoint &pos)
 Creates menu object. More...
 
 NanoMenu ()
 Creates instance of NanoMenu at 0,0 position.
 
void add (NanoObject< T > &item)
 Adds new menu item to the end of the list. More...
 
void insert (NanoObject< T > &item)
 Inserts new menu item to the beginning of the list. More...
 
NanoObject< T > * getSelected ()
 Returns pointer to active menu item. More...
 
void down ()
 Moves active menu item position to the next item. More...
 
void up ()
 Moves active menu item position to the previous item. More...
 
- Public Member Functions inherited from NanoObjectList< T >
NanoObject< T > * getNext (NanoObject< T > *prev=nullptr)
 Returns next object in the list. More...
 
NanoObject< T > * getPrev (NanoObject< T > *curr=nullptr)
 Returns previous object in the list. More...
 
void update () override
 Updates all objects in the list.
 
void refresh () override
 Refreshes all objects in the list.
 
void draw () override
 Draw all objects from the list in the buffer.
 
bool has (NanoObject< T > &object)
 Returns true if NanoObjectList contains specified object. More...
 
void add (NanoObject< T > &object)
 Adds new NanoObject to the end of the list and marks it for refresh. More...
 
void insert (NanoObject< T > &object)
 Adds new NanoObject to the beginning of the list and marks it for refresh. More...
 
void remove (NanoObject< T > &object)
 Removes NanoObject from the list and marks occupied area for refresh. More...
 
- Public Member Functions inherited from NanoObject< T >
 NanoObject (const NanoPoint &pos)
 Creates basic object with the size [1,1]. More...
 
 NanoObject (const NanoPoint &pos, const NanoPoint &size)
 Creates basic object with arbitrary size. More...
 
lcdint_t width () const
 Returns width of NanoObject.
 
lcdint_t height () const
 Returns height of NanoObject.
 
void moveTo (const NanoPoint &p)
 Moves sprite to new position and marks screen area for refresh.
 
void moveBy (const NanoPoint &p)
 Moves sprite to new position by specified offset.
 
void resize (const NanoPoint &size)
 Resizes NanoObject and marks screen area for refresh. More...
 
void setSize (const NanoPoint &size)
 Sets new size of NanoObject. More...
 
void setPos (const NanoPoint &p)
 Sets position of NanoObject, doesn't mark for update content on the screen.
 
const NanoPoint bottom () const
 Returns bottom-center point of the sprite.
 
const NanoPoint top () const
 Returns top-center point of the sprite.
 
const NanoPoint left () const
 Returns left-center point of the sprite.
 
const NanoPoint right () const
 Returns right-center point of the sprite.
 
const NanoPoint center () const
 Returns center point of the sprite.
 
lcdint_t x () const
 Returns sprite x position.
 
lcdint_t y () const
 Returns sprite y position.
 
const NanoPointgetPosition () const
 Returns current sprite position (top-left corner)
 
const NanoRectgetRect () const
 Returns rectangle area, occupied by the NanoObject.
 
- Public Member Functions inherited from NanoEngineObject< T >
void focus ()
 Sets logic focus on NanoEngineObject.
 
void defocus ()
 Clears logic focus from NanoEngineObject.
 
bool isFocused ()
 Returns true if logic focus points to the object. More...
 
bool hasTiler ()
 Returns true if NanoEngineObject is bound to NanoEngine instance.
 
T & getTiler ()
 Returns reference to NanoEngine. More...
 

Protected Member Functions

virtual void updateMenuItemsPosition ()=0
 Recalculates position of all menu items by aligning each item in accordance with menu type.
 
- Protected Member Functions inherited from NanoEngineObject< T >
void setTiler (T *tiler)
 Bind NanoEngineObject to specific NanoEngine. More...
 

Additional Inherited Members

- Protected Attributes inherited from NanoObject< T >
NanoRect m_rect
 Rectangle area occupied by the object.
 
- Protected Attributes inherited from NanoEngineObject< T >
T * m_tiler = nullptr
 Active tiler, assigned to the NanoEngineObject.
 
NanoEngineObject< T > * m_next = nullptr
 Next NanoEngineObject in the list.
 

Detailed Description

template<class T>
class NanoMenu< T >

This is base class for user menu implementations.

NanoMenu can work only as part of NanoEngine.

Definition at line 51 of file menu.h.

Constructor & Destructor Documentation

◆ NanoMenu()

template<class T >
NanoMenu< T >::NanoMenu ( const NanoPoint pos)
inlineexplicit

Creates menu object.

Parameters
posposition of the sprite in global coordinates

Definition at line 59 of file menu.h.

Member Function Documentation

◆ add()

template<class T >
void NanoMenu< T >::add ( NanoObject< T > &  item)
inline

Adds new menu item to the end of the list.

Parameters
itemmenu item to add

Definition at line 77 of file menu.h.

◆ down()

template<class T >
void NanoMenu< T >::down ( )
inline

Moves active menu item position to the next item.

If active menu item is the last one, then first menu item becomes active.

Definition at line 120 of file menu.h.

◆ getSelected()

template<class T >
NanoObject<T>* NanoMenu< T >::getSelected ( )
inline

Returns pointer to active menu item.

If nothing is selected returns nullptr.

Definition at line 110 of file menu.h.

◆ insert()

template<class T >
void NanoMenu< T >::insert ( NanoObject< T > &  item)
inline

Inserts new menu item to the beginning of the list.

Parameters
itemmenu item to insert

Definition at line 94 of file menu.h.

◆ up()

template<class T >
void NanoMenu< T >::up ( )
inline

Moves active menu item position to the previous item.

If active menu item is the first one, then last menu item becomes active.

Definition at line 142 of file menu.h.


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