跳轉到主要內容

TimerWidgets

touchgfx/Application.hpp

A class to handle and manage timer widgets.

Public Functions

voidadd(Drawable * w)
Adds timer widget.
voidclear()
Clears all timer widgets.
voidcompact()
Compacts the timer widgets.
uint16_tgetCounter(const Drawable * w) const
Gets a counter for a given timer widget.
uint16_tgetNumberOfActiveTimerWidgets() const
Gets number of active timer widgets.
voidremove(const Drawable * w)
Removes the given timer widget.
voidtickActive()
Tick all active timer widgets.

Public Functions Documentation

add

void add(Drawable *w)

Adds timer widget.

If a timer widget is added from a handleTickEvent(), the timer will not be ticket until the next tick (unless that same widget is already registered, and has not yet been ticked in this tick).

Parameters:
wThe timer widget to add.

clear

void clear()

Clears all timer widgets.

compact

void compact()

Compacts the timer widgets.

All widgets with a counter of 0 will be removed from the list, and the list will be compacted. Compacting the timer widgets during traversal (in tickActive()) is handled properly.

getCounter

uint16_t getCounter(const Drawable *w)

Gets a counter for a given timer widget.

Normally the counter is 1 unless a timer widget has been registered several times.

Parameters:
wThe timer widget to get the counter for.
Returns:

The counter.

getNumberOfActiveTimerWidgets

Gets number of active timer widgets.

Returns:

The number of active timer widgets.

remove

void remove(const Drawable *w)

Removes the given timer widget.

Parameters:
wThe timer widget to remove.

tickActive

void tickActive()

Tick all active timer widgets.

Adding and removing timer widgets during ticks is supported.