- oneShot = mode ;
- if (milliseconds < 0)
- milliseconds = lastMilli;
-
- if (milliseconds <= 0)
- return FALSE;
-
- lastMilli = milli = milliseconds;
-
- wxTimerList.DeleteObject(this);
- TIMERPROC wxTimerProcInst = (TIMERPROC) MakeProcInstance((FARPROC)wxTimerProc,
- wxGetInstance());
-
- id = SetTimer(NULL, (UINT)(id ? id : 1), (UINT)milliseconds, wxTimerProcInst);
- if (id > 0)
- {
- wxTimerList.Append(id, this);
- return TRUE;
- }
- else return FALSE;
+ (void)wxTimerBase::Start(milliseconds, oneShot);
+
+ wxCHECK_MSG( m_milli > 0, false, wxT("invalid value for timer timeour") );
+
+#ifdef __WXWINCE__
+ m_id = ::SetTimer(NULL, (UINT)(m_id ? m_id : 1),
+ (UINT)m_milli, (TIMERPROC) wxTimerProc);
+#else
+ TIMERPROC wxTimerProcInst = (TIMERPROC)
+ MakeProcInstance((FARPROC)wxTimerProc, wxGetInstance());
+
+ m_id = ::SetTimer(NULL, (UINT)(m_id ? m_id : 1),
+ (UINT)m_milli, wxTimerProcInst);
+#endif
+
+ if ( m_id > 0 )
+ {
+ wxTimerList[m_id] = this;
+
+ return true;
+ }
+ else
+ {
+ wxLogSysError(_("Couldn't create a timer"));
+
+ return false;
+ }
+}
+
+void wxTimer::Stop()
+{
+ if ( m_id )
+ {
+ ::KillTimer(NULL, (UINT)m_id);
+
+ wxTimerList.erase(m_id);
+ }
+
+ m_id = 0;