]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/event.tex
fix buglet wxKeyEvent->wxMouseEvent
[wxWidgets.git] / docs / latex / wx / event.tex
CommitLineData
a660d684
KB
1\section{\class{wxEvent}}\label{wxevent}
2
3An event is a structure holding information about an event passed to a
4callback or member function. {\bf wxEvent} used to be a multipurpose
5event object, and is an abstract base class for other event classes (see below).
6
1bd98e41
RN
7For more information about events, see the \helpref{Event handling overview}{eventhandlingoverview}.
8
066f177c
MB
9\perlnote{In wxPerl custome event classes should be derived from
10\texttt{Wx::PlEvent} and \texttt{Wx::PlCommandEvent}.}
11
a660d684
KB
12\wxheading{Derived from}
13
14\helpref{wxObject}{wxobject}
15
954b8ae6
JS
16\wxheading{Include files}
17
18<wx/event.h>
19
a660d684
KB
20\wxheading{See also}
21
22\helpref{wxCommandEvent}{wxcommandevent},\rtfsp
23\helpref{wxMouseEvent}{wxmouseevent}
24
25\latexignore{\rtfignore{\wxheading{Members}}}
26
b236c10f 27\membersection{wxEvent::wxEvent}\label{wxeventctor}
a660d684 28
d5f648a9 29\func{}{wxEvent}{\param{int }{id = 0}, \param{wxEventType }{eventType = {\tt wxEVT\_NULL}}}
a660d684
KB
30
31Constructor. Should not need to be used directly by an application.
32
b236c10f 33\membersection{wxEvent::m\_eventObject}\label{wxeventmeventobject}
a660d684
KB
34
35\member{wxObject*}{m\_eventObject}
36
37The object (usually a window) that the event was generated from,
38or should be sent to.
39
b236c10f 40\membersection{wxEvent::m\_eventType}\label{wxeventmeventtype}
a660d684
KB
41
42\member{WXTYPE}{m\_eventType}
43
44The type of the event, such as wxEVENT\_TYPE\_BUTTON\_COMMAND.
45
b236c10f 46\membersection{wxEvent::m\_id}\label{wxeventmid}
a660d684
KB
47
48\member{int}{m\_id}
49
50Identifier for the window.
51
b236c10f 52\membersection{wxEvent::m\_propagationLevel}\label{wxeventmpropagationlevel}
1648d51b
VZ
53
54\member{int}{m\_propagationLevel}
55
56Indicates how many levels the event can propagate. This member is protected and
57should typically only be set in the constructors of the derived classes. It
58may be temporarily changed by \helpref{StopPropagation}{wxeventstoppropagation}
59and \helpref{ResumePropagation}{wxeventresumepropagation} and tested with
60\helpref{ShouldPropagate}{wxeventshouldpropagate}.
61
26b6f3d3 62The initial value is set to either {\tt wxEVENT\_PROPAGATE\_NONE} (by
1648d51b 63default) meaning that the event shouldn't be propagated at all or to
26b6f3d3 64{\tt wxEVENT\_PROPAGATE\_MAX} (for command events) meaning that it should be
1648d51b
VZ
65propagated as much as necessary.
66
67Any positive number means that the event should be propagated but no more than
68the given number of times. E.g. the propagation level may be set to $1$ to
69propagate the event to its parent only, but not to its grandparent.
70
b236c10f 71\membersection{wxEvent::m\_skipped}\label{wxeventmskipped}
a660d684
KB
72
73\member{bool}{m\_skipped}
74
cc81d32f 75Set to true by {\bf Skip} if this event should be skipped.
a660d684 76
b236c10f 77\membersection{wxEvent::m\_timeStamp}\label{wxeventmtimestamp}
a660d684
KB
78
79\member{long}{m\_timeStamp}
80
81Timestamp for this event.
82
8e72b8b5
RR
83\membersection{wxEvent::Clone}\label{wxeventclone}
84
d5f648a9 85\constfunc{virtual wxEvent*}{Clone}{\void}
8e72b8b5
RR
86
87Returns a copy of the event.
88
fc2171bd 89Any event that is posted to the wxWidgets event system for later action (via
8e72b8b5 90\helpref{wxEvtHandler::AddPendingEvent}{wxevthandleraddpendingevent} or
fc2171bd 91\helpref{wxPostEvent}{wxpostevent}) must implement this method. All wxWidgets
8e72b8b5
RR
92events fully implement this method, but any derived events implemented by the
93user should also implement this method just in case they (or some event
94derived from them) are ever posted.
95
fc2171bd 96All wxWidgets events implement a copy constructor, so the easiest way of
8e72b8b5
RR
97implementing the Clone function is to implement a copy constructor for
98a new event (call it MyEvent) and then define the Clone function like this:
d2c2afc9 99
8e72b8b5
RR
100\begin{verbatim}
101 wxEvent *Clone(void) const { return new MyEvent(*this); }
102\end{verbatim}
103
b236c10f 104\membersection{wxEvent::GetEventObject}\label{wxeventgeteventobject}
a660d684
KB
105
106\func{wxObject*}{GetEventObject}{\void}
107
108Returns the object associated with the
109event, if any.
110
b236c10f 111\membersection{wxEvent::GetEventType}\label{wxeventgeteventtype}
a660d684
KB
112
113\func{WXTYPE}{GetEventType}{\void}
114
115Returns the identifier of the given event type,
116such as wxEVENT\_TYPE\_BUTTON\_COMMAND.
117
b236c10f 118\membersection{wxEvent::GetId}\label{wxeventgetid}
a660d684 119
1648d51b 120\constfunc{int}{GetId}{\void}
a660d684
KB
121
122Returns the identifier associated with this event, such as a button command id.
123
b236c10f 124\membersection{wxEvent::GetSkipped}\label{wxeventgetskipped}
a660d684 125
1648d51b 126\constfunc{bool}{GetSkipped}{\void}
a660d684 127
cc81d32f 128Returns true if the event handler should be skipped, false otherwise.
a660d684 129
b236c10f 130\membersection{wxEvent::GetTimestamp}\label{wxeventgettimestamp}
a660d684
KB
131
132\func{long}{GetTimestamp}{\void}
133
134Gets the timestamp for the event.
135
1648d51b
VZ
136\membersection{wxEvent::IsCommandEvent}\label{wxeventiscommandevent}
137
138\constfunc{bool}{IsCommandEvent}{\void}
139
140Returns true if the event is or is derived from
141\helpref{wxCommandEvent}{wxcommandevent} else it returns false.
142Note: Exists only for optimization purposes.
143
144
145\membersection{wxEvent::ResumePropagation}\label{wxeventresumepropagation}
146
147\func{void}{ResumePropagation}{\param{int }{propagationLevel}}
148
149Sets the propagation level to the given value (for example returned from an
150earlier call to \helpref{StopPropagation}{wxeventstoppropagation}).
151
152
b236c10f 153\membersection{wxEvent::SetEventObject}\label{wxeventseteventobject}
a660d684
KB
154
155\func{void}{SetEventObject}{\param{wxObject* }{object}}
156
157Sets the originating object.
158
b236c10f 159\membersection{wxEvent::SetEventType}\label{wxeventseteventtype}
a660d684
KB
160
161\func{void}{SetEventType}{\param{WXTYPE }{typ}}
162
163Sets the event type.
164
b236c10f 165\membersection{wxEvent::SetId}\label{wxeventsetid}
a660d684
KB
166
167\func{void}{SetId}{\param{int}{ id}}
168
169Sets the identifier associated with this event, such as a button command id.
170
b236c10f 171\membersection{wxEvent::SetTimestamp}\label{wxeventsettimestamp}
a660d684
KB
172
173\func{void}{SetTimestamp}{\param{long }{timeStamp}}
174
175Sets the timestamp for the event.
176
177Sets the originating object.
178
1648d51b
VZ
179\membersection{wxEvent::ShouldPropagate}\label{wxeventshouldpropagate}
180
181\constfunc{bool}{ShouldPropagate}{\void}
182
183Test if this event should be propagated or not, i.e. if the propagation level
184is currently greater than $0$.
185
a660d684
KB
186\membersection{wxEvent::Skip}\label{wxeventskip}
187
cc81d32f 188\func{void}{Skip}{\param{bool}{ skip = true}}
a660d684
KB
189
190Called by an event handler to tell the event system that the
191event handler should be skipped, and the next valid handler used
192instead.
193
684761db 194\membersection{wxEvent::StopPropagation}\label{wxeventstoppropagation}
1648d51b 195
684761db 196\func{int}{StopPropagation}{\void}
1648d51b
VZ
197
198Stop the event from propagating to its parent window.
199
200Returns the old propagation level value which may be later passed to
201\helpref{ResumePropagation}{wxeventresumepropagation} to allow propagating the
202event again.
203