|
TinyMaterialDesign
|
Persistent, non-modal inline message with text actions - Material's "banner", e.g. "You're offline. [Retry] [Dismiss]" pinned below an app bar. More...
#include <Banner.h>


Public Types | |
| using | ActionCountFn = std::function< int()> |
| using | ActionAtFn = std::function< Widget< RGB_T > &(int index)> |
Public Member Functions | |
| Banner ()=default | |
| Banner (Bounds bounds, const char *message) | |
| void | setMessage (const char *message) |
| void | addAction (Widget< RGB_T > &action) |
| void | setActionProvider (ActionCountFn count, ActionAtFn at) |
| Switches to callback-driven actions - see the class comment. | |
| void | setTheme (const MaterialTheme< RGB_T > &theme) override |
| Bounds | actionRect (int index, int count, int32_t width=80, int32_t height=32) const |
| void | draw (tinygpu::ISurface< RGB_T > &target) override |
| bool | onGesture (const tinygpu::GestureEvent &event) override |
| Handles one gesture event. Returns true if this widget consumed it. | |
| bool | update (uint32_t nowMs) override |
| bool | isDraggableAt (int32_t x, int32_t y) const override |
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 Attributes inherited from Widget< RGB_T > | |
| Bounds | bounds |
| bool | visible = true |
| bool | enabled = true |
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 Widget< RGB_T > | |
| const MaterialTheme< RGB_T > * | theme_ = nullptr |
Persistent, non-modal inline message with text actions - Material's "banner", e.g. "You're offline. [Retry] [Dismiss]" pinned below an app bar.
Unlike Dialog/Snackbar this isn't presented modally - add it with Screen::addWidget()/addFixedWidget() like any other widget and toggle visible yourself. Actions are not owned by Banner - same non-owning addAction() convention as Dialog::addAction().
Alternative to addAction(): setActionProvider(count, at) switches to callback-driven actions - see Container.h's class comment for the pattern.
| using ActionAtFn = std::function<Widget<RGB_T>&(int index)> |
| using ActionCountFn = std::function<int()> |
|
default |
|
inline |
Suggested rect for the index-th of count actions, right-aligned along the banner's bottom edge - same layout convention as Dialog::actionRect().
|
inline |
Registers action as content of this banner. Ignored while an action provider is active - see setActionProvider().
|
inlineoverridevirtual |
Renders the widget into target using colors/fonts/tokens from its own theme (see theme()/setTheme()).
Implements Widget< RGB_T >.
|
inlineoverridevirtual |
True if there's an action at (x, y) that's draggable, recursing into it if it's itself a composite - see Widget::isDraggableAt().
Reimplemented from Widget< RGB_T >.
|
inlineoverridevirtual |
Handles one gesture event. Returns true if this widget consumed it.
Reimplemented from Widget< RGB_T >.
|
inline |
Switches to callback-driven actions - see the class comment.
|
inline |
|
inlineoverridevirtual |
Sets the theme this widget draws itself with - see theme(). Screen pushes its own theme into a widget at registration time (addWidget()/addFixedWidget()/presentDialog()) and again whenever Screen::setTheme() is called; container widgets (Dialog, Drawer) cascade this down to whatever children they already hold.
Reimplemented from Widget< RGB_T >.
|
inlineoverridevirtual |
Called once per frame, before draw(), to advance any time-based animation (ripple fade, indeterminate progress sweep, ...). Returns true if that advance changed anything this widget will draw differently, so Screen can decide whether a redraw is actually needed - see Screen::isDirty(). Default: no-op, not dirty, so widgets that don't animate cost nothing extra.
Reimplemented from Widget< RGB_T >.