docs for wxTimer change
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5849 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ed79198695
commit
2531c7e393
@ -212,6 +212,14 @@ Sets the number of fields, and optionally the field widths.
|
||||
in pixels. A value of -1 indicates that the field is variable width; at least one
|
||||
field must be -1.}
|
||||
|
||||
\membersection{wxStatusBar::SetMinHeight}\label{wxstatusbarsetminheight}
|
||||
|
||||
\func{void}{SetMinHeight}{\param{int}{ height}}
|
||||
|
||||
Sets the minimal possible hight for the status bar. The real height may be
|
||||
bigger than the height specified here depending on the size of the font used by
|
||||
the status bar.
|
||||
|
||||
\membersection{wxStatusBar::SetStatusText}\label{wxstatusbarsetstatustext}
|
||||
|
||||
\func{virtual void}{SetStatusText}{\param{const wxString\& }{text}, \param{int}{ i = 0}}
|
||||
|
@ -1,9 +1,24 @@
|
||||
\section{\class{wxTimer}}\label{wxtimer}
|
||||
|
||||
The wxTimer class allows you to execute code at specified intervals. To
|
||||
use it, derive a new class and override the {\bf Notify} member to
|
||||
perform the required action. Start with {\bf Start}, stop with {\bf
|
||||
Stop}, it's as simple as that.
|
||||
The wxTimer class allows you to execute code at specified intervals. Its
|
||||
precision is platform-dependent, but in general will not be better than 1ms nor
|
||||
worse than 1s.
|
||||
|
||||
There are two different ways to use this class:
|
||||
|
||||
\begin{enumerate}
|
||||
\item You may derive a new class from wxTimer and override the
|
||||
\helpref{Notify}{wxtimernotify} member to perform the required action.
|
||||
\item Or you may redirect the notifications to any
|
||||
\helpref{wxEvtHandler}{wxevthandler} derived object by using the non default
|
||||
constructor or \helpref{SetOwner}{wxtimersetowner}. Then use {\tt EVT\_TIMER}
|
||||
macro to connect it to the event handler which will receive
|
||||
\helpref{wxTimerEvent}{wxtimerevent} notifications.
|
||||
\end{enumerate}
|
||||
|
||||
In any case, you must start the timer with \helpref{Start}{wxtimerstart}
|
||||
after constructing it before it actually starts sending notifications. It can
|
||||
be stopped later with \helpref{Stop}{wxtimerstop}.
|
||||
|
||||
\wxheading{Derived from}
|
||||
|
||||
@ -19,47 +34,131 @@ Stop}, it's as simple as that.
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxTimer::wxTimer}
|
||||
\membersection{wxTimer::wxTimer}{wxtimerctordef}
|
||||
|
||||
\func{}{wxTimer}{\void}
|
||||
|
||||
Constructor.
|
||||
Default constructor. If you use it to construct the object and don't call
|
||||
\helpref{SetOwner}{wxtimersetowner} later, you must override
|
||||
\helpref{Notify}{wxtimernotify} method to process the notifications.
|
||||
|
||||
\membersection{wxTimer::wxTimer}{wxtimerwxtimer}
|
||||
|
||||
\func{}{wxTimer}{\param{wxEvtHandler *}{owner}, \param{int }{id = -1}}
|
||||
|
||||
Creates a timer and associates it with {\it owner}. Please see
|
||||
\helpref{SetOwner}{wxtimersetowner} for the description of parameters.
|
||||
|
||||
\membersection{wxTimer::\destruct{wxTimer}}
|
||||
|
||||
\func{}{\destruct{wxTimer}}{\void}
|
||||
|
||||
Destructor. Stops the timer if activated.
|
||||
Destructor. Stops the timer if it is running.
|
||||
|
||||
\membersection{wxTimer::Interval}
|
||||
\membersection{wxTimer::GetInterval}{wxtimergetinterval}
|
||||
|
||||
\func{int}{Interval}{\void}
|
||||
\constfunc{int}{GetInterval}{\void}
|
||||
|
||||
Returns the current interval for the timer.
|
||||
Returns the current interval for the timer (in milliseconds).
|
||||
|
||||
\membersection{wxTimer::Notify}
|
||||
\membersection{wxTimer::IsOneShot}{wxtimerisoneshot}
|
||||
|
||||
\constfunc{bool}{IsOneShot}{\void}
|
||||
|
||||
Returns TRUE if the timer is one shot, i.e. if it will stop after firing the
|
||||
first notification automatically.
|
||||
|
||||
\membersection{wxTimer::IsRunning}{wxtimerisrunning}
|
||||
|
||||
\constfunc{bool}{IsRunning}{\void}
|
||||
|
||||
Returns TRUE if the timer is running, FALSE if it is stopped.
|
||||
|
||||
\membersection{wxTimer::Notify}{wxtimernotify}
|
||||
|
||||
\func{void}{Notify}{\void}
|
||||
|
||||
This member should be overridden by the user. It is called on timeout.
|
||||
This member should be overridden by the user if the default constructor was
|
||||
used and \helpref{SetOwner}{wxtimersetowner} wasn't called.
|
||||
|
||||
\membersection{wxTimer::Start}
|
||||
Perform whatever action which is to be taken periodically here.
|
||||
|
||||
\membersection{wxTimer::SetOwner}{wxtimersetowner}
|
||||
|
||||
\func{void}{SetOwner}{\param{wxEvtHandler *}{owner}, \param{int }{id = -1}}
|
||||
|
||||
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.
|
||||
|
||||
\membersection{wxTimer::Start}{wxtimerstart}
|
||||
|
||||
\func{bool}{Start}{\param{int}{ milliseconds = -1}, \param{bool}{ oneShot=FALSE}}
|
||||
|
||||
(Re)starts the timer. If {\it milliseconds}\/ is absent or -1, the
|
||||
previous value is used. Returns FALSE if the timer could not be started,
|
||||
(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).
|
||||
|
||||
If {\it oneShot} is FALSE (the default), the Notify function will be repeatedly
|
||||
called. If TRUE, Notify will be called only once.
|
||||
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.
|
||||
|
||||
\membersection{wxTimer::Stop}
|
||||
\membersection{wxTimer::Stop}{wxtimerstop}
|
||||
|
||||
\func{void}{Stop}{\void}
|
||||
|
||||
Stops the timer.
|
||||
|
||||
\section{\class{wxTimerEvent}}\label{wxtimerevent}
|
||||
|
||||
wxTimerEvent object is passed to the event handler of timer events.
|
||||
|
||||
For example:
|
||||
|
||||
\begin{verbatim}
|
||||
class MyFrame : public wxFrame
|
||||
{
|
||||
public:
|
||||
...
|
||||
void OnTimer(wxTimerEvent& event);
|
||||
|
||||
private:
|
||||
wxTimer m_timer;
|
||||
};
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
||||
EVT_TIMER(TIMER_ID, MyFrame::OnTimer)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
MyFrame::MyFrame()
|
||||
: m_timer(this, TIMER_ID)
|
||||
{
|
||||
m_timer.Start(1000); // 1 second interval
|
||||
}
|
||||
|
||||
void MyFrame::OnTimer(wxTimerEvent& event)
|
||||
{
|
||||
// do whatever you want to do every second here
|
||||
}
|
||||
|
||||
\end{verbatim}
|
||||
|
||||
\wxheading{Include files}
|
||||
|
||||
<wx/timer.h>
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxTimer}{wxtimer}
|
||||
|
||||
\latexignore{\rtfignore{\wxheading{Members}}}
|
||||
|
||||
\membersection{wxTimerEvent::GetInterval}{wxtimereventgetinterval}
|
||||
|
||||
\constfunc{int}{GetInterval}{\void}
|
||||
|
||||
Returns the interval of the timer which generated this event.
|
||||
|
||||
\section{\class{wxStopWatch}}\label{wxstopwatch}
|
||||
|
||||
The wxStopWatch class allow you to measure time intervalls.
|
||||
|
Loading…
Reference in New Issue
Block a user