X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/04ef50df3a0fa3c343800c554e609f98fc7575cc..55826fcf4fd863d48ac28789d99bbb5c8a8d4c7e:/src/msw/timer.cpp diff --git a/src/msw/timer.cpp b/src/msw/timer.cpp index 17f1c17552..0fe07b64a3 100644 --- a/src/msw/timer.cpp +++ b/src/msw/timer.cpp @@ -5,8 +5,8 @@ // Modified by: // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -53,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) // ============================================================================ @@ -79,32 +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") ); - - wxTimerList.DeleteObject(this); + wxCHECK_MSG( m_milli > 0, false, wxT("invalid value for timer timeour") ); -#ifdef __WXMICROWIN__ - m_id = SetTimer(NULL, (UINT)(m_id ? m_id : 1), - (UINT)milliseconds, (TIMERPROC) wxTimerProc); -#else TIMERPROC wxTimerProcInst = (TIMERPROC) MakeProcInstance((FARPROC)wxTimerProc, wxGetInstance()); - m_id = SetTimer(NULL, (UINT)(m_id ? m_id : 1), - (UINT)milliseconds, wxTimerProcInst); -#endif + 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; } } @@ -112,7 +110,8 @@ void wxTimer::Stop() { if ( m_id ) { - KillTimer(NULL, (UINT)m_id); + ::KillTimer(NULL, (UINT)m_id); + wxTimerList.DeleteObject(this); } @@ -141,7 +140,7 @@ 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; }