]>
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"
18 #include "wx/hashmap.h"
21 #pragma message disable nosimpint
25 #pragma message enable nosimpint
28 #include "wx/motif/private.h"
30 IMPLEMENT_ABSTRACT_CLASS(wxTimer
, wxObject
);
32 WX_DECLARE_VOIDPTR_HASH_MAP(wxTimer
*, wxTimerHashMap
);
34 static wxTimerHashMap s_timers
;
36 void wxTimerCallback (wxTimer
* timer
)
38 // Check to see if it's still on
39 if (s_timers
.find(timer
) == s_timers
.end())
43 return; // Avoid to process spurious timer events
45 if (!timer
->m_oneShot
)
46 timer
->m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
48 (XtTimerCallbackProc
) wxTimerCallback
,
68 bool wxTimer::Start(int milliseconds
, bool mode
)
72 (void)wxTimerBase::Start(milliseconds
, mode
);
74 if (s_timers
.find(this) == s_timers
.end())
75 s_timers
[this] = this;
77 m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
79 (XtTimerCallbackProc
) wxTimerCallback
,
88 XtRemoveTimeOut (m_id
);