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 custome 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
}}}
27 \membersection{wxEvent::wxEvent
}\label{wxeventctor
}
29 \func{}{wxEvent
}{\param{int
}{id =
0},
\param{wxEventType
}{eventType =
{\tt wxEVT
\_NULL}}}
31 Constructor. Should not need to be used directly by an application.
33 \membersection{wxEvent::m
\_eventObject}\label{wxeventmeventobject
}
35 \member{wxObject*
}{m
\_eventObject}
37 The object (usually a window) that the event was generated from,
40 \membersection{wxEvent::m
\_eventType}\label{wxeventmeventtype
}
42 \member{WXTYPE
}{m
\_eventType}
44 The type of the event, such as wxEVENT
\_TYPE\_BUTTON\_COMMAND.
46 \membersection{wxEvent::m
\_id}\label{wxeventmid
}
50 Identifier for the window.
52 \membersection{wxEvent::m
\_propagationLevel}\label{wxeventmpropagationlevel
}
54 \member{int
}{m
\_propagationLevel}
56 Indicates how many levels the event can propagate. This member is protected and
57 should typically only be set in the constructors of the derived classes. It
58 may be temporarily changed by
\helpref{StopPropagation
}{wxeventstoppropagation
}
59 and
\helpref{ResumePropagation
}{wxeventresumepropagation
} and tested with
60 \helpref{ShouldPropagate
}{wxeventshouldpropagate
}.
62 The initial value is set to either
{\tt wxEVENT
\_PROPAGATE\_NONE} (by
63 default) meaning that the event shouldn't be propagated at all or to
64 {\tt wxEVENT
\_PROPAGATE\_MAX} (for command events) meaning that it should be
65 propagated as much as necessary.
67 Any positive number means that the event should be propagated but no more than
68 the given number of times. E.g. the propagation level may be set to $
1$ to
69 propagate the event to its parent only, but not to its grandparent.
71 \membersection{wxEvent::m
\_skipped}\label{wxeventmskipped
}
73 \member{bool
}{m
\_skipped}
75 Set to true by
{\bf Skip
} if this event should be skipped.
77 \membersection{wxEvent::m
\_timeStamp}\label{wxeventmtimestamp
}
79 \member{long
}{m
\_timeStamp}
81 Timestamp for this event.
83 \membersection{wxEvent::Clone
}\label{wxeventclone
}
85 \constfunc{virtual wxEvent*
}{Clone
}{\void}
87 Returns a copy of the event.
89 Any event that is posted to the wxWidgets event system for later action (via
90 \helpref{wxEvtHandler::AddPendingEvent
}{wxevthandleraddpendingevent
} or
91 \helpref{wxPostEvent
}{wxpostevent
}) must implement this method. All wxWidgets
92 events fully implement this method, but any derived events implemented by the
93 user should also implement this method just in case they (or some event
94 derived from them) are ever posted.
96 All wxWidgets events implement a copy constructor, so the easiest way of
97 implementing the Clone function is to implement a copy constructor for
98 a new event (call it MyEvent) and then define the Clone function like this:
101 wxEvent *Clone(void) const
{ return new MyEvent
(*this); }
104 \membersection{wxEvent::GetEventObject}\label{wxeventgeteventobject}
106 \func{wxObject*}{GetEventObject}{\void}
108 Returns the object associated with the
111 \membersection{wxEvent::GetEventType}\label{wxeventgeteventtype}
113 \func{WXTYPE}{GetEventType}{\void}
115 Returns the identifier of the given event type,
116 such as wxEVENT\_TYPE\_BUTTON\_COMMAND.
118 \membersection{wxEvent::GetId}\label{wxeventgetid}
120 \constfunc{int}{GetId}{\void}
122 Returns the identifier associated with this event, such as a button command id.
124 \membersection{wxEvent::GetSkipped}\label{wxeventgetskipped}
126 \constfunc{bool}{GetSkipped}{\void}
128 Returns true if the event handler should be skipped, false otherwise.
130 \membersection{wxEvent::GetTimestamp}\label{wxeventgettimestamp}
132 \func{long}{GetTimestamp}{\void}
134 Gets the timestamp for the event.
136 \membersection{wxEvent::IsCommandEvent}\label{wxeventiscommandevent}
138 \constfunc{bool}{IsCommandEvent}{\void}
140 Returns true if the event is or is derived from
141 \helpref{wxCommandEvent}{wxcommandevent} else it returns false.
142 Note: Exists only for optimization purposes.
145 \membersection{wxEvent::ResumePropagation}\label{wxeventresumepropagation}
147 \func{void}{ResumePropagation}{\param{int }{propagationLevel}}
149 Sets the propagation level to the given value (for example returned from an
150 earlier call to \helpref{StopPropagation}{wxeventstoppropagation}).
153 \membersection{wxEvent::SetEventObject}\label{wxeventseteventobject}
155 \func{void}{SetEventObject}{\param{wxObject* }{object}}
157 Sets the originating object.
159 \membersection{wxEvent::SetEventType}\label{wxeventseteventtype}
161 \func{void}{SetEventType}{\param{WXTYPE }{typ}}
165 \membersection{wxEvent::SetId}\label{wxeventsetid}
167 \func{void}{SetId}{\param{int}{ id}}
169 Sets the identifier associated with this event, such as a button command id.
171 \membersection{wxEvent::SetTimestamp}\label{wxeventsettimestamp}
173 \func{void}{SetTimestamp}{\param{long }{timeStamp}}
175 Sets the timestamp for the event.
177 Sets the originating object.
179 \membersection{wxEvent::ShouldPropagate}\label{wxeventshouldpropagate}
181 \constfunc{bool}{ShouldPropagate}{\void}
183 Test if this event should be propagated or not, i.e. if the propagation level
184 is currently greater than $0$.
186 \membersection{wxEvent::Skip}\label{wxeventskip}
188 \func{void}{Skip}{\param{bool}{ skip = true}}
190 Called by an event handler to tell the event system that the
191 event handler should be skipped, and the next valid handler used
194 \membersection{wxEvent::StopPropagation}\label{wxeventstoppropagation}
196 \func{int}{StopPropagation}{\void}
198 Stop the event from propagating to its parent window.
200 Returns the old propagation level value which may be later passed to
201 \helpref{ResumePropagation}{wxeventresumepropagation} to allow propagating the