]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/timer.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxTimer implementation
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
15 #include "wx/window.h"
16 #include "wx/os2/private.h"
31 #include <sys/types.h>
33 #include <sys/timeb.h>
34 // ----------------------------------------------------------------------------
36 // ----------------------------------------------------------------------------
38 wxList
wxTimerList(wxKEY_INTEGER
);
39 ULONG
wxTimerProc(HWND hwnd
, ULONG
, int nIdTimer
, ULONG
);
41 // ----------------------------------------------------------------------------
43 // ----------------------------------------------------------------------------
45 #if !USE_SHARED_LIBRARY
46 IMPLEMENT_ABSTRACT_CLASS(wxTimer
, wxObject
)
58 wxTimerList
.DeleteObject(this);
66 (void)wxTimerBase::Start( nMilliseconds
70 wxCHECK_MSG( m_milli
> 0L, FALSE
, wxT("invalid value for timer") );
72 wxTimerList
.DeleteObject(this);
75 // Create a windowless timer
77 m_ulId
= ::WinStartTimer( m_Hab
79 ,(m_ulId
? m_ulId
: 1L)
84 wxTimerList
.Append( m_ulId
91 wxLogSysError(_("Couldn't create a timer"));
101 ::WinStopTimer(m_Hab
, NULL
, m_ulId
);
102 wxTimerList
.DeleteObject(this);
107 // ----------------------------------------------------------------------------
109 // ----------------------------------------------------------------------------
116 // Avoid to process spurious timer events
118 if (rTimer
.m_ulId
== 0L)
121 if (rTimer
.IsOneShot())
134 wxNode
* pNode
= wxTimerList
.Find((ULONG
)nIdTimer
);
136 wxCHECK_MSG(pNode
, 0, wxT("bogus timer id in wxTimerProc") );
138 wxProcessTimer(*(wxTimer
*)pNode
->Data());