TinyMaterialDesign
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
PageNavigator< RGB_T > Class Template Reference

Connects Pages with a NavigationBar: one destination per page, only the selected page is visible. All pages share the same bounds, so the screen itself never scrolls; each page scrolls on its own. More...

#include <Page.h>

Public Member Functions

 PageNavigator (Screen< RGB_T > &screen, NavigationBar< RGB_T > &nav)
 
void addPage (Page< RGB_T > &page)
 Adds a page (before begin()).
 
void begin (Bounds pageBounds)
 Adds the navigation bar (fixed) and the pages (with the indicated bounds) to the screen, builds the pages and shows the first one.
 
void show (int index)
 Shows the page with the index.
 
bool tick (uint32_t nowMs)
 Calls tick() of the visible page: true if it must be redrawn.
 
int current () const
 
int count () const
 
Page< RGB_T > & page (int index)
 
Page< RGB_T > & currentPage ()
 

Public Attributes

std::function< void(int index)> onPageChanged
 Called after the page was changed (by the user or show()).
 

Detailed Description

template<typename RGB_T = TINYMD_DEFAULT_RGB_T>
class tinymd::PageNavigator< RGB_T >

Connects Pages with a NavigationBar: one destination per page, only the selected page is visible. All pages share the same bounds, so the screen itself never scrolls; each page scrolls on its own.

NavigationBar<RGB565> nav(Bounds(0, 264, 240, 56)); PageNavigator<RGB565> pages(app.screen(), nav); pages.addPage(clockPage); pages.addPage(settingsPage); pages.begin(Bounds(0, 40, 240, 224)); // adds nav + pages, builds them // loop(): if (pages.tick(millis())) app.screen().invalidate();

Constructor & Destructor Documentation

◆ PageNavigator()

PageNavigator ( Screen< RGB_T > &  screen,
NavigationBar< RGB_T > &  nav 
)
inline

Member Function Documentation

◆ addPage()

void addPage ( Page< RGB_T > &  page)
inline

Adds a page (before begin()).

◆ begin()

void begin ( Bounds  pageBounds)
inline

Adds the navigation bar (fixed) and the pages (with the indicated bounds) to the screen, builds the pages and shows the first one.

◆ count()

int count ( ) const
inline

◆ current()

int current ( ) const
inline

◆ currentPage()

Page< RGB_T > & currentPage ( )
inline

◆ page()

Page< RGB_T > & page ( int  index)
inline

◆ show()

void show ( int  index)
inline

Shows the page with the index.

◆ tick()

bool tick ( uint32_t  nowMs)
inline

Calls tick() of the visible page: true if it must be redrawn.

Member Data Documentation

◆ onPageChanged

std::function<void(int index)> onPageChanged

Called after the page was changed (by the user or show()).


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