wxTimer::Start() now calls Stop()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8347 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -101,6 +101,9 @@ If {\it oneShot} is FALSE (the default), the \helpref{Notify}{wxtimernotify}
|
|||||||
function will be called repeatedly until the timer is stopped. If TRUE,
|
function will be called repeatedly until the timer is stopped. If TRUE,
|
||||||
it will be called only once and the timer will stop automatically.
|
it will be called only once and the timer will stop automatically.
|
||||||
|
|
||||||
|
If the timer was already running, it will be stopped by this method before
|
||||||
|
restarting it.
|
||||||
|
|
||||||
\membersection{wxTimer::Stop}\label{wxtimerstop}
|
\membersection{wxTimer::Stop}\label{wxtimerstop}
|
||||||
|
|
||||||
\func{void}{Stop}{\void}
|
\func{void}{Stop}{\void}
|
||||||
|
@@ -54,18 +54,10 @@ public:
|
|||||||
|
|
||||||
// start the timer: if milliseconds == -1, use the same value as for the
|
// start the timer: if milliseconds == -1, use the same value as for the
|
||||||
// last Start()
|
// last Start()
|
||||||
virtual bool Start(int milliseconds = -1, bool oneShot = FALSE)
|
//
|
||||||
{
|
// it is now valid to call Start() multiple times: this just restarts the
|
||||||
if ( milliseconds != -1 )
|
// timer if it is already running
|
||||||
{
|
virtual bool Start(int milliseconds = -1, bool oneShot = FALSE);
|
||||||
m_milli = milliseconds;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_oneShot = oneShot;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// stop the timer
|
// stop the timer
|
||||||
virtual void Stop() = 0;
|
virtual void Stop() = 0;
|
||||||
|
@@ -115,6 +115,26 @@ void wxTimerBase::Notify()
|
|||||||
(void)m_owner->ProcessEvent(event);
|
(void)m_owner->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxTimerBase::Start(int milliseconds, bool oneShot)
|
||||||
|
{
|
||||||
|
if ( IsRunning() )
|
||||||
|
{
|
||||||
|
// not stopping the already running timer might work for some
|
||||||
|
// platforms (no problems under MSW) but leads to mysterious crashes
|
||||||
|
// on the others (GTK), so to be on the safe side do it here
|
||||||
|
Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( milliseconds != -1 )
|
||||||
|
{
|
||||||
|
m_milli = milliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_oneShot = oneShot;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_GUI
|
#endif // wxUSE_GUI
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user