]>
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 /////////////////////////////////////////////////////////////////////////////
10 #include "wx/wxprec.h"
14 #include "wx/gtk1/private/timer.h"
18 // ----------------------------------------------------------------------------
20 // ----------------------------------------------------------------------------
23 static gint
timeout_callback(void *data
)
25 wxTimerImpl
* const timer
= (wxTimerImpl
*)data
;
27 const bool keepGoing
= !timer
->IsOneShot();
31 // When getting called from GDK's timer handler we
32 // are no longer within GDK's grab on the GUI
33 // thread so we must lock it here ourselves.
38 // Release lock again.
45 bool wxGTKTimerImpl::Start(int millisecs
, bool oneShot
)
47 if ( !wxTimerImpl::Start(millisecs
, oneShot
) )
50 wxASSERT_MSG( m_tag
== -1, _T("shouldn't be still running") );
52 m_tag
= gtk_timeout_add( m_milli
, timeout_callback
, this );
57 void wxGTKTimerImpl::Stop()
59 wxASSERT_MSG( m_tag
!= -1, _T("should be running") );
61 gtk_timeout_remove( m_tag
);