1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxTimer implementation
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
12 #pragma implementation "timer.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
24 // ----------------------------------------------------------------------------
26 // ----------------------------------------------------------------------------
28 IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
30 extern "C" gint timeout_callback( gpointer data )
32 wxTimer *timer = (wxTimer*)data;
34 // Don't change the order of anything in this callback!
36 if (timer->IsOneShot())
38 // This sets m_tag to -1
42 // When getting called from GDK's timer handler we
43 // are no longer within GDK's grab on the GUI
44 // thread so we must lock it here ourselves.
49 // Release lock again.
52 if (timer->IsOneShot())
69 bool wxTimer::Start( int millisecs, bool oneShot )
71 (void)wxTimerBase::Start(millisecs, oneShot);
74 gtk_timeout_remove( m_tag );
76 m_tag = gtk_timeout_add( m_milli, timeout_callback, this );
85 gtk_timeout_remove( m_tag );