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

Small status marker, typically overlaid on an icon's corner. More...

#include <Badge.h>

Inheritance diagram for Badge< RGB_T >:
Inheritance graph
[legend]
Collaboration diagram for Badge< RGB_T >:
Collaboration graph
[legend]

Public Member Functions

 Badge ()=default
 
 Badge (Bounds bounds, const char *text=nullptr)
 
void setText (const char *text)
 
const std::string & text () const
 
void draw (tinygpu::ISurface< RGB_T > &target) 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
 

Detailed Description

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

Small status marker, typically overlaid on an icon's corner.

Non-interactive. Either a plain dot (no text set) or a small filled pill holding a short count/label (e.g. "3", "9+"). Position its own bounds over whatever it's badging - e.g. the top-right corner of an IconButton's bounds - the caller is responsible for that placement, same as any other widget.

Constructor & Destructor Documentation

◆ Badge() [1/2]

Badge ( )
default

◆ Badge() [2/2]

Badge ( Bounds  bounds,
const char *  text = nullptr 
)
inlineexplicit

Member Function Documentation

◆ draw()

void draw ( tinygpu::ISurface< RGB_T > &  target)
inlineoverridevirtual

Renders the widget into target using colors/fonts/tokens from its own theme (see theme()/setTheme()).

Implements Widget< RGB_T >.

◆ setText()

void setText ( const char *  text)
inline

◆ text()

const std::string & text ( ) const
inline

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