]>
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>
35 // ----------------------------------------------------------------------------
37 // ----------------------------------------------------------------------------
39 wxList
wxTimerList(wxKEY_INTEGER
);
40 ULONG
wxTimerProc(HWND hwnd
, ULONG
, int nIdTimer
, ULONG
);
42 // ----------------------------------------------------------------------------
44 // ----------------------------------------------------------------------------
46 #if !USE_SHARED_LIBRARY
47 IMPLEMENT_ABSTRACT_CLASS(wxTimer
, wxObject
)
59 wxTimerList
.DeleteObject(this);
67 (void)wxTimerBase::Start( nMilliseconds
71 wxCHECK_MSG( m_milli
> 0L, FALSE
, wxT("invalid value for timer") );
73 wxTimerList
.DeleteObject(this);
76 // Create a windowless timer
78 m_ulId
= ::WinStartTimer( m_Hab
80 ,(m_ulId
? m_ulId
: 1L)
85 wxTimerList
.Append( m_ulId
92 wxLogSysError(_("Couldn't create a timer"));
102 ::WinStopTimer(m_Hab
, NULL
, m_ulId
);
103 wxTimerList
.DeleteObject(this);
108 // ----------------------------------------------------------------------------
110 // ----------------------------------------------------------------------------
117 // Avoid to process spurious timer events
119 if (rTimer
.m_ulId
== 0L)
122 if (rTimer
.IsOneShot())
135 wxNode
* pNode
= wxTimerList
.Find((ULONG
)nIdTimer
);
137 wxCHECK_MSG(pNode
, 0, wxT("bogus timer id in wxTimerProc") );
139 wxProcessTimer(*(wxTimer
*)pNode
->Data());