]>
git.saurik.com Git - wxWidgets.git/blob - src/motif/timer.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxTimer implementation
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
17 #include "wx/hashmap.h"
20 #pragma message disable nosimpint
24 #pragma message enable nosimpint
27 #include "wx/motif/private.h"
29 IMPLEMENT_ABSTRACT_CLASS(wxTimer
, wxEvtHandler
);
31 WX_DECLARE_VOIDPTR_HASH_MAP(wxTimer
*, wxTimerHashMap
);
33 static wxTimerHashMap s_timers
;
35 void wxTimerCallback (wxTimer
* timer
)
37 // Check to see if it's still on
38 if (s_timers
.find(timer
) == s_timers
.end())
42 return; // Avoid to process spurious timer events
44 if (!timer
->m_oneShot
)
45 timer
->m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
47 (XtTimerCallbackProc
) wxTimerCallback
,
67 bool wxTimer::Start(int milliseconds
, bool mode
)
71 (void)wxTimerBase::Start(milliseconds
, mode
);
73 if (s_timers
.find(this) == s_timers
.end())
74 s_timers
[this] = this;
76 m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
78 (XtTimerCallbackProc
) wxTimerCallback
,
87 XtRemoveTimeOut (m_id
);