]>
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"
22 #include "wx/motif/private.h"
24 #if !USE_SHARED_LIBRARY
25 IMPLEMENT_ABSTRACT_CLASS(wxTimer
, wxObject
)
28 static wxList
wxTimerList(wxKEY_INTEGER
);
30 void wxTimerCallback (wxTimer
* timer
)
32 // Check to see if it's still on
33 if (!wxTimerList
.Find((long)timer
))
37 return; // Avoid to process spurious timer events
39 if (!timer
->m_oneShot
)
40 timer
->m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
42 (XtTimerCallbackProc
) wxTimerCallback
,
58 wxTimerList
.DeleteObject(this);
61 bool wxTimer::Start(int milliseconds
, bool mode
)
65 (void)wxTimerBase::Start(milliseconds
, mode
);
67 if (!wxTimerList
.Find((long)this))
68 wxTimerList
.Append((long)this, this);
70 m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
72 (XtTimerCallbackProc
) wxTimerCallback
,
81 XtRemoveTimeOut (m_id
);