#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_ |
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.
00014 : WText(parent), 00015 done_(this), 00016 start_(start), 00017 stop_(stop) 00018 { 00019 stop_ = std::min(start_ - 1, stop_); // stop must be smaller than start 00020 current_ = start_; 00021 00022 timer_ = new WTimer(this); 00023 timer_->setInterval(msec); 00024 timer_->timeout().connect(SLOT(this, CountDownWidget::timerTick)); 00025 timer_->start(); 00026 00027 setText(boost::lexical_cast<std::string>(current_)); 00028 }
| Wt::Signal<void>& CountDownWidget::done | ( | ) | [inline] |
Signal emitted when the countdown reached stop.
Definition at line 38 of file CountDownWidget.h.
00038 { return done_; }
| void CountDownWidget::cancel | ( | ) |
| void CountDownWidget::timerTick | ( | ) | [private] |
Wt::Signal<void> CountDownWidget::done_ [private] |
Definition at line 45 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.
unsigned CountDownWidget::msec_ [private] |
Definition at line 48 of file CountDownWidget.h.
int CountDownWidget::current_ [private] |
Definition at line 50 of file CountDownWidget.h.
WTimer* CountDownWidget::timer_ [private] |
Definition at line 52 of file CountDownWidget.h.
1.5.6