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