Tappable card with a thumbnail image and a caption - e.g. one tile in a grid of stations/genres/countries. Pair with GridLayout (Core/GridLayout.h) to lay out several of these.
More...
|
| | MediaCard ()=default |
| |
| | MediaCard (Bounds bounds, const char *caption=nullptr) |
| |
| void | setImage (const tinygpu::ISurface< RGB_T > *image) |
| |
| void | setCaption (const char *caption) |
| |
| bool | selected () const |
| | "Now playing"/highlighted state: filled tint + primary-colored outline.
|
| |
| void | setSelected (bool selected) |
| |
| 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.
|
| |
| 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.
|
| |
template<typename RGB_T = TINYMD_DEFAULT_RGB_T>
class tinymd::MediaCard< RGB_T >
Tappable card with a thumbnail image and a caption - e.g. one tile in a grid of stations/genres/countries. Pair with GridLayout (Core/GridLayout.h) to lay out several of these.
The image is any TinyGPU ISurface<RGB_T> (a Sprite, a decoded BMP, ...) you already have - this widget only blits it via ISurface::drawSprite(), it doesn't fetch or decode anything itself (TinyGPU has no HTTP/network layer). Not owned: pass a pointer that outlives the card, or nullptr for a placeholder fill. There's no scaling either - drawSprite() blits 1:1, so pre-size the image to fit the card's image area (bounds minus the caption strip and padding) before handing it over.