|
TinyMaterialDesign
|
One page (tab) of an app: a scrollable Container with a title and an icon for the navigation, that builds its own widgets. More...
#include <Page.h>


Public Member Functions | |
| Page (const char *title="", IconPainter< RGB_T > icon=nullptr) | |
| virtual const char * | title () const |
| Label and icon of the page in a NavigationBar. | |
| virtual IconPainter< RGB_T > | icon () const |
| void | setTitle (const char *title) |
| void | setIcon (IconPainter< RGB_T > icon) |
| virtual void | build () |
| Creates the widgets (called once by PageNavigator::begin()). | |
| virtual void | onShow () |
| The page becomes visible. | |
| virtual void | onHide () |
| The page is hidden (another page is shown). | |
| virtual bool | tick (uint32_t nowMs) |
Public Member Functions inherited from Container< RGB_T > | |
| Container ()=default | |
| Container (Bounds containerBounds) | |
| void | addChild (Widget< RGB_T > &child) |
| bool | removeChild (Widget< RGB_T > &child) |
| void | clearChildren () |
| Removes all children (they are not deleted) and scrolls to the top. | |
| int | childrenCount () const |
| Number of children added with addChild(). | |
| void | setScrollOffset (int32_t offset) |
| void | scrollToChild (const Widget< RGB_T > &child, int32_t margin=4) |
| void | setChildProvider (ChildCountFn count, ChildAtFn at) |
| void | setUniformItemHeight (int32_t height) |
| void | setTheme (const MaterialTheme< RGB_T > &theme) override |
| void | draw (tinygpu::ISurface< RGB_T > &target) override |
| void | drawBackground (tinygpu::ISurface< RGB_T > &target) override |
| bool | update (uint32_t nowMs) override |
| bool | onGesture (const tinygpu::GestureEvent &event) override |
| Handles one gesture event. Returns true if this widget consumed it. | |
| int | childCount () const override |
| Widget< RGB_T > * | child (int index) override |
| int32_t | scrollOffset () const |
| Current vertical scroll offset (0 = content's natural top). | |
| bool | isDraggableAt (int32_t x, int32_t y) const override |
| bool | isContainer () const override |
| Provides true if the widget is a container. | |
Public Member Functions inherited from Widget< RGB_T > | |
| virtual | ~Widget ()=default |
| virtual void | setTheme (const MaterialTheme< RGB_T > &theme) |
| virtual void | draw (tinygpu::ISurface< RGB_T > &target)=0 |
| virtual bool | onGesture (const tinygpu::GestureEvent &event) |
| Handles one gesture event. Returns true if this widget consumed it. | |
| virtual bool | update (uint32_t nowMs) |
| virtual bool | isDraggable () const |
| virtual bool | isDraggableAt (int32_t x, int32_t y) const |
| virtual int | childCount () const |
| virtual Widget< RGB_T > * | child (int index) |
| virtual void | drawBackground (tinygpu::ISurface< RGB_T > &target) |
| virtual void | setThemeTint (RGB_T background, RGB_T foreground) |
| virtual bool | isContainer () const |
| Provides true if the widget is a container. | |
Additional Inherited Members | |
Public Types inherited from Container< RGB_T > | |
| using | ChildCountFn = std::function< int()> |
| using | ChildAtFn = std::function< Widget< RGB_T > &(int index)> |
Static Public Member Functions inherited from Container< RGB_T > | |
| static bool | isContinuousType (tinygpu::GestureType type) |
Public Attributes inherited from Widget< RGB_T > | |
| Bounds | bounds |
| bool | visible = true |
| bool | enabled = true |
Static Public Attributes inherited from Container< RGB_T > | |
| static constexpr int32_t | kScrollbarTouchWidth = 12 |
Protected Member Functions inherited from Container< RGB_T > | |
| int32_t | contentHeight () const |
| int32_t | scrollThumbHeight (int32_t content) const |
| bool | isOnScrollbar (int32_t x, int32_t y) const |
| void | scrollToTrackY (int32_t y) |
| void | clampScroll () |
| int | effectiveCount () const |
| Widget< RGB_T > * | effectiveChild (int index) const |
Protected Member Functions inherited from Widget< RGB_T > | |
| const MaterialTheme< RGB_T > & | theme () const |
| Convenience accessor for draw() overrides - see theme_. | |
Protected Attributes inherited from Container< RGB_T > | |
| std::vector< Widget< RGB_T > * > | children_ |
| ChildCountFn | childCountFn_ |
| ChildAtFn | childAtFn_ |
| int32_t | uniformItemHeight_ = 0 |
| Widget< RGB_T > * | activeChild_ = nullptr |
| bool | scrollDragActive_ = false |
| bool | scrollbarDragActive_ = false |
| A continuous gesture started on the scrollbar (see isOnScrollbar()). | |
| int32_t | scrollOffset_ = 0 |
Protected Attributes inherited from Widget< RGB_T > | |
| const MaterialTheme< RGB_T > * | theme_ = nullptr |
One page (tab) of an app: a scrollable Container with a title and an icon for the navigation, that builds its own widgets.
Derive from it and add the widgets in build(); PageNavigator calls it once the page is on the screen (so it already has its theme and bounds):
class ClockPage : public Page<RGB565> { public: ClockPage() : Page("Clock", drawClockIcon) {} void build() override { addChild(time_); ... } bool tick(uint32_t nowMs) override { ... return true; } // redraw };
|
inlineexplicit |
|
inlinevirtual |
Creates the widgets (called once by PageNavigator::begin()).
Reimplemented in WifiLoginPage< RGB_T >.
|
inlinevirtual |
|
inlinevirtual |
The page is hidden (another page is shown).
Reimplemented in WifiLoginPage< RGB_T >.
|
inlinevirtual |
The page becomes visible.
Reimplemented in WifiLoginPage< RGB_T >.
|
inline |
|
inline |
|
inlinevirtual |
Called regularly while the page is shown (PageNavigator::tick()): return true if the page changed and must be redrawn.
Reimplemented in WifiLoginPage< RGB_T >.
|
inlinevirtual |
Label and icon of the page in a NavigationBar.