1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/private/timer.h
3 // Purpose: Base class for wxTimer implementations
4 // Author: Lukasz Michalski <lmichalski@sf.net>
6 // Copyright: (c) 2006-2007 wxWidgets dev team
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_TIMERIMPL_H_BASE_
11 #define _WX_TIMERIMPL_H_BASE_
17 // ----------------------------------------------------------------------------
18 // wxTimerImpl: abstract base class for wxTimer implementations
19 // ----------------------------------------------------------------------------
21 class WXDLLIMPEXP_BASE wxTimerImpl
24 // default ctor, SetOwner() must be called after it (wxTimer does it)
25 wxTimerImpl(wxTimer
*owner
);
27 // this must be called initially but may be also called later
28 void SetOwner(wxEvtHandler
*owner
, int timerid
);
30 // empty but virtual base class dtor, the caller is responsible for
31 // stopping the timer before it's destroyed (it can't be done from here as
33 virtual ~wxTimerImpl() { }
36 // start the timer. When overriding call base version first.
37 virtual bool Start(int milliseconds
= -1, bool oneShot
= false);
39 // stop the timer, only called if the timer is really running (unlike
41 virtual void Stop() = 0;
43 // return true if the timer is running
44 virtual bool IsRunning() const = 0;
46 // this should be called by the port-specific code when the timer expires
47 virtual void Notify() { m_timer
->Notify(); }
49 // the default implementation of wxTimer::Notify(): generate a wxEVT_TIMER
53 // accessors for wxTimer:
54 wxEvtHandler
*GetOwner() const { return m_owner
; }
55 int GetId() const { return m_idTimer
; }
56 int GetInterval() const { return m_milli
; }
57 bool IsOneShot() const { return m_oneShot
; }
62 wxEvtHandler
*m_owner
;
64 int m_idTimer
; // id passed to wxTimerEvent
65 int m_milli
; // the timer interval
66 bool m_oneShot
; // true if one shot
69 wxDECLARE_NO_COPY_CLASS(wxTimerImpl
);
72 #endif // _WX_TIMERIMPL_H_BASE_