]>
git.saurik.com Git - wxWidgets.git/blob - src/motif/timer.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/motif/timer.cpp
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"
19 #include "wx/hashmap.h"
23 #pragma message disable nosimpint
27 #pragma message enable nosimpint
30 #include "wx/motif/private.h"
32 IMPLEMENT_ABSTRACT_CLASS(wxTimer
, wxEvtHandler
)
34 WX_DECLARE_VOIDPTR_HASH_MAP(wxTimer
*, wxTimerHashMap
);
36 static wxTimerHashMap s_timers
;
38 void wxTimerCallback (wxTimer
* timer
)
40 // Check to see if it's still on
41 if (s_timers
.find(timer
) == s_timers
.end())
45 return; // Avoid to process spurious timer events
47 if (!timer
->m_oneShot
)
48 timer
->m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
50 (XtTimerCallbackProc
) wxTimerCallback
,
70 bool wxTimer::Start(int milliseconds
, bool mode
)
74 (void)wxTimerBase::Start(milliseconds
, mode
);
76 if (s_timers
.find(this) == s_timers
.end())
77 s_timers
[this] = this;
79 m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
81 (XtTimerCallbackProc
) wxTimerCallback
,
90 XtRemoveTimeOut (m_id
);