]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/timer.cpp
292dfbb1f9f22a8fa7b8ce796af4ef9e848c5c47
   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); 
  59 void wxTimer::Notify() 
  62     // The base class version generates an event if it has owner - which it 
  63     // should because otherwise nobody can process timer events, but it does 
  64     // not use the OS's ID, which OS/2 must have to figure out which timer fired 
  66     wxCHECK_RET( m_owner
, _T("wxTimer::Notify() should be overridden.") ); 
  68     wxTimerEvent                    
vEvent( m_ulId
 
  72     (void)m_owner
->ProcessEvent(vEvent
); 
  73 } // end of wxTimer::Notify 
  80     (void)wxTimerBase::Start( nMilliseconds
 
  84     wxCHECK_MSG( m_milli 
> 0L, FALSE
, wxT("invalid value for timer") ); 
  86     wxTimerList
.DeleteObject(this); 
  89     // Create a windowless timer 
  91     m_ulId 
= ::WinStartTimer( m_Hab
 
  98         wxTimerList
.Append( m_ulId
 
 105         wxLogSysError(_("Couldn't create a timer")); 
 115         ::WinStopTimer(m_Hab
, NULL
, m_ulId
); 
 116         wxTimerList
.DeleteObject(this); 
 120 // ---------------------------------------------------------------------------- 
 122 // ---------------------------------------------------------------------------- 
 129     // Avoid to process spurious timer events 
 131     if (rTimer
.m_ulId 
== 0L) 
 134     if (rTimer
.IsOneShot()) 
 147     wxNode
*                         pNode 
= wxTimerList
.Find((ULONG
)nIdTimer
); 
 149     wxCHECK_MSG(pNode
, 0, wxT("bogus timer id in wxTimerProc") ); 
 151     wxProcessTimer(*(wxTimer 
*)pNode
->Data());