]>
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "timer.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
21 #include "wx/hashmap.h"
24 #pragma message disable nosimpint
28 #pragma message enable nosimpint
31 #include "wx/motif/private.h"
33 IMPLEMENT_ABSTRACT_CLASS(wxTimer
, wxEvtHandler
);
35 WX_DECLARE_VOIDPTR_HASH_MAP(wxTimer
*, wxTimerHashMap
);
37 static wxTimerHashMap s_timers
;
39 void wxTimerCallback (wxTimer
* timer
)
41 // Check to see if it's still on
42 if (s_timers
.find(timer
) == s_timers
.end())
46 return; // Avoid to process spurious timer events
48 if (!timer
->m_oneShot
)
49 timer
->m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
51 (XtTimerCallbackProc
) wxTimerCallback
,
71 bool wxTimer::Start(int milliseconds
, bool mode
)
75 (void)wxTimerBase::Start(milliseconds
, mode
);
77 if (s_timers
.find(this) == s_timers
.end())
78 s_timers
[this] = this;
80 m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
82 (XtTimerCallbackProc
) wxTimerCallback
,
91 XtRemoveTimeOut (m_id
);