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