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 \perlnote{In wxPerl custome event classes should be derived from
8 \texttt{Wx::PlEvent
} and
\texttt{Wx::PlCommandEvent
}.
}
10 \wxheading{Derived from
}
12 \helpref{wxObject
}{wxobject
}
14 \wxheading{Include files
}
20 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
21 \helpref{wxMouseEvent
}{wxmouseevent
}
23 \latexignore{\rtfignore{\wxheading{Members
}}}
25 \membersection{wxEvent::wxEvent
}
27 \func{}{wxEvent
}{\param{int
}{id =
0},
\param{wxEventType
}{eventType =
{\tt wxEVT
\_NULL}}}
29 Constructor. Should not need to be used directly by an application.
31 \membersection{wxEvent::m
\_eventObject}
33 \member{wxObject*
}{m
\_eventObject}
35 The object (usually a window) that the event was generated from,
38 \membersection{wxEvent::m
\_eventType}
40 \member{WXTYPE
}{m
\_eventType}
42 The type of the event, such as wxEVENT
\_TYPE\_BUTTON\_COMMAND.
44 \membersection{wxEvent::m
\_id}
48 Identifier for the window.
50 \membersection{wxEvent::m
\_propagationLevel}
52 \member{int
}{m
\_propagationLevel}
54 Indicates how many levels the event can propagate. This member is protected and
55 should typically only be set in the constructors of the derived classes. It
56 may be temporarily changed by
\helpref{StopPropagation
}{wxeventstoppropagation
}
57 and
\helpref{ResumePropagation
}{wxeventresumepropagation
} and tested with
58 \helpref{ShouldPropagate
}{wxeventshouldpropagate
}.
60 The initial value is set to either
{\tt wxEVENT
\_PROPAGATE\_NONE} (by
61 default) meaning that the event shouldn't be propagated at all or to
62 {\tt wxEVENT
\_PROPAGATE\_MAX} (for command events) meaning that it should be
63 propagated as much as necessary.
65 Any positive number means that the event should be propagated but no more than
66 the given number of times. E.g. the propagation level may be set to $
1$ to
67 propagate the event to its parent only, but not to its grandparent.
69 \membersection{wxEvent::m
\_skipped}
71 \member{bool
}{m
\_skipped}
73 Set to true by
{\bf Skip
} if this event should be skipped.
75 \membersection{wxEvent::m
\_timeStamp}
77 \member{long
}{m
\_timeStamp}
79 Timestamp for this event.
81 \membersection{wxEvent::Clone
}\label{wxeventclone
}
83 \constfunc{virtual wxEvent*
}{Clone
}{\void}
85 Returns a copy of the event.
87 Any event that is posted to the wxWidgets event system for later action (via
88 \helpref{wxEvtHandler::AddPendingEvent
}{wxevthandleraddpendingevent
} or
89 \helpref{wxPostEvent
}{wxpostevent
}) must implement this method. All wxWidgets
90 events fully implement this method, but any derived events implemented by the
91 user should also implement this method just in case they (or some event
92 derived from them) are ever posted.
94 All wxWidgets events implement a copy constructor, so the easiest way of
95 implementing the Clone function is to implement a copy constructor for
96 a new event (call it MyEvent) and then define the Clone function like this:
99 wxEvent *Clone(void) const
{ return new MyEvent
(*this); }
102 \membersection{wxEvent::GetEventObject}
104 \func{wxObject*}{GetEventObject}{\void}
106 Returns the object associated with the
109 \membersection{wxEvent::GetEventType}
111 \func{WXTYPE}{GetEventType}{\void}
113 Returns the identifier of the given event type,
114 such as wxEVENT\_TYPE\_BUTTON\_COMMAND.
116 \membersection{wxEvent::GetId}
118 \constfunc{int}{GetId}{\void}
120 Returns the identifier associated with this event, such as a button command id.
122 \membersection{wxEvent::GetSkipped}
124 \constfunc{bool}{GetSkipped}{\void}
126 Returns true if the event handler should be skipped, false otherwise.
128 \membersection{wxEvent::GetTimestamp}
130 \func{long}{GetTimestamp}{\void}
132 Gets the timestamp for the event.
134 \membersection{wxEvent::IsCommandEvent}\label{wxeventiscommandevent}
136 \constfunc{bool}{IsCommandEvent}{\void}
138 Returns true if the event is or is derived from
139 \helpref{wxCommandEvent}{wxcommandevent} else it returns false.
140 Note: Exists only for optimization purposes.
143 \membersection{wxEvent::ResumePropagation}\label{wxeventresumepropagation}
145 \func{void}{ResumePropagation}{\param{int }{propagationLevel}}
147 Sets the propagation level to the given value (for example returned from an
148 earlier call to \helpref{StopPropagation}{wxeventstoppropagation}).
151 \membersection{wxEvent::SetEventObject}
153 \func{void}{SetEventObject}{\param{wxObject* }{object}}
155 Sets the originating object.
157 \membersection{wxEvent::SetEventType}
159 \func{void}{SetEventType}{\param{WXTYPE }{typ}}
163 \membersection{wxEvent::SetId}
165 \func{void}{SetId}{\param{int}{ id}}
167 Sets the identifier associated with this event, such as a button command id.
169 \membersection{wxEvent::SetTimestamp}
171 \func{void}{SetTimestamp}{\param{long }{timeStamp}}
173 Sets the timestamp for the event.
175 Sets the originating object.
177 \membersection{wxEvent::ShouldPropagate}\label{wxeventshouldpropagate}
179 \constfunc{bool}{ShouldPropagate}{\void}
181 Test if this event should be propagated or not, i.e. if the propagation level
182 is currently greater than $0$.
184 \membersection{wxEvent::Skip}\label{wxeventskip}
186 \func{void}{Skip}{\param{bool}{ skip = true}}
188 Called by an event handler to tell the event system that the
189 event handler should be skipped, and the next valid handler used
192 \membersection{wxEvent::StopPropagation}\label{wxeventstoppropagation}
194 \func{int}{StopPropagation}{\void}
196 Stop the event from propagating to its parent window.
198 Returns the old propagation level value which may be later passed to
199 \helpref{ResumePropagation}{wxeventresumepropagation} to allow propagating the