1 \section{\class{wxEvent
}}\label{wxevent
}
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).
7 \wxheading{Derived from
}
9 \helpref{wxObject
}{wxobject
}
11 \wxheading{Include files
}
17 \helpref{wxCommandEvent
}{wxcommandevent
},
\rtfsp
18 \helpref{wxMouseEvent
}{wxmouseevent
}
20 \latexignore{\rtfignore{\wxheading{Members
}}}
22 \membersection{wxEvent::wxEvent
}
24 \func{}{wxEvent
}{\param{int
}{id =
0},
\param{wxEventType
}{eventType =
{\tt wxEVT
\_NULL}}}
26 Constructor. Should not need to be used directly by an application.
28 \membersection{wxEvent::m
\_eventObject}
30 \member{wxObject*
}{m
\_eventObject}
32 The object (usually a window) that the event was generated from,
35 \membersection{wxEvent::m
\_eventType}
37 \member{WXTYPE
}{m
\_eventType}
39 The type of the event, such as wxEVENT
\_TYPE\_BUTTON\_COMMAND.
41 \membersection{wxEvent::m
\_id}
45 Identifier for the window.
47 \membersection{wxEvent::m
\_propagationLevel}
49 \member{int
}{m
\_propagationLevel}
51 Indicates how many levels the event can propagate. This member is protected and
52 should typically only be set in the constructors of the derived classes. It
53 may be temporarily changed by
\helpref{StopPropagation
}{wxeventstoppropagation
}
54 and
\helpref{ResumePropagation
}{wxeventresumepropagation
} and tested with
55 \helpref{ShouldPropagate
}{wxeventshouldpropagate
}.
57 The initial value is set to either
{\tt wxEVENT
\_PROPAGATE\_NONE} (by
58 default) meaning that the event shouldn't be propagated at all or to
59 {\tt wxEVENT
\_PROPAGATE\_MAX} (for command events) meaning that it should be
60 propagated as much as necessary.
62 Any positive number means that the event should be propagated but no more than
63 the given number of times. E.g. the propagation level may be set to $
1$ to
64 propagate the event to its parent only, but not to its grandparent.
66 \membersection{wxEvent::m
\_skipped}
68 \member{bool
}{m
\_skipped}
70 Set to true by
{\bf Skip
} if this event should be skipped.
72 \membersection{wxEvent::m
\_timeStamp}
74 \member{long
}{m
\_timeStamp}
76 Timestamp for this event.
78 \membersection{wxEvent::Clone
}\label{wxeventclone
}
80 \constfunc{virtual wxEvent*
}{Clone
}{\void}
82 Returns a copy of the event.
84 Any 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
87 events fully implement this method, but any derived events implemented by the
88 user should also implement this method just in case they (or some event
89 derived from them) are ever posted.
91 All wxWindows events implement a copy constructor, so the easiest way of
92 implementing the Clone function is to implement a copy constructor for
93 a new event (call it MyEvent) and then define the Clone function like this:
96 wxEvent *Clone(void) const
{ return new MyEvent
(*this); }
99 \membersection{wxEvent::GetEventObject}
101 \func{wxObject*}{GetEventObject}{\void}
103 Returns the object associated with the
106 \membersection{wxEvent::GetEventType}
108 \func{WXTYPE}{GetEventType}{\void}
110 Returns the identifier of the given event type,
111 such as wxEVENT\_TYPE\_BUTTON\_COMMAND.
113 \membersection{wxEvent::GetId}
115 \constfunc{int}{GetId}{\void}
117 Returns the identifier associated with this event, such as a button command id.
119 \membersection{wxEvent::GetSkipped}
121 \constfunc{bool}{GetSkipped}{\void}
123 Returns true if the event handler should be skipped, false otherwise.
125 \membersection{wxEvent::GetTimestamp}
127 \func{long}{GetTimestamp}{\void}
129 Gets the timestamp for the event.
131 \membersection{wxEvent::IsCommandEvent}\label{wxeventiscommandevent}
133 \constfunc{bool}{IsCommandEvent}{\void}
135 Returns true if the event is or is derived from
136 \helpref{wxCommandEvent}{wxcommandevent} else it returns false.
137 Note: Exists only for optimization purposes.
140 \membersection{wxEvent::ResumePropagation}\label{wxeventresumepropagation}
142 \func{void}{ResumePropagation}{\param{int }{propagationLevel}}
144 Sets the propagation level to the given value (for example returned from an
145 earlier call to \helpref{StopPropagation}{wxeventstoppropagation}).
148 \membersection{wxEvent::SetEventObject}
150 \func{void}{SetEventObject}{\param{wxObject* }{object}}
152 Sets the originating object.
154 \membersection{wxEvent::SetEventType}
156 \func{void}{SetEventType}{\param{WXTYPE }{typ}}
160 \membersection{wxEvent::SetId}
162 \func{void}{SetId}{\param{int}{ id}}
164 Sets the identifier associated with this event, such as a button command id.
166 \membersection{wxEvent::SetTimestamp}
168 \func{void}{SetTimestamp}{\param{long }{timeStamp}}
170 Sets the timestamp for the event.
172 Sets the originating object.
174 \membersection{wxEvent::ShouldPropagate}\label{wxeventshouldpropagate}
176 \constfunc{bool}{ShouldPropagate}{\void}
178 Test if this event should be propagated or not, i.e. if the propagation level
179 is currently greater than $0$.
181 \membersection{wxEvent::Skip}\label{wxeventskip}
183 \func{void}{Skip}{\param{bool}{ skip = true}}
185 Called by an event handler to tell the event system that the
186 event handler should be skipped, and the next valid handler used
189 \membersection{wxEvent::StopPropagation}\label{wxeventstoppropagation}
191 \func{int}{StopPropagation}{\void}
193 Stop the event from propagating to its parent window.
195 Returns the old propagation level value which may be later passed to
196 \helpref{ResumePropagation}{wxeventresumepropagation} to allow propagating the