]>
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 // For compilers that support precompilation, includes "wx.h". 
  11 #include "wx/wxprec.h" 
  19 // ---------------------------------------------------------------------------- 
  21 // ---------------------------------------------------------------------------- 
  23 IMPLEMENT_ABSTRACT_CLASS(wxTimer
, wxEvtHandler
) 
  26 static gint 
timeout_callback( gpointer data 
) 
  28     wxTimer 
*timer 
= (wxTimer
*)data
; 
  30     // Don't change the order of anything in this callback! 
  32     if (timer
->IsOneShot()) 
  34         // This sets m_tag to -1 
  38     // When getting called from GDK's timer handler we 
  39     // are no longer within GDK's grab on the GUI 
  40     // thread so we must lock it here ourselves. 
  45     // Release lock again. 
  48     if (timer
->IsOneShot()) 
  66 bool wxTimer::Start( int millisecs
, bool oneShot 
) 
  68     (void)wxTimerBase::Start(millisecs
, oneShot
); 
  71         gtk_timeout_remove( m_tag 
); 
  73     m_tag 
= gtk_timeout_add( m_milli
, timeout_callback
, this ); 
  82         gtk_timeout_remove( m_tag 
);