|
Wt examples
3.3.0
|
A widget which displays a decrementing number. More...
#include <CountDownWidget.h>

Public Member Functions | |
| CountDownWidget (int start, int stop, unsigned msec, WContainerWidget *parent=0) | |
| Create a new CountDownWidget. | |
| Wt::Signal< void > & | done () |
| Signal emitted when the countdown reached stop. | |
| void | cancel () |
| Cancel the count down. | |
Private Member Functions | |
| void | timerTick () |
| Process one timer tick. | |
Private Attributes | |
| Wt::Signal< void > | done_ |
| int | start_ |
| int | stop_ |
| unsigned | msec_ |
| int | current_ |
| WTimer * | timer_ |
A widget which displays a decrementing number.
Definition at line 25 of file CountDownWidget.h.
| CountDownWidget::CountDownWidget | ( | int | start, |
| int | stop, | ||
| unsigned | msec, | ||
| WContainerWidget * | parent = 0 |
||
| ) |
Create a new CountDownWidget.
The widget will count down from start to stop, decrementing the number every msec milliseconds.
Definition at line 12 of file CountDownWidget.C.
: WText(parent), done_(this), start_(start), stop_(stop) { stop_ = std::min(start_ - 1, stop_); // stop must be smaller than start current_ = start_; timer_ = new WTimer(this); timer_->setInterval(msec); timer_->timeout().connect(this, &CountDownWidget::timerTick); timer_->start(); setText(boost::lexical_cast<std::string>(current_)); }
| void CountDownWidget::cancel | ( | ) |
| Wt::Signal<void>& CountDownWidget::done | ( | ) | [inline] |
Signal emitted when the countdown reached stop.
Definition at line 38 of file CountDownWidget.h.
{ return done_; }
| void CountDownWidget::timerTick | ( | ) | [private] |
int CountDownWidget::current_ [private] |
Definition at line 50 of file CountDownWidget.h.
Wt::Signal<void> CountDownWidget::done_ [private] |
Definition at line 45 of file CountDownWidget.h.
unsigned CountDownWidget::msec_ [private] |
Definition at line 48 of file CountDownWidget.h.
int CountDownWidget::start_ [private] |
Definition at line 46 of file CountDownWidget.h.
int CountDownWidget::stop_ [private] |
Definition at line 47 of file CountDownWidget.h.
WTimer* CountDownWidget::timer_ [private] |
Definition at line 52 of file CountDownWidget.h.
1.7.5.1