]>
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 IMPLEMENT_ABSTRACT_CLASS(wxTimer
, wxObject
)
56 wxTimerList
.DeleteObject(this);
64 (void)wxTimerBase::Start( nMilliseconds
68 wxCHECK_MSG( m_milli
> 0L, FALSE
, wxT("invalid value for timer") );
70 wxTimerList
.DeleteObject(this);
73 // Create a windowless timer
75 m_ulId
= ::WinStartTimer( m_Hab
77 ,(m_ulId
? m_ulId
: 1L)
82 wxTimerList
.Append( m_ulId
89 wxLogSysError(_("Couldn't create a timer"));
99 ::WinStopTimer(m_Hab
, NULL
, m_ulId
);
100 wxTimerList
.DeleteObject(this);
105 // ----------------------------------------------------------------------------
107 // ----------------------------------------------------------------------------
114 // Avoid to process spurious timer events
116 if (rTimer
.m_ulId
== 0L)
119 if (rTimer
.IsOneShot())
132 wxNode
* pNode
= wxTimerList
.Find((ULONG
)nIdTimer
);
134 wxCHECK_MSG(pNode
, 0, wxT("bogus timer id in wxTimerProc") );
136 wxProcessTimer(*(wxTimer
*)pNode
->Data());