1 \section{\class{wxEvent
}}\label{wxevent
}
3 An event is a structure holding information about an event passed to a
4 callback or member function.
{\bf wxEvent
} used to be a multipurpose
5 event object, and is an abstract base class for other event classes (see below).
7 For more information about events, see the
\helpref{Event handling overview
}{eventhandlingoverview
}.
9 \perlnote{In wxPerl custom event classes should be derived from
10 \texttt{Wx::PlEvent
} and
\texttt{Wx::PlCommandEvent
}.
}
12 \wxheading{Derived from
}
14 \helpref{wxObject
}{wxobject
}
16 \wxheading{Include files
}
22 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
23 \helpref{wxMouseEvent
}{wxmouseevent
}
25 \latexignore{\rtfignore{\wxheading{Members
}}}
28 \membersection{wxEvent::wxEvent
}\label{wxeventctor
}
30 \func{}{wxEvent
}{\param{int
}{id =
0},
\param{wxEventType
}{eventType =
{\tt wxEVT
\_NULL}}}
32 Constructor. Should not need to be used directly by an application.
35 \membersection{wxEvent::m
\_propagationLevel}\label{wxeventmpropagationlevel
}
38 \member{int
}{m
\_propagationLevel}
40 Indicates how many levels the event can propagate. This member is protected and
41 should typically only be set in the constructors of the derived classes. It
42 may be temporarily changed by
\helpref{StopPropagation
}{wxeventstoppropagation
}
43 and
\helpref{ResumePropagation
}{wxeventresumepropagation
} and tested with
44 \helpref{ShouldPropagate
}{wxeventshouldpropagate
}.
46 The initial value is set to either
{\tt wxEVENT
\_PROPAGATE\_NONE} (by
47 default) meaning that the event shouldn't be propagated at all or to
48 {\tt wxEVENT
\_PROPAGATE\_MAX} (for command events) meaning that it should be
49 propagated as much as necessary.
51 Any positive number means that the event should be propagated but no more than
52 the given number of times. E.g. the propagation level may be set to $
1$ to
53 propagate the event to its parent only, but not to its grandparent.
56 \membersection{wxEvent::Clone
}\label{wxeventclone
}
58 \constfunc{virtual wxEvent*
}{Clone
}{\void}
60 Returns a copy of the event.
62 Any event that is posted to the wxWidgets event system for later action (via
63 \helpref{wxEvtHandler::AddPendingEvent
}{wxevthandleraddpendingevent
} or
64 \helpref{wxPostEvent
}{wxpostevent
}) must implement this method. All wxWidgets
65 events fully implement this method, but any derived events implemented by the
66 user should also implement this method just in case they (or some event
67 derived from them) are ever posted.
69 All wxWidgets events implement a copy constructor, so the easiest way of
70 implementing the Clone function is to implement a copy constructor for
71 a new event (call it MyEvent) and then define the Clone function like this:
74 wxEvent *Clone(void) const
{ return new MyEvent
(*this); }
78 \membersection{wxEvent::GetEventObject}\label{wxeventgeteventobject}
80 \func{wxObject*}{GetEventObject}{\void}
82 Returns the object (usually a window) associated with the
86 \membersection{wxEvent::GetEventType}\label{wxeventgeteventtype}
88 \func{wxEventType}{GetEventType}{\void}
90 Returns the identifier of the given event type,
91 such as \texttt{wxEVT\_COMMAND\_BUTTON\_CLICKED}.
94 \membersection{wxEvent::GetId}\label{wxeventgetid}
96 \constfunc{int}{GetId}{\void}
98 Returns the identifier associated with this event, such as a button command id.
101 \membersection{wxEvent::GetSkipped}\label{wxeventgetskipped}
103 \constfunc{bool}{GetSkipped}{\void}
105 Returns true if the event handler should be skipped, false otherwise.
108 \membersection{wxEvent::GetTimestamp}\label{wxeventgettimestamp}
110 \func{long}{GetTimestamp}{\void}
112 Gets the timestamp for the event. The timestamp is the time in milliseconds
113 since some fixed moment (\emph{not} necessarily the standard Unix Epoch, so
114 only differences between the timestamps and not their absolute values usually
118 \membersection{wxEvent::IsCommandEvent}\label{wxeventiscommandevent}
120 \constfunc{bool}{IsCommandEvent}{\void}
122 Returns true if the event is or is derived from
123 \helpref{wxCommandEvent}{wxcommandevent} else it returns false.
124 Note: Exists only for optimization purposes.
127 \membersection{wxEvent::ResumePropagation}\label{wxeventresumepropagation}
129 \func{void}{ResumePropagation}{\param{int }{propagationLevel}}
131 Sets the propagation level to the given value (for example returned from an
132 earlier call to \helpref{StopPropagation}{wxeventstoppropagation}).
135 \membersection{wxEvent::SetEventObject}\label{wxeventseteventobject}
137 \func{void}{SetEventObject}{\param{wxObject* }{object}}
139 Sets the originating object.
142 \membersection{wxEvent::SetEventType}\label{wxeventseteventtype}
144 \func{void}{SetEventType}{\param{wxEventType }{type}}
149 \membersection{wxEvent::SetId}\label{wxeventsetid}
151 \func{void}{SetId}{\param{int}{ id}}
153 Sets the identifier associated with this event, such as a button command id.
156 \membersection{wxEvent::SetTimestamp}\label{wxeventsettimestamp}
158 \func{void}{SetTimestamp}{\param{long }{timeStamp}}
160 Sets the timestamp for the event.
163 \membersection{wxEvent::ShouldPropagate}\label{wxeventshouldpropagate}
165 \constfunc{bool}{ShouldPropagate}{\void}
167 Test if this event should be propagated or not, i.e. if the propagation level
168 is currently greater than $0$.
171 \membersection{wxEvent::Skip}\label{wxeventskip}
173 \func{void}{Skip}{\param{bool}{ skip = true}}
175 This method can be called by an event handler and controls whether additional
176 event handlers bound to this event will be called after the current event
177 handler returns. The default behavior is equivalent to calling Skip(false)
178 (which is, hence, usually unnecessary) and will prevent additional event
179 handlers from being called and control will be returned to the sender of the
180 event immediately after the current handler has finished. If Skip(true) is
181 called, the event processing system continues searching for a handler
182 function for this event as if the current handler didn't exist.
184 In general, it is recommended to skip all non-command events to allow the
185 default handling to take place. The command events are, however, normally not
186 skipped as usually a single command such as a button click or menu item
187 selection must only be processed by one handler.
190 \membersection{wxEvent::StopPropagation}\label{wxeventstoppropagation}
192 \func{int}{StopPropagation}{\void}
194 Stop the event from propagating to its parent window.
196 Returns the old propagation level value which may be later passed to
197 \helpref{ResumePropagation}{wxeventresumepropagation} to allow propagating the