]> git.saurik.com Git - wxWidgets.git/blame - src/gtk/timer.cpp
Fixed broken Ieee extension for configure --without-apple_ieee
[wxWidgets.git] / src / gtk / timer.cpp
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: timer.cpp
3// Purpose:
4// Author: Robert Roebling
5// Created: 01/02/97
6// Id:
7// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8// Licence: wxWindows licence
9/////////////////////////////////////////////////////////////////////////////
10
11
12#ifdef __GNUG__
13#pragma implementation "timer.h"
14#endif
15
16#include "wx/timer.h"
17
18//-----------------------------------------------------------------------------
19// wxTimer
20//-----------------------------------------------------------------------------
21
22IMPLEMENT_DYNAMIC_CLASS(wxTimer,wxObject)
23
24gint timeout_callback( gpointer data )
25{
26 wxTimer *timer = (wxTimer*)data;
27 timer->Notify();
28 if (timer->OneShot()) timer->Stop();
29 return TRUE;
30};
31
32wxTimer::wxTimer(void)
33{
34 m_tag = -1;
35 m_time = 1000;
36 m_oneShot = FALSE;
37};
38
39wxTimer::~wxTimer(void)
40{
41 Stop();
42};
43
44int wxTimer::Interval(void)
45{
46 return m_time;
47};
48
49bool wxTimer::OneShot(void)
50{
51 return m_oneShot;
52};
53
54void wxTimer::Notify(void)
55{
56};
57
58void wxTimer::Start( int millisecs, bool oneShot )
59{
60 if (millisecs != -1) m_time = millisecs;
61 m_oneShot = oneShot;
62 m_tag = gtk_timeout_add( millisecs, timeout_callback, this );
63};
64
65void wxTimer::Stop(void)
66{
67 if (m_tag != -1)
68 gtk_timeout_remove( m_tag );
69 m_tag = -1;
70};
71