X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0470b1e6fe7a49bb87756006ef9fc232e3dbaaf8..3317223b08943c74ee4c7956b6aa9a3e72f87d77:/src/msw/timer.cpp diff --git a/src/msw/timer.cpp b/src/msw/timer.cpp index 682f66980c..57dfbbb53d 100644 --- a/src/msw/timer.cpp +++ b/src/msw/timer.cpp @@ -20,6 +20,8 @@ #pragma hdrstop #endif +#if wxUSE_TIMER + #ifndef WX_PRECOMP #include "wx/setup.h" #include "wx/window.h" @@ -51,10 +53,13 @@ UINT WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD); #define _EXPORT _export #endif -#if !USE_SHARED_LIBRARY - IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject) +// should probably be in wx/msw/private.h +#ifdef __WXMICROWIN__ + #define MakeProcInstance(proc, hinst) proc #endif +IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject) + // ============================================================================ // implementation // ============================================================================ @@ -63,7 +68,7 @@ UINT WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD); // wxTimer class // ---------------------------------------------------------------------------- -wxTimer::wxTimer() +void wxTimer::Init() { m_id = 0; } @@ -81,12 +86,12 @@ bool wxTimer::Start(int milliseconds, bool oneShot) wxCHECK_MSG( m_milli > 0, FALSE, wxT("invalid value for timer timeour") ); - wxTimerList.DeleteObject(this); TIMERPROC wxTimerProcInst = (TIMERPROC) MakeProcInstance((FARPROC)wxTimerProc, wxGetInstance()); - m_id = SetTimer(NULL, (UINT)(m_id ? m_id : 1), - (UINT)milliseconds, wxTimerProcInst); + m_id = ::SetTimer(NULL, (UINT)(m_id ? m_id : 1), + (UINT)m_milli, wxTimerProcInst); + if ( m_id > 0 ) { wxTimerList.Append(m_id, this); @@ -105,7 +110,8 @@ void wxTimer::Stop() { if ( m_id ) { - KillTimer(NULL, (UINT)m_id); + ::KillTimer(NULL, (UINT)m_id); + wxTimerList.DeleteObject(this); } @@ -138,3 +144,5 @@ UINT WINAPI _EXPORT wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD) return 0; } + +#endif // wxUSE_TIMER