]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/event.tex
Added missing functions and variable
[wxWidgets.git] / docs / latex / wx / event.tex
1 \section{\class{wxEvent}}\label{wxevent}
2
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).
6
7 For 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
31 Constructor. 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
37 The object (usually a window) that the event was generated from,
38 or should be sent to.
39
40 \membersection{wxEvent::m\_eventType}\label{wxeventmeventtype}
41
42 \member{WXTYPE}{m\_eventType}
43
44 The 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
50 Identifier for the window.
51
52 \membersection{wxEvent::m\_propagationLevel}\label{wxeventmpropagationlevel}
53
54 \member{int}{m\_propagationLevel}
55
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}.
61
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.
66
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.
70
71 \membersection{wxEvent::m\_skipped}\label{wxeventmskipped}
72
73 \member{bool}{m\_skipped}
74
75 Set 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
81 Timestamp for this event.
82
83 \membersection{wxEvent::Clone}\label{wxeventclone}
84
85 \constfunc{virtual wxEvent*}{Clone}{\void}
86
87 Returns a copy of the event.
88
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.
95
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:
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
108 Returns the object associated with the
109 event, if any.
110
111 \membersection{wxEvent::GetEventType}\label{wxeventgeteventtype}
112
113 \func{WXTYPE}{GetEventType}{\void}
114
115 Returns the identifier of the given event type,
116 such as wxEVENT\_TYPE\_BUTTON\_COMMAND.
117
118 \membersection{wxEvent::GetId}\label{wxeventgetid}
119
120 \constfunc{int}{GetId}{\void}
121
122 Returns 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
128 Returns true if the event handler should be skipped, false otherwise.
129
130 \membersection{wxEvent::GetTimestamp}\label{wxeventgettimestamp}
131
132 \func{long}{GetTimestamp}{\void}
133
134 Gets the timestamp for the event.
135
136 \membersection{wxEvent::IsCommandEvent}\label{wxeventiscommandevent}
137
138 \constfunc{bool}{IsCommandEvent}{\void}
139
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.
143
144
145 \membersection{wxEvent::ResumePropagation}\label{wxeventresumepropagation}
146
147 \func{void}{ResumePropagation}{\param{int }{propagationLevel}}
148
149 Sets the propagation level to the given value (for example returned from an
150 earlier call to \helpref{StopPropagation}{wxeventstoppropagation}).
151
152
153 \membersection{wxEvent::SetEventObject}\label{wxeventseteventobject}
154
155 \func{void}{SetEventObject}{\param{wxObject* }{object}}
156
157 Sets the originating object.
158
159 \membersection{wxEvent::SetEventType}\label{wxeventseteventtype}
160
161 \func{void}{SetEventType}{\param{WXTYPE }{typ}}
162
163 Sets the event type.
164
165 \membersection{wxEvent::SetId}\label{wxeventsetid}
166
167 \func{void}{SetId}{\param{int}{ id}}
168
169 Sets 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
175 Sets the timestamp for the event.
176
177 Sets the originating object.
178
179 \membersection{wxEvent::ShouldPropagate}\label{wxeventshouldpropagate}
180
181 \constfunc{bool}{ShouldPropagate}{\void}
182
183 Test if this event should be propagated or not, i.e. if the propagation level
184 is currently greater than $0$.
185
186 \membersection{wxEvent::Skip}\label{wxeventskip}
187
188 \func{void}{Skip}{\param{bool}{ skip = true}}
189
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
192 instead.
193
194 \membersection{wxEvent::StopPropagation}\label{wxeventstoppropagation}
195
196 \func{int}{StopPropagation}{\void}
197
198 Stop the event from propagating to its parent window.
199
200 Returns the old propagation level value which may be later passed to
201 \helpref{ResumePropagation}{wxeventresumepropagation} to allow propagating the
202 event again.
203