1998-05-20 10:25:30 -04:00
|
|
|
\section{\class{wxEvent}}\label{wxevent}
|
|
|
|
|
|
|
|
An event is a structure holding information about an event passed to a
|
|
|
|
callback or member function. {\bf wxEvent} used to be a multipurpose
|
|
|
|
event object, and is an abstract base class for other event classes (see below).
|
|
|
|
|
2004-09-23 19:25:07 -04:00
|
|
|
For more information about events, see the \helpref{Event handling overview}{eventhandlingoverview}.
|
|
|
|
|
2005-01-18 10:13:34 -05:00
|
|
|
\perlnote{In wxPerl custom event classes should be derived from
|
2004-05-01 16:19:11 -04:00
|
|
|
\texttt{Wx::PlEvent} and \texttt{Wx::PlCommandEvent}.}
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{Derived from}
|
|
|
|
|
|
|
|
\helpref{wxObject}{wxobject}
|
|
|
|
|
1999-02-15 15:41:29 -05:00
|
|
|
\wxheading{Include files}
|
|
|
|
|
|
|
|
<wx/event.h>
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\wxheading{See also}
|
|
|
|
|
|
|
|
\helpref{wxCommandEvent}{wxcommandevent},\rtfsp
|
|
|
|
\helpref{wxMouseEvent}{wxmouseevent}
|
|
|
|
|
|
|
|
\latexignore{\rtfignore{\wxheading{Members}}}
|
|
|
|
|
2004-09-30 07:15:59 -04:00
|
|
|
\membersection{wxEvent::wxEvent}\label{wxeventctor}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2002-01-23 10:49:03 -05:00
|
|
|
\func{}{wxEvent}{\param{int }{id = 0}, \param{wxEventType }{eventType = {\tt wxEVT\_NULL}}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Constructor. Should not need to be used directly by an application.
|
|
|
|
|
2004-09-30 07:15:59 -04:00
|
|
|
\membersection{wxEvent::m\_propagationLevel}\label{wxeventmpropagationlevel}
|
2003-07-17 20:39:05 -04:00
|
|
|
|
|
|
|
\member{int}{m\_propagationLevel}
|
|
|
|
|
|
|
|
Indicates how many levels the event can propagate. This member is protected and
|
|
|
|
should typically only be set in the constructors of the derived classes. It
|
|
|
|
may be temporarily changed by \helpref{StopPropagation}{wxeventstoppropagation}
|
|
|
|
and \helpref{ResumePropagation}{wxeventresumepropagation} and tested with
|
|
|
|
\helpref{ShouldPropagate}{wxeventshouldpropagate}.
|
|
|
|
|
2004-04-08 06:21:17 -04:00
|
|
|
The initial value is set to either {\tt wxEVENT\_PROPAGATE\_NONE} (by
|
2003-07-17 20:39:05 -04:00
|
|
|
default) meaning that the event shouldn't be propagated at all or to
|
2004-04-08 06:21:17 -04:00
|
|
|
{\tt wxEVENT\_PROPAGATE\_MAX} (for command events) meaning that it should be
|
2003-07-17 20:39:05 -04:00
|
|
|
propagated as much as necessary.
|
|
|
|
|
|
|
|
Any positive number means that the event should be propagated but no more than
|
|
|
|
the given number of times. E.g. the propagation level may be set to $1$ to
|
|
|
|
propagate the event to its parent only, but not to its grandparent.
|
|
|
|
|
2001-11-18 07:42:45 -05:00
|
|
|
\membersection{wxEvent::Clone}\label{wxeventclone}
|
|
|
|
|
2002-01-23 10:49:03 -05:00
|
|
|
\constfunc{virtual wxEvent*}{Clone}{\void}
|
2001-11-18 07:42:45 -05:00
|
|
|
|
|
|
|
Returns a copy of the event.
|
|
|
|
|
2004-05-04 04:27:20 -04:00
|
|
|
Any event that is posted to the wxWidgets event system for later action (via
|
2001-11-18 07:42:45 -05:00
|
|
|
\helpref{wxEvtHandler::AddPendingEvent}{wxevthandleraddpendingevent} or
|
2004-05-04 04:27:20 -04:00
|
|
|
\helpref{wxPostEvent}{wxpostevent}) must implement this method. All wxWidgets
|
2001-11-18 07:42:45 -05:00
|
|
|
events fully implement this method, but any derived events implemented by the
|
|
|
|
user should also implement this method just in case they (or some event
|
|
|
|
derived from them) are ever posted.
|
|
|
|
|
2004-05-04 04:27:20 -04:00
|
|
|
All wxWidgets events implement a copy constructor, so the easiest way of
|
2001-11-18 07:42:45 -05:00
|
|
|
implementing the Clone function is to implement a copy constructor for
|
|
|
|
a new event (call it MyEvent) and then define the Clone function like this:
|
2004-02-21 20:16:32 -05:00
|
|
|
|
2001-11-18 07:42:45 -05:00
|
|
|
\begin{verbatim}
|
|
|
|
wxEvent *Clone(void) const { return new MyEvent(*this); }
|
|
|
|
\end{verbatim}
|
|
|
|
|
2004-09-30 07:15:59 -04:00
|
|
|
\membersection{wxEvent::GetEventObject}\label{wxeventgeteventobject}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{wxObject*}{GetEventObject}{\void}
|
|
|
|
|
2005-01-18 10:13:34 -05:00
|
|
|
Returns the object (usually a window) associated with the
|
1998-05-20 10:25:30 -04:00
|
|
|
event, if any.
|
|
|
|
|
2004-09-30 07:15:59 -04:00
|
|
|
\membersection{wxEvent::GetEventType}\label{wxeventgeteventtype}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{WXTYPE}{GetEventType}{\void}
|
|
|
|
|
|
|
|
Returns the identifier of the given event type,
|
|
|
|
such as wxEVENT\_TYPE\_BUTTON\_COMMAND.
|
|
|
|
|
2004-09-30 07:15:59 -04:00
|
|
|
\membersection{wxEvent::GetId}\label{wxeventgetid}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2003-07-17 20:39:05 -04:00
|
|
|
\constfunc{int}{GetId}{\void}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
Returns the identifier associated with this event, such as a button command id.
|
|
|
|
|
2004-09-30 07:15:59 -04:00
|
|
|
\membersection{wxEvent::GetSkipped}\label{wxeventgetskipped}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2003-07-17 20:39:05 -04:00
|
|
|
\constfunc{bool}{GetSkipped}{\void}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
Returns true if the event handler should be skipped, false otherwise.
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2004-09-30 07:15:59 -04:00
|
|
|
\membersection{wxEvent::GetTimestamp}\label{wxeventgettimestamp}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{long}{GetTimestamp}{\void}
|
|
|
|
|
|
|
|
Gets the timestamp for the event.
|
|
|
|
|
2003-07-17 20:39:05 -04:00
|
|
|
\membersection{wxEvent::IsCommandEvent}\label{wxeventiscommandevent}
|
|
|
|
|
|
|
|
\constfunc{bool}{IsCommandEvent}{\void}
|
|
|
|
|
|
|
|
Returns true if the event is or is derived from
|
|
|
|
\helpref{wxCommandEvent}{wxcommandevent} else it returns false.
|
|
|
|
Note: Exists only for optimization purposes.
|
|
|
|
|
|
|
|
|
|
|
|
\membersection{wxEvent::ResumePropagation}\label{wxeventresumepropagation}
|
|
|
|
|
|
|
|
\func{void}{ResumePropagation}{\param{int }{propagationLevel}}
|
|
|
|
|
|
|
|
Sets the propagation level to the given value (for example returned from an
|
|
|
|
earlier call to \helpref{StopPropagation}{wxeventstoppropagation}).
|
|
|
|
|
|
|
|
|
2004-09-30 07:15:59 -04:00
|
|
|
\membersection{wxEvent::SetEventObject}\label{wxeventseteventobject}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{void}{SetEventObject}{\param{wxObject* }{object}}
|
|
|
|
|
|
|
|
Sets the originating object.
|
|
|
|
|
2004-09-30 07:15:59 -04:00
|
|
|
\membersection{wxEvent::SetEventType}\label{wxeventseteventtype}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{void}{SetEventType}{\param{WXTYPE }{typ}}
|
|
|
|
|
|
|
|
Sets the event type.
|
|
|
|
|
2004-09-30 07:15:59 -04:00
|
|
|
\membersection{wxEvent::SetId}\label{wxeventsetid}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{void}{SetId}{\param{int}{ id}}
|
|
|
|
|
|
|
|
Sets the identifier associated with this event, such as a button command id.
|
|
|
|
|
2004-09-30 07:15:59 -04:00
|
|
|
\membersection{wxEvent::SetTimestamp}\label{wxeventsettimestamp}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
|
|
|
\func{void}{SetTimestamp}{\param{long }{timeStamp}}
|
|
|
|
|
|
|
|
Sets the timestamp for the event.
|
|
|
|
|
2003-07-17 20:39:05 -04:00
|
|
|
\membersection{wxEvent::ShouldPropagate}\label{wxeventshouldpropagate}
|
|
|
|
|
|
|
|
\constfunc{bool}{ShouldPropagate}{\void}
|
|
|
|
|
|
|
|
Test if this event should be propagated or not, i.e. if the propagation level
|
|
|
|
is currently greater than $0$.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
\membersection{wxEvent::Skip}\label{wxeventskip}
|
|
|
|
|
2003-01-17 19:16:34 -05:00
|
|
|
\func{void}{Skip}{\param{bool}{ skip = true}}
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2005-01-13 15:54:45 -05:00
|
|
|
Called by an event handler, it controls whether additional event
|
|
|
|
handlers bound to this event will be called after the current event
|
|
|
|
handler returns. Skip(false) (the default setting) will prevent
|
|
|
|
additional event handlers from being called and control will be
|
|
|
|
returned to the sender of the event immediately after the current
|
|
|
|
handler has finished. Skip(True) will cause the event processing
|
|
|
|
system to continue searching for a handler function for this event.
|
|
|
|
|
1998-05-20 10:25:30 -04:00
|
|
|
|
2003-08-15 12:17:40 -04:00
|
|
|
\membersection{wxEvent::StopPropagation}\label{wxeventstoppropagation}
|
2003-07-17 20:39:05 -04:00
|
|
|
|
2003-08-15 12:17:40 -04:00
|
|
|
\func{int}{StopPropagation}{\void}
|
2003-07-17 20:39:05 -04:00
|
|
|
|
|
|
|
Stop the event from propagating to its parent window.
|
|
|
|
|
|
|
|
Returns the old propagation level value which may be later passed to
|
|
|
|
\helpref{ResumePropagation}{wxeventresumepropagation} to allow propagating the
|
|
|
|
event again.
|
|
|
|
|