X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ed7919869508ccd5c868683c28706f82e82a1b9b..0ddf7c0cad6ab8c394d5e1002660a3dc983735a7:/src/msw/timer.cpp?ds=sidebyside diff --git a/src/msw/timer.cpp b/src/msw/timer.cpp index 7d994c9938..b339a8f040 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,6 +53,11 @@ UINT WINAPI _EXPORT wxTimerProc(HWND hwnd, WORD, int idTimer, DWORD); #define _EXPORT _export #endif +// should probably be in wx/msw/private.h +#ifdef __WXMICROWIN__ + #define MakeProcInstance(proc, hinst) proc +#endif + IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject) // ============================================================================ @@ -77,25 +84,25 @@ bool wxTimer::Start(int milliseconds, bool oneShot) { (void)wxTimerBase::Start(milliseconds, oneShot); - wxCHECK_MSG( m_milli > 0, FALSE, wxT("invalid value for timer timeour") ); + 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); - return TRUE; + return true; } else { wxLogSysError(_("Couldn't create a timer")); - return FALSE; + return false; } } @@ -103,7 +110,8 @@ void wxTimer::Stop() { if ( m_id ) { - KillTimer(NULL, (UINT)m_id); + ::KillTimer(NULL, (UINT)m_id); + wxTimerList.DeleteObject(this); } @@ -132,7 +140,9 @@ UINT WINAPI _EXPORT wxTimerProc(HWND WXUNUSED(hwnd), WORD, int idTimer, DWORD) wxCHECK_MSG( node, 0, wxT("bogus timer id in wxTimerProc") ); - wxProcessTimer(*(wxTimer *)node->Data()); + wxProcessTimer(*(wxTimer *)node->GetData()); return 0; } + +#endif // wxUSE_TIMER