Photon microGUI widgets library 0.6.0
Timer.h
1#ifndef PHWIDGETS_TIMER_H
2#define PHWIDGETS_TIMER_H
3
4
5#include <photon/PtTimer.h>
6
7#include "./Widget.h"
8
9
10namespace PhWidgets
11{
18
23 class Timer:
24 protected Widget
25 {
26 public:
27 using Widget::IPhWidgetsProperty;
28
30 struct ThisArgs
31 {
34 {
36
46 {
47 timer_initial = Pt_ARG_TIMER_INITIAL,
48 timer_repeat = Pt_ARG_TIMER_REPEAT
49 };
50 };
51
52 };
53
56 {
58 struct Callback
59 {
61
70 {
71 timer_activate = Pt_CB_TIMER_ACTIVATE
72 };
73 };
74 };
75
79 { };
80
82 struct ArgPVoid
83 {
84 static const Widget::ArgPVoid::eArgPVoid pointer;
85 static const Widget::ArgPVoid::eArgPVoidData data;
86 static const Widget::ArgPVoid::eArgPVoidData user_data;
87 };
88
90 Widget::ArgLong;//Pt_ARG_FLAGS
91
93 struct Callback:
94 public ArgumentsEx<ThisCallbacks::Callback>,
95 public Widget::Callback
96 {
98 };
99
101 struct Arguments:
102 public ArgUnsignedLong,
103 public Widget::ArgLong,
104 public ArgPVoid
105 { };
106
108 struct Callbacks:
109 public Callback,
110 public Widget::Callbacks
111 { };
112
113 private:
114
115 protected:
116 typedef ResourceFrom<Widget::WidgetResourcesSingleton>::
117 Define::Scalar<ThisArgs::ArgUnsignedLong::eArgUnsignedLong, unsigned long>::
118
119 Define::Link<ThisCallbacks::Callback::eCallback, PtCallback_t*>::
120
121 resource_type WidgetResourcesSingleton;
122
123 virtual void check();
124
125 public:
126
128
132 explicit Timer(int abn);
133
135
139 explicit Timer(PtWidget_t *wdg);
140
142
146 Timer(const Timer &other);
147
149
153 Timer &operator=(const Timer &other);
154
156
160 WidgetResourcesSingleton resource;
161
162 using Widget::operator=;
163 using Widget::operator==;
164 using Widget::operator<;
165
166 using Widget::operator PtWidget_t*;
167 using Widget::operator const PtWidget_t*;
168
175
177
181
183
186 void OnActivate(PtCallbackInfo_t *info);
187
189 };
190} // namespace PhWidgets
191
192#endif // PHWIDGETS_TIMER_H
A widget that invokes a callback after a given length of time.
Definition: Timer.h:25
Timer(PtWidget_t *wdg)
(constructor)
phproperty< unsigned long >::bind< Timer, ArgUnsignedLong::eArgUnsignedLong, Arguments::timer_initial > Initial
The time, in milliseconds, before the first timer callback is activated.
Definition: Timer.h:172
Timer & operator=(const Timer &other)
Assigns value in Timer widget.
Timer(const Timer &other)
(copy constructor)
phproperty< unsigned long >::bind< Timer, ArgUnsignedLong::eArgUnsignedLong, Arguments::timer_repeat > Interval
The time, in milliseconds, for the repeat rate of the timer once the initial time period has expired.
Definition: Timer.h:173
WidgetResourcesSingleton resource
Resources of the Timer.
Definition: Timer.h:160
Timer(int abn)
(constructor)
An event, which raise a notification to registered subscribers (event handlers) that something of int...
Definition: Widget.h:132
Superclass for all widgets.
Definition: Widget.h:110
property< bool >::bind< Widget, &Widget::getEnabled, &Widget::setEnabled > Enabled
Gets or sets a value indicating whether the widget can respond to user interaction.
Definition: Widget.h:1689
The main namespace for all widgets.
Definition: Basic.h:11
Contains resource IDs for arguments of type void*.
Definition: Timer.h:83
Contains resource IDs for arguments of type unsigned long.
Definition: Timer.h:79
Contains resource IDs for all Timer arguments.
Definition: Timer.h:105
Contains resource IDs for callbacks of type PtCallback_t.
Definition: Timer.h:96
Contains resource IDs for all Timer callbacks.
Definition: Timer.h:111
Contains resource IDs for Timer arguments of type unsigned long.
Definition: Timer.h:34
eArgUnsignedLong
Resource IDs for Timer arguments of type unsigned long.
Definition: Timer.h:46
@ timer_initial
The time, in milliseconds, before the first timer callback is activated.
Definition: Timer.h:47
@ timer_repeat
The time, in milliseconds, for the repeat rate of the timer once the initial time period has expired.
Definition: Timer.h:48
Contains resource IDs for Timer arguments.
Definition: Timer.h:31
Contains resource IDs for Timer callbacks of type PtCallback_t.
Definition: Timer.h:59
eCallback
Resource IDs for Timer arguments of type PtCallback_t.
Definition: Timer.h:70
@ timer_activate
A list of PtCallback_t structures that define the callbacks that the widget invokes when the timer ha...
Definition: Timer.h:71
Contains resource IDs for Timer callbacks.
Definition: Timer.h:56
Contains resource IDs for Widget callbacks.
Definition: Widget.h:561