]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: timer.h | |
3 | // Purpose: wxTimer class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_TIMER_H_ | |
13 | #define _WX_TIMER_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "timer.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/object.h" | |
20 | ||
21 | class WXDLLEXPORT wxTimer: public wxObject | |
22 | { | |
23 | DECLARE_DYNAMIC_CLASS(wxTimer) | |
24 | ||
25 | friend void wxTimerCallback (wxTimer * timer); | |
26 | ||
27 | public: | |
28 | wxTimer(); | |
29 | ~wxTimer(); | |
30 | virtual bool Start(int milliseconds = -1,bool one_shot = FALSE); // Start timer | |
31 | virtual void Stop(); // Stop timer | |
32 | virtual void Notify() = 0; // Override this member | |
33 | inline int Interval() { return m_milli ; }; // Returns the current interval time (0 if stop) | |
34 | ||
35 | protected: | |
36 | bool m_oneShot ; | |
37 | int m_milli ; | |
38 | int m_lastMilli ; | |
39 | long m_id; | |
40 | ||
41 | }; | |
42 | ||
43 | /* Note: these are implemented in common/timercmn.cpp, so need to implement them separately. | |
44 | * But you may need to modify timercmn.cpp. | |
45 | */ | |
46 | ||
47 | // Timer functions (milliseconds) | |
48 | void WXDLLEXPORT wxStartTimer(); | |
49 | // Gets time since last wxStartTimer or wxGetElapsedTime | |
50 | long WXDLLEXPORT wxGetElapsedTime(bool resetTimer = TRUE); | |
51 | ||
52 | // EXPERIMENTAL: comment this out if it doesn't compile. | |
53 | bool WXDLLEXPORT wxGetLocalTime(long *timeZone, int *dstObserved); | |
54 | ||
55 | // Get number of seconds since 00:00:00 GMT, Jan 1st 1970. | |
56 | long WXDLLEXPORT wxGetCurrentTime(); | |
57 | ||
58 | #endif | |
59 | // _WX_TIMER_H_ |