+IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxEvtHandler)
+
+#define wxMAC_USE_CARBON_TIMER 1
+
+#if wxMAC_USE_CARBON_TIMER
+
+struct MacTimerInfo
+{
+ wxTimer* m_timer;
+ EventLoopTimerUPP m_proc;
+ EventLoopTimerRef m_timerRef;
+};
+
+static pascal void wxProcessTimer( EventLoopTimerRef theTimer, void *data );
+static pascal void wxProcessTimer( EventLoopTimerRef theTimer, void *data )
+{
+ if ( data == NULL )
+ return;
+
+ wxTimer* timer = (wxTimer*)data;
+
+ if ( timer->IsOneShot() )
+ timer->Stop();
+
+ timer->Notify();
+}
+
+void wxTimer::Init()
+{
+ m_info = new MacTimerInfo();
+ m_info->m_timer = this;
+ m_info->m_proc = NULL;
+ m_info->m_timerRef = kInvalidID;
+}
+
+bool wxTimer::IsRunning() const
+{
+ return ( m_info->m_timerRef != kInvalidID );
+}
+
+wxTimer::~wxTimer()
+{
+ Stop();
+ if (m_info != NULL)
+ {
+ delete m_info;
+ m_info = NULL;
+ }
+}
+
+bool wxTimer::Start( int milliseconds, bool mode )
+{
+ (void)wxTimerBase::Start(milliseconds, mode);
+
+ wxCHECK_MSG( m_milli > 0, false, wxT("invalid value for timer timeout") );
+ wxCHECK_MSG( m_info->m_timerRef == NULL, false, wxT("attempting to restart a timer") );
+
+ m_info->m_timer = this;
+ m_info->m_proc = NewEventLoopTimerUPP( &wxProcessTimer );
+
+ OSStatus err = InstallEventLoopTimer(
+ GetMainEventLoop(),
+ m_milli*kEventDurationMillisecond,
+ IsOneShot() ? 0 : m_milli * kEventDurationMillisecond,
+ m_info->m_proc,
+ this,
+ &m_info->m_timerRef );
+ verify_noerr( err );
+
+ return true;
+}
+
+void wxTimer::Stop()
+{
+ if (m_info->m_timerRef)
+ RemoveEventLoopTimer( m_info->m_timerRef );
+ if (m_info->m_proc)
+ DisposeEventLoopTimerUPP( m_info->m_proc );
+
+ m_info->m_proc = NULL;
+ m_info->m_timerRef = kInvalidID;
+}
+
+#else