1 // This may look like C code, but it's really -*- C++ -*-
2 /*
3  * Copyright (C) 2008 Emweb bv, Herent, Belgium.
4  *
5  * See the LICENSE file for terms of use.
6  */
7 #ifndef WTIMERWIDGET_
8 #define WTIMERWIDGET_
9 
10 #include <Wt/WInteractWidget.h>
11 
12 namespace Wt {
13 
14 class WTimer;
15 
16 /*
17  * Wt-private widget that is created in conjunction with
18  * WTimer widget. It's clicked signal serves as the event signal
19  * that will be activated when the event expires.
20  */
21 class WT_API WTimerWidget : public WInteractWidget
22 {
23 public:
24   WTimerWidget(WTimer *timer);
25   ~WTimerWidget();
26 
27   void timerStart(bool jsRepeat);
28   bool timerExpired();
29 
jsRepeat()30   bool jsRepeat() const { return jsRepeat_; }
31 
32 private:
33   WTimer *timer_;
34   bool timerStarted_;
35   bool jsRepeat_;
36 
37 protected:
38   virtual void updateDom(DomElement& element, bool all) override;
39   virtual DomElementType domElementType() const override;
40   virtual std::string renderRemoveJs(bool recursive) override;
41 
42   virtual void enableAjax() override;
43 
44   friend class WebSession;
45 };
46 
47 }
48 
49 #endif // WTIMERWIDGET_
50