]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: timer.h | |
3 | // Purpose: wxTimer class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc JS |
8 | // Copyright: (c) Julian Smart |
9 | // Licence: wxWindows licence | |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_TIMER_H_ |
13 | #define _WX_TIMER_H_ | |
2bda0e17 KB |
14 | |
15 | #ifdef __GNUG__ | |
16 | #pragma interface "timer.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/object.h" | |
20 | ||
03f38c58 | 21 | class WXDLLEXPORT wxTimer : public wxObject |
2bda0e17 | 22 | { |
c085e333 VZ |
23 | friend void wxProcessTimer(wxTimer& timer); |
24 | ||
03f38c58 VZ |
25 | public: |
26 | wxTimer(); | |
27 | ~wxTimer(); | |
28 | ||
29 | virtual bool Start(int milliseconds = -1, | |
30 | bool one_shot = FALSE); // Start timer | |
31 | virtual void Stop(); // Stop timer | |
32 | ||
33 | virtual void Notify() = 0; // Override this member | |
34 | ||
35 | // Returns the current interval time (0 if stop) | |
36 | int Interval() const { return milli; }; | |
37 | bool OneShot() const { return oneShot; } | |
38 | ||
c085e333 | 39 | protected: |
03f38c58 VZ |
40 | bool oneShot ; |
41 | int milli ; | |
42 | int lastMilli ; | |
43 | ||
44 | long id; | |
45 | ||
46 | private: | |
47 | DECLARE_ABSTRACT_CLASS(wxTimer) | |
2bda0e17 KB |
48 | }; |
49 | ||
50 | // Timer functions (milliseconds) | |
03f38c58 | 51 | void WXDLLEXPORT wxStartTimer(); |
2bda0e17 KB |
52 | // Gets time since last wxStartTimer or wxGetElapsedTime |
53 | long WXDLLEXPORT wxGetElapsedTime(bool resetTimer = TRUE); | |
54 | ||
55 | // EXPERIMENTAL: comment this out if it doesn't compile. | |
56 | bool WXDLLEXPORT wxGetLocalTime(long *timeZone, int *dstObserved); | |
57 | ||
58 | // Get number of seconds since 00:00:00 GMT, Jan 1st 1970. | |
03f38c58 | 59 | long WXDLLEXPORT wxGetCurrentTime(); |
2bda0e17 KB |
60 | |
61 | #endif | |
bbcdf8bc | 62 | // _WX_TIMERH_ |