]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/timer.cpp
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
)
31 static gint
timeout_callback( gpointer data
)
33 wxTimer
*timer
= (wxTimer
*)data
;
35 // Don't change the order of anything in this callback!
37 if (timer
->IsOneShot())
39 // This sets m_tag to -1
43 // When getting called from GDK's timer handler we
44 // are no longer within GDK's grab on the GUI
45 // thread so we must lock it here ourselves.
50 // Release lock again.
53 if (timer
->IsOneShot())
71 bool wxTimer::Start( int millisecs
, bool oneShot
)
73 (void)wxTimerBase::Start(millisecs
, oneShot
);
76 gtk_timeout_remove( m_tag
);
78 m_tag
= gtk_timeout_add( m_milli
, timeout_callback
, this );
87 gtk_timeout_remove( m_tag
);