]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk1/timer.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/gtk1/timer.cpp
3 // Purpose: wxTimer implementation
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
13 #include "wx/gtk1/private/timer.h"
17 // ----------------------------------------------------------------------------
19 // ----------------------------------------------------------------------------
22 static gint
timeout_callback(void *data
)
24 wxTimerImpl
* const timer
= (wxTimerImpl
*)data
;
26 const bool keepGoing
= !timer
->IsOneShot();
30 // When getting called from GDK's timer handler we
31 // are no longer within GDK's grab on the GUI
32 // thread so we must lock it here ourselves.
37 // Release lock again.
44 bool wxGTKTimerImpl::Start(int millisecs
, bool oneShot
)
46 if ( !wxTimerImpl::Start(millisecs
, oneShot
) )
49 wxASSERT_MSG( m_tag
== -1, wxT("shouldn't be still running") );
51 m_tag
= gtk_timeout_add( m_milli
, timeout_callback
, this );
56 void wxGTKTimerImpl::Stop()
58 wxASSERT_MSG( m_tag
!= -1, wxT("should be running") );
60 gtk_timeout_remove( m_tag
);