]> git.saurik.com Git - wxWidgets.git/blame_incremental - docs/latex/wx/event.tex
fix buglet wxKeyEvent->wxMouseEvent
[wxWidgets.git] / docs / latex / wx / event.tex
... / ...
CommitLineData
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
7For more information about events, see the \helpref{Event handling overview}{eventhandlingoverview}.
8
9\perlnote{In wxPerl custome event classes should be derived from
10\texttt{Wx::PlEvent} and \texttt{Wx::PlCommandEvent}.}
11
12\wxheading{Derived from}
13
14\helpref{wxObject}{wxobject}
15
16\wxheading{Include files}
17
18<wx/event.h>
19
20\wxheading{See also}
21
22\helpref{wxCommandEvent}{wxcommandevent},\rtfsp
23\helpref{wxMouseEvent}{wxmouseevent}
24
25\latexignore{\rtfignore{\wxheading{Members}}}
26
27\membersection{wxEvent::wxEvent}\label{wxeventctor}
28
29\func{}{wxEvent}{\param{int }{id = 0}, \param{wxEventType }{eventType = {\tt wxEVT\_NULL}}}
30
31Constructor. Should not need to be used directly by an application.
32
33\membersection{wxEvent::m\_eventObject}\label{wxeventmeventobject}
34
35\member{wxObject*}{m\_eventObject}
36
37The object (usually a window) that the event was generated from,
38or should be sent to.
39
40\membersection{wxEvent::m\_eventType}\label{wxeventmeventtype}
41
42\member{WXTYPE}{m\_eventType}
43
44The type of the event, such as wxEVENT\_TYPE\_BUTTON\_COMMAND.
45
46\membersection{wxEvent::m\_id}\label{wxeventmid}
47
48\member{int}{m\_id}
49
50Identifier for the window.
51
52\membersection{wxEvent::m\_propagationLevel}\label{wxeventmpropagationlevel}
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
62The initial value is set to either {\tt wxEVENT\_PROPAGATE\_NONE} (by
63default) 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
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
71\membersection{wxEvent::m\_skipped}\label{wxeventmskipped}
72
73\member{bool}{m\_skipped}
74
75Set to true by {\bf Skip} if this event should be skipped.
76
77\membersection{wxEvent::m\_timeStamp}\label{wxeventmtimestamp}
78
79\member{long}{m\_timeStamp}
80
81Timestamp for this event.
82
83\membersection{wxEvent::Clone}\label{wxeventclone}
84
85\constfunc{virtual wxEvent*}{Clone}{\void}
86
87Returns a copy of the event.
88
89Any 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
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
96All wxWidgets events implement a copy constructor, so the easiest way of
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:
99
100\begin{verbatim}
101 wxEvent *Clone(void) const { return new MyEvent(*this); }
102\end{verbatim}
103
104\membersection{wxEvent::GetEventObject}\label{wxeventgeteventobject}
105
106\func{wxObject*}{GetEventObject}{\void}
107
108Returns the object associated with the
109event, if any.
110
111\membersection{wxEvent::GetEventType}\label{wxeventgeteventtype}
112
113\func{WXTYPE}{GetEventType}{\void}
114
115Returns the identifier of the given event type,
116such as wxEVENT\_TYPE\_BUTTON\_COMMAND.
117
118\membersection{wxEvent::GetId}\label{wxeventgetid}
119
120\constfunc{int}{GetId}{\void}
121
122Returns the identifier associated with this event, such as a button command id.
123
124\membersection{wxEvent::GetSkipped}\label{wxeventgetskipped}
125
126\constfunc{bool}{GetSkipped}{\void}
127
128Returns true if the event handler should be skipped, false otherwise.
129
130\membersection{wxEvent::GetTimestamp}\label{wxeventgettimestamp}
131
132\func{long}{GetTimestamp}{\void}
133
134Gets the timestamp for the event.
135
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
153\membersection{wxEvent::SetEventObject}\label{wxeventseteventobject}
154
155\func{void}{SetEventObject}{\param{wxObject* }{object}}
156
157Sets the originating object.
158
159\membersection{wxEvent::SetEventType}\label{wxeventseteventtype}
160
161\func{void}{SetEventType}{\param{WXTYPE }{typ}}
162
163Sets the event type.
164
165\membersection{wxEvent::SetId}\label{wxeventsetid}
166
167\func{void}{SetId}{\param{int}{ id}}
168
169Sets the identifier associated with this event, such as a button command id.
170
171\membersection{wxEvent::SetTimestamp}\label{wxeventsettimestamp}
172
173\func{void}{SetTimestamp}{\param{long }{timeStamp}}
174
175Sets the timestamp for the event.
176
177Sets the originating object.
178
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
186\membersection{wxEvent::Skip}\label{wxeventskip}
187
188\func{void}{Skip}{\param{bool}{ skip = true}}
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
194\membersection{wxEvent::StopPropagation}\label{wxeventstoppropagation}
195
196\func{int}{StopPropagation}{\void}
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