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