]>
git.saurik.com Git - wxWidgets.git/blob - src/x11/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/x11/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
45 if (!timer
->m_oneShot
)
46 timer
->m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
48 (XtTimerCallbackProc
) wxTimerCallback
,
66 wxTimerList
.DeleteObject(this);
69 bool wxTimer::Start(int milliseconds
, bool mode
)
73 (void)wxTimerBase::Start(milliseconds
, mode
);
75 if (!wxTimerList
.Find((long)this))
76 wxTimerList
.Append((long)this, this);
79 m_id
= XtAppAddTimeOut((XtAppContext
) wxTheApp
->GetAppContext(),
81 (XtTimerCallbackProc
) wxTimerCallback
,
93 XtRemoveTimeOut (m_id
);