]>
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(), timer
->m_milli
,
41 (XtTimerCallbackProc
) wxTimerCallback
, (XtPointer
) timer
);
58 wxTimerList
.DeleteObject(this);
61 bool wxTimer::Start(int milliseconds
, bool mode
)
67 milliseconds
= m_lastMilli
;
69 if (milliseconds
<= 0)
72 m_lastMilli
= m_milli
= milliseconds
;
74 if (!wxTimerList
.Find((long)this))
75 wxTimerList
.Append((long)this, this);
77 m_id
= XtAppAddTimeOut ((XtAppContext
) wxTheApp
->GetAppContext(), milliseconds
,
78 (XtTimerCallbackProc
) wxTimerCallback
, (XtPointer
) this);
86 XtRemoveTimeOut (m_id
);