]>
git.saurik.com Git - wxWidgets.git/blob - src/gtk/timer.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "timer.h"
22 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
27 static GTimer *g_timer = (GTimer*) NULL;
33 g_timer_rest( g_timer );
37 g_timer = g_timer_new();
38 g_timer_start( g_timer );
42 long wxGetElapsedTime( bool resetTimer )
47 g_timer_elapsed( g_timer, &res );
48 if (resetTimer) g_timer_reset( g_timer );
54 bool wxGetLocalTime( long *timeZone, int *dstObserved )
58 long wxGetCurrentTime()
64 //-----------------------------------------------------------------------------
66 //-----------------------------------------------------------------------------
68 IMPLEMENT_ABSTRACT_CLASS(wxTimer
,wxObject
)
70 static gint
timeout_callback( gpointer data
)
72 wxTimer
*timer
= (wxTimer
*)data
;
74 #if (GTK_MINOR_VERSION > 0)
75 /* when getting called from GDK's timer handler we
76 are no longer within GDK's grab on the GUI
77 thread so we must lock it here ourselves */
83 #if (GTK_MINOR_VERSION > 0)
84 /* release lock again */
106 bool wxTimer::Start( int millisecs
, bool oneShot
)
115 m_tag
= gtk_timeout_add( millisecs
, timeout_callback
, this );
124 gtk_timeout_remove( m_tag
);