From: Vadim Zeitlin Date: Tue, 4 Jun 2002 14:59:52 +0000 (+0000) Subject: added and documented wxTIMER_XXX constants to be used instead of bool parameter to... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b0a2d8a882a59d30d95a836b5897132de0262d91?ds=sidebyside added and documented wxTIMER_XXX constants to be used instead of bool parameter to wxTimer::Start() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15740 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/latex/wx/timer.tex b/docs/latex/wx/timer.tex index 97939eb2ba..7830183b5d 100644 --- a/docs/latex/wx/timer.tex +++ b/docs/latex/wx/timer.tex @@ -63,14 +63,14 @@ Returns the current interval for the timer (in milliseconds). \constfunc{bool}{IsOneShot}{\void} -Returns TRUE if the timer is one shot, i.e. if it will stop after firing the +Returns {\tt TRUE} if the timer is one shot, i.e.\ if it will stop after firing the first notification automatically. \membersection{wxTimer::IsRunning}\label{wxtimerisrunning} \constfunc{bool}{IsRunning}{\void} -Returns TRUE if the timer is running, FALSE if it is stopped. +Returns {\tt TRUE} if the timer is running, {\tt FALSE} if it is stopped. \membersection{wxTimer::Notify}\label{wxtimernotify} @@ -85,21 +85,28 @@ Perform whatever action which is to be taken periodically here. \func{void}{SetOwner}{\param{wxEvtHandler *}{owner}, \param{int }{id = -1}} -Associates the timer with the given {\it owner} object. When the timer is +Associates the timer with the given {\it owner}\/ object. When the timer is running, the owner will receive \helpref{timer events}{wxtimerevent} with -id equal to {\it id} specified here. +id equal to {\it id}\/ specified here. \membersection{wxTimer::Start}\label{wxtimerstart} -\func{bool}{Start}{\param{int}{ milliseconds = -1}, \param{bool}{ oneShot=FALSE}} +\func{bool}{Start}{\param{int}{milliseconds = -1}, \param{bool }{oneShot = {\tt FALSE}}} -(Re)starts the timer. If {\it milliseconds} parameter is -1 (value by default), -the previous value is used. Returns FALSE if the timer could not be started, -TRUE otherwise (in MS Windows timers are a limited resource). +(Re)starts the timer. If {\it milliseconds}\/ parameter is -1 (value by default), +the previous value is used. Returns {\tt FALSE} if the timer could not be started, +{\tt TRUE} otherwise (in MS Windows timers are a limited resource). + +If {\it oneShot}\/ is {\tt FALSE} (the default), the \helpref{Notify}{wxtimernotify} +function will be called repeatedly until the timer is stopped. If {\tt TRUE}, +it will be called only once and the timer will stop automatically. To make your +code more readable you may also use the following symbolic constants +\twocolwidtha{5cm}% +\begin{twocollist}\itemsep=0pt +\twocolitem{wxTIMER\_CONTINUOUS}{Start a normal, continuously running, timer} +\twocolitem{wxTIMER\_ONE\_SHOT}{Start a one shot timer} +\end{twocollist} -If {\it oneShot} is FALSE (the default), the \helpref{Notify}{wxtimernotify} -function will be called repeatedly until the timer is stopped. If TRUE, -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. diff --git a/include/wx/timer.h b/include/wx/timer.h index 7fff1bbdc3..115c9c33f7 100644 --- a/include/wx/timer.h +++ b/include/wx/timer.h @@ -28,6 +28,14 @@ // wxTimer // ---------------------------------------------------------------------------- +// more readable flags for Start(): + +// generate notifications periodically until the timer is stopped (default) +#define wxTIMER_CONTINUOUS FALSE + +// only send the notification once and then stop the timer +#define wxTIMER_ONE_SHOT TRUE + // the interface of wxTimer class class WXDLLEXPORT wxTimerBase : public wxObject {