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

Row of evenly-spaced exclusive-selection labels (primary tabs), with a sliding indicator under the selected one. Tabs are fixed text strings added via addTab() rather than separate child widgets, so the whole row is one hit-testable/drawable Widget. More...

#include <TabBar.h>

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

Public Member Functions

 TabBar ()=default
 
 TabBar (Bounds bounds)
 
void addTab (const char *label)
 
void clearTabs ()
 
int selectedIndex () const
 
void setSelectedIndex (int index)
 
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.
 
- 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.
 

Public Attributes

std::function< void(int)> onChange
 Fired with the new selected index whenever a different tab is tapped.
 
- Public Attributes inherited from Widget< RGB_T >
Bounds bounds
 
bool visible = true
 
bool enabled = true
 

Additional Inherited Members

- 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::TabBar< RGB_T >

Row of evenly-spaced exclusive-selection labels (primary tabs), with a sliding indicator under the selected one. Tabs are fixed text strings added via addTab() rather than separate child widgets, so the whole row is one hit-testable/drawable Widget.

Constructor & Destructor Documentation

◆ TabBar() [1/2]

TabBar ( )
default

◆ TabBar() [2/2]

TabBar ( Bounds  bounds)
inlineexplicit

Member Function Documentation

◆ addTab()

void addTab ( const char *  label)
inline

◆ clearTabs()

void clearTabs ( )
inline

◆ 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 >.

◆ onGesture()

bool onGesture ( const tinygpu::GestureEvent &  event)
inlineoverridevirtual

Handles one gesture event. Returns true if this widget consumed it.

Reimplemented from Widget< RGB_T >.

◆ selectedIndex()

int selectedIndex ( ) const
inline

◆ setSelectedIndex()

void setSelectedIndex ( int  index)
inline

Member Data Documentation

◆ onChange

std::function<void(int)> onChange

Fired with the new selected index whenever a different tab is tapped.


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