]>
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 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "timer.h"
21 #pragma message disable nosimpint
25 #pragma message enable nosimpint
28 #include "wx/motif/private.h"
30 IMPLEMENT_ABSTRACT_CLASS(wxTimer
, wxObject
)
32 static wxList
wxTimerList(wxKEY_INTEGER
);
34 void wxTimerCallback (wxTimer
* timer
)
36 // Check to see if it's still on
37 if (!wxTimerList
.Find((long)timer
))
41 return; // Avoid to process spurious timer events
43 if (!timer
->m_oneShot
)
44 timer
->m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
46 (XtTimerCallbackProc
) wxTimerCallback
,
63 wxTimerList
.DeleteObject(this);
66 bool wxTimer::Start(int milliseconds
, bool mode
)
70 (void)wxTimerBase::Start(milliseconds
, mode
);
72 if (!wxTimerList
.Find((long)this))
73 wxTimerList
.Append((long)this, this);
75 m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
77 (XtTimerCallbackProc
) wxTimerCallback
,
86 XtRemoveTimeOut (m_id
);