]> git.saurik.com Git - wxWidgets.git/blame - include/wx/event.h
call OnExec() taking wxString argument from OnExecute() by default
[wxWidgets.git] / include / wx / event.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
bd83cb56 2// Name: wx/event.h
c801d85f
KB
3// Purpose: Event classes
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
77ffb593 8// Copyright: (c) wxWidgets team
65571936 9// Licence: wxWindows licence
c801d85f
KB
10/////////////////////////////////////////////////////////////////////////////
11
204abcd4
PC
12#ifndef _WX_EVENT_H_
13#define _WX_EVENT_H_
c801d85f 14
c801d85f 15#include "wx/defs.h"
bde626ce 16#include "wx/cpp.h"
c801d85f 17#include "wx/object.h"
341050e2 18#include "wx/clntdata.h"
e90c1d2a
VZ
19
20#if wxUSE_GUI
21 #include "wx/gdicmn.h"
43b5058d 22 #include "wx/cursor.h"
e90c1d2a 23#endif
42e69d6b 24
b5a98acd 25#include "wx/dynarray.h"
8ebec7dc 26#include "wx/thread.h"
2ef989c9 27#include "wx/tracker.h"
b5a98acd 28
e90c1d2a
VZ
29// ----------------------------------------------------------------------------
30// forward declarations
31// ----------------------------------------------------------------------------
32
b5dbe15d 33class WXDLLIMPEXP_FWD_BASE wxList;
e90c1d2a 34#if wxUSE_GUI
b5dbe15d
VS
35 class WXDLLIMPEXP_FWD_CORE wxDC;
36 class WXDLLIMPEXP_FWD_CORE wxMenu;
37 class WXDLLIMPEXP_FWD_CORE wxWindow;
38 class WXDLLIMPEXP_FWD_CORE wxWindowBase;
e90c1d2a
VZ
39#endif // wxUSE_GUI
40
b5dbe15d 41class WXDLLIMPEXP_FWD_BASE wxEvtHandler;
432968bf 42
e90c1d2a
VZ
43// ----------------------------------------------------------------------------
44// Event types
45// ----------------------------------------------------------------------------
64693098 46
cbee8f8d
VZ
47typedef int wxEventType;
48
c4fa5aa7
VZ
49#define wxEVT_ANY ((wxEventType)-1)
50
3a818b15
VZ
51// this is used to make the event table entry type safe, so that for an event
52// handler only a function with proper parameter list can be given.
f29fe169 53#define wxStaticCastEvent(type, val) wx_static_cast(type, val)
3a818b15 54
d9e2e4c2
DE
55#define DECLARE_EVENT_TABLE_ENTRY(type, winid, idLast, fn, obj) \
56 wxEventTableEntry(type, winid, idLast, fn, obj)
cbee8f8d 57
2e4df4bf
VZ
58#define BEGIN_DECLARE_EVENT_TYPES()
59#define END_DECLARE_EVENT_TYPES()
886dd7d2
VZ
60#define DECLARE_EXPORTED_EVENT_TYPE(expdecl, name, value) \
61 extern expdecl const wxEventType name;
85664da6 62#define DECLARE_EVENT_TYPE(name, value) \
bddd7a8d 63 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_CORE, name, value)
886dd7d2 64#define DECLARE_LOCAL_EVENT_TYPE(name, value) \
bde626ce 65 DECLARE_EXPORTED_EVENT_TYPE(wxEMPTY_PARAMETER_VALUE, name, value)
71499aaf 66#define DEFINE_EVENT_TYPE(name) const wxEventType name = wxNewEventType();
886dd7d2 67#define DEFINE_LOCAL_EVENT_TYPE(name) DEFINE_EVENT_TYPE(name)
cbee8f8d
VZ
68
69// generate a new unique event type
bddd7a8d 70extern WXDLLIMPEXP_BASE wxEventType wxNewEventType();
cbee8f8d 71
2e4df4bf 72BEGIN_DECLARE_EVENT_TYPES()
6164f93c
VZ
73 // it is important to still have these as constants to avoid
74 // initialization order related problems
bddd7a8d
VZ
75 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_NULL, 0)
76 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_FIRST, 10000)
77 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_USER_FIRST, wxEVT_FIRST + 2000)
cbee8f8d 78
2e4df4bf
VZ
79 DECLARE_EVENT_TYPE(wxEVT_COMMAND_BUTTON_CLICKED, 1)
80 DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKBOX_CLICKED, 2)
81 DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHOICE_SELECTED, 3)
82 DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_SELECTED, 4)
83 DECLARE_EVENT_TYPE(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 5)
84 DECLARE_EVENT_TYPE(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 6)
2e4df4bf
VZ
85 DECLARE_EVENT_TYPE(wxEVT_COMMAND_MENU_SELECTED, 9)
86 DECLARE_EVENT_TYPE(wxEVT_COMMAND_SLIDER_UPDATED, 10)
87 DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBOX_SELECTED, 11)
88 DECLARE_EVENT_TYPE(wxEVT_COMMAND_RADIOBUTTON_SELECTED, 12)
89
90 // wxEVT_COMMAND_SCROLLBAR_UPDATED is now obsolete since we use
91 // wxEVT_SCROLL... events
92
93 DECLARE_EVENT_TYPE(wxEVT_COMMAND_SCROLLBAR_UPDATED, 13)
94 DECLARE_EVENT_TYPE(wxEVT_COMMAND_VLBOX_SELECTED, 14)
95 DECLARE_EVENT_TYPE(wxEVT_COMMAND_COMBOBOX_SELECTED, 15)
96 DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_RCLICKED, 16)
97 DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_ENTER, 17)
98 DECLARE_EVENT_TYPE(wxEVT_COMMAND_SPINCTRL_UPDATED, 18)
99
a9a0ceca
VZ
100 // Toolbar dropdown arrows
101 DECLARE_EVENT_TYPE(wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED, 19)
102
2e4df4bf 103 // Sockets and timers send events, too
bddd7a8d 104 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_SOCKET, 50)
c2ca375c 105 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_TIMER , 80)
2e4df4bf
VZ
106
107 // Mouse event types
108 DECLARE_EVENT_TYPE(wxEVT_LEFT_DOWN, 100)
109 DECLARE_EVENT_TYPE(wxEVT_LEFT_UP, 101)
110 DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DOWN, 102)
111 DECLARE_EVENT_TYPE(wxEVT_MIDDLE_UP, 103)
112 DECLARE_EVENT_TYPE(wxEVT_RIGHT_DOWN, 104)
113 DECLARE_EVENT_TYPE(wxEVT_RIGHT_UP, 105)
114 DECLARE_EVENT_TYPE(wxEVT_MOTION, 106)
115 DECLARE_EVENT_TYPE(wxEVT_ENTER_WINDOW, 107)
116 DECLARE_EVENT_TYPE(wxEVT_LEAVE_WINDOW, 108)
117 DECLARE_EVENT_TYPE(wxEVT_LEFT_DCLICK, 109)
118 DECLARE_EVENT_TYPE(wxEVT_MIDDLE_DCLICK, 110)
119 DECLARE_EVENT_TYPE(wxEVT_RIGHT_DCLICK, 111)
120 DECLARE_EVENT_TYPE(wxEVT_SET_FOCUS, 112)
121 DECLARE_EVENT_TYPE(wxEVT_KILL_FOCUS, 113)
456bc6d9
VZ
122 DECLARE_EVENT_TYPE(wxEVT_CHILD_FOCUS, 114)
123 DECLARE_EVENT_TYPE(wxEVT_MOUSEWHEEL, 115)
01101e2d
VZ
124 DECLARE_EVENT_TYPE(wxEVT_AUX1_DOWN, 116)
125 DECLARE_EVENT_TYPE(wxEVT_AUX1_UP, 117)
126 DECLARE_EVENT_TYPE(wxEVT_AUX1_DCLICK, 118)
127 DECLARE_EVENT_TYPE(wxEVT_AUX2_DOWN, 119)
128 DECLARE_EVENT_TYPE(wxEVT_AUX2_UP, 120)
129 DECLARE_EVENT_TYPE(wxEVT_AUX2_DCLICK, 121)
2e4df4bf
VZ
130
131 // Non-client mouse events
132 DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DOWN, 200)
133 DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_UP, 201)
134 DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DOWN, 202)
135 DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_UP, 203)
136 DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DOWN, 204)
137 DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_UP, 205)
138 DECLARE_EVENT_TYPE(wxEVT_NC_MOTION, 206)
139 DECLARE_EVENT_TYPE(wxEVT_NC_ENTER_WINDOW, 207)
140 DECLARE_EVENT_TYPE(wxEVT_NC_LEAVE_WINDOW, 208)
141 DECLARE_EVENT_TYPE(wxEVT_NC_LEFT_DCLICK, 209)
142 DECLARE_EVENT_TYPE(wxEVT_NC_MIDDLE_DCLICK, 210)
143 DECLARE_EVENT_TYPE(wxEVT_NC_RIGHT_DCLICK, 211)
144
145 // Character input event type
146 DECLARE_EVENT_TYPE(wxEVT_CHAR, 212)
147 DECLARE_EVENT_TYPE(wxEVT_CHAR_HOOK, 213)
148 DECLARE_EVENT_TYPE(wxEVT_NAVIGATION_KEY, 214)
149 DECLARE_EVENT_TYPE(wxEVT_KEY_DOWN, 215)
150 DECLARE_EVENT_TYPE(wxEVT_KEY_UP, 216)
5048c832
JS
151#if wxUSE_HOTKEY
152 DECLARE_EVENT_TYPE(wxEVT_HOTKEY, 217)
153#endif
2e4df4bf
VZ
154 // Set cursor event
155 DECLARE_EVENT_TYPE(wxEVT_SET_CURSOR, 230)
156
e8b669d3 157 // wxScrollBar and wxSlider event identifiers
2e4df4bf
VZ
158 DECLARE_EVENT_TYPE(wxEVT_SCROLL_TOP, 300)
159 DECLARE_EVENT_TYPE(wxEVT_SCROLL_BOTTOM, 301)
160 DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEUP, 302)
161 DECLARE_EVENT_TYPE(wxEVT_SCROLL_LINEDOWN, 303)
162 DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEUP, 304)
163 DECLARE_EVENT_TYPE(wxEVT_SCROLL_PAGEDOWN, 305)
164 DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBTRACK, 306)
165 DECLARE_EVENT_TYPE(wxEVT_SCROLL_THUMBRELEASE, 307)
cbc85508 166 DECLARE_EVENT_TYPE(wxEVT_SCROLL_CHANGED, 308)
2e4df4bf
VZ
167
168 // Scroll events from wxWindow
169 DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_TOP, 320)
170 DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_BOTTOM, 321)
171 DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEUP, 322)
172 DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_LINEDOWN, 323)
173 DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEUP, 324)
174 DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_PAGEDOWN, 325)
175 DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBTRACK, 326)
176 DECLARE_EVENT_TYPE(wxEVT_SCROLLWIN_THUMBRELEASE, 327)
177
178 // System events
179 DECLARE_EVENT_TYPE(wxEVT_SIZE, 400)
180 DECLARE_EVENT_TYPE(wxEVT_MOVE, 401)
181 DECLARE_EVENT_TYPE(wxEVT_CLOSE_WINDOW, 402)
182 DECLARE_EVENT_TYPE(wxEVT_END_SESSION, 403)
183 DECLARE_EVENT_TYPE(wxEVT_QUERY_END_SESSION, 404)
184 DECLARE_EVENT_TYPE(wxEVT_ACTIVATE_APP, 405)
355debca 185 // 406..408 are power events
2e4df4bf
VZ
186 DECLARE_EVENT_TYPE(wxEVT_ACTIVATE, 409)
187 DECLARE_EVENT_TYPE(wxEVT_CREATE, 410)
188 DECLARE_EVENT_TYPE(wxEVT_DESTROY, 411)
189 DECLARE_EVENT_TYPE(wxEVT_SHOW, 412)
190 DECLARE_EVENT_TYPE(wxEVT_ICONIZE, 413)
191 DECLARE_EVENT_TYPE(wxEVT_MAXIMIZE, 414)
192 DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_CHANGED, 415)
63e819f2
VS
193 DECLARE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_LOST, 416)
194 DECLARE_EVENT_TYPE(wxEVT_PAINT, 417)
195 DECLARE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND, 418)
196 DECLARE_EVENT_TYPE(wxEVT_NC_PAINT, 419)
197 DECLARE_EVENT_TYPE(wxEVT_PAINT_ICON, 420)
198 DECLARE_EVENT_TYPE(wxEVT_MENU_OPEN, 421)
199 DECLARE_EVENT_TYPE(wxEVT_MENU_CLOSE, 422)
200 DECLARE_EVENT_TYPE(wxEVT_MENU_HIGHLIGHT, 423)
2e4df4bf
VZ
201 DECLARE_EVENT_TYPE(wxEVT_CONTEXT_MENU, 424)
202 DECLARE_EVENT_TYPE(wxEVT_SYS_COLOUR_CHANGED, 425)
574c939e
KB
203 DECLARE_EVENT_TYPE(wxEVT_DISPLAY_CHANGED, 426)
204 DECLARE_EVENT_TYPE(wxEVT_SETTING_CHANGED, 427)
205 DECLARE_EVENT_TYPE(wxEVT_QUERY_NEW_PALETTE, 428)
206 DECLARE_EVENT_TYPE(wxEVT_PALETTE_CHANGED, 429)
207 DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_DOWN, 430)
208 DECLARE_EVENT_TYPE(wxEVT_JOY_BUTTON_UP, 431)
209 DECLARE_EVENT_TYPE(wxEVT_JOY_MOVE, 432)
210 DECLARE_EVENT_TYPE(wxEVT_JOY_ZMOVE, 433)
211 DECLARE_EVENT_TYPE(wxEVT_DROP_FILES, 434)
212 DECLARE_EVENT_TYPE(wxEVT_DRAW_ITEM, 435)
213 DECLARE_EVENT_TYPE(wxEVT_MEASURE_ITEM, 436)
214 DECLARE_EVENT_TYPE(wxEVT_COMPARE_ITEM, 437)
215 DECLARE_EVENT_TYPE(wxEVT_INIT_DIALOG, 438)
bddd7a8d 216 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_BASE, wxEVT_IDLE, 439)
574c939e 217 DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440)
5706de1c 218 DECLARE_EVENT_TYPE(wxEVT_SIZING, 441)
4d4f4290 219 DECLARE_EVENT_TYPE(wxEVT_MOVING, 442)
aa767a45
JS
220 DECLARE_EVENT_TYPE(wxEVT_MOVE_START, 443)
221 DECLARE_EVENT_TYPE(wxEVT_MOVE_END, 444)
222 DECLARE_EVENT_TYPE(wxEVT_HIBERNATE, 445)
355debca 223 // more power events follow -- see wx/power.h
2e4df4bf 224
78c91815 225 // Clipboard events
aa767a45
JS
226 DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY, 446)
227 DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT, 447)
228 DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE, 448)
78c91815 229
2e4df4bf
VZ
230 // Generic command events
231 // Note: a click is a higher-level event than button down/up
232 DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_CLICK, 500)
233 DECLARE_EVENT_TYPE(wxEVT_COMMAND_LEFT_DCLICK, 501)
234 DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_CLICK, 502)
235 DECLARE_EVENT_TYPE(wxEVT_COMMAND_RIGHT_DCLICK, 503)
236 DECLARE_EVENT_TYPE(wxEVT_COMMAND_SET_FOCUS, 504)
237 DECLARE_EVENT_TYPE(wxEVT_COMMAND_KILL_FOCUS, 505)
238 DECLARE_EVENT_TYPE(wxEVT_COMMAND_ENTER, 506)
239
240 // Help events
241 DECLARE_EVENT_TYPE(wxEVT_HELP, 1050)
242 DECLARE_EVENT_TYPE(wxEVT_DETAILED_HELP, 1051)
243
244END_DECLARE_EVENT_TYPES()
96f6c703 245
cbee8f8d
VZ
246// these 2 events are the same
247#define wxEVT_COMMAND_TOOL_CLICKED wxEVT_COMMAND_MENU_SELECTED
96f6c703 248
ad0bae85 249// ----------------------------------------------------------------------------
77d4384e 250// Compatibility
ad0bae85
VZ
251// ----------------------------------------------------------------------------
252
253// this event is also used by wxComboBox and wxSpinCtrl which don't include
254// wx/textctrl.h in all ports [yet], so declare it here as well
255//
256// still, any new code using it should include wx/textctrl.h explicitly
ad684023 257extern const wxEventType WXDLLIMPEXP_CORE wxEVT_COMMAND_TEXT_UPDATED;
c801d85f 258
1648d51b
VZ
259// the predefined constants for the number of times we propagate event
260// upwards window child-parent chain
261enum Propagation_state
262{
263 // don't propagate it at all
264 wxEVENT_PROPAGATE_NONE = 0,
265
266 // propagate it until it is processed
267 wxEVENT_PROPAGATE_MAX = INT_MAX
268};
269
c801d85f 270/*
77ffb593 271 * wxWidgets events, covering all interesting things that might happen
c801d85f
KB
272 * (button clicking, resizing, setting text in widgets, etc.).
273 *
274 * For each completely new event type, derive a new event class.
275 * An event CLASS represents a C++ class defining a range of similar event TYPES;
276 * examples are canvas events, panel item command events.
277 * An event TYPE is a unique identifier for a particular system event,
278 * such as a button press or a listbox deselection.
279 *
280 */
281
bddd7a8d 282class WXDLLIMPEXP_BASE wxEvent : public wxObject
c801d85f 283{
e6a6feba
GD
284private:
285 wxEvent& operator=(const wxEvent&);
abcbaea7 286
8e72b8b5
RR
287protected:
288 wxEvent(const wxEvent&); // for implementing Clone()
c801d85f
KB
289
290public:
d9e2e4c2 291 wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL );
2b854a32
VZ
292
293 void SetEventType(wxEventType typ) { m_eventType = typ; }
294 wxEventType GetEventType() const { return m_eventType; }
295 wxObject *GetEventObject() const { return m_eventObject; }
296 void SetEventObject(wxObject *obj) { m_eventObject = obj; }
297 long GetTimestamp() const { return m_timeStamp; }
298 void SetTimestamp(long ts = 0) { m_timeStamp = ts; }
299 int GetId() const { return m_id; }
300 void SetId(int Id) { m_id = Id; }
301
302 // Can instruct event processor that we wish to ignore this event
303 // (treat as if the event table entry had not been found): this must be done
304 // to allow the event processing by the base classes (calling event.Skip()
a0d9c6cb
WS
305 // is the analog of calling the base class version of a virtual function)
306 void Skip(bool skip = true) { m_skipped = skip; }
47b378bd 307 bool GetSkipped() const { return m_skipped; }
c801d85f 308
acd15a3f
VZ
309 // this function is used to create a copy of the event polymorphically and
310 // all derived classes must implement it because otherwise wxPostEvent()
311 // for them wouldn't work (it needs to do a copy of the event)
312 virtual wxEvent *Clone() const = 0;
a737331d 313
87b6002d 314 // Implementation only: this test is explicitly anti OO and this function
1648d51b
VZ
315 // exists only for optimization purposes.
316 bool IsCommandEvent() const { return m_isCommandEvent; }
317
318 // Determine if this event should be propagating to the parent window.
319 bool ShouldPropagate() const
320 { return m_propagationLevel != wxEVENT_PROPAGATE_NONE; }
321
322 // Stop an event from propagating to its parent window, returns the old
323 // propagation level value
324 int StopPropagation()
325 {
326 int propagationLevel = m_propagationLevel;
327 m_propagationLevel = wxEVENT_PROPAGATE_NONE;
328 return propagationLevel;
329 }
330
331 // Resume the event propagation by restoring the propagation level
332 // (returned by StopPropagation())
333 void ResumePropagation(int propagationLevel)
334 {
335 m_propagationLevel = propagationLevel;
336 }
337
b4b76d61 338protected:
2b854a32 339 wxObject* m_eventObject;
2b854a32
VZ
340 wxEventType m_eventType;
341 long m_timeStamp;
342 int m_id;
b4b76d61
KH
343
344public:
345 // m_callbackUserData is for internal usage only
2b854a32 346 wxObject* m_callbackUserData;
1648d51b
VZ
347
348protected:
349 // the propagation level: while it is positive, we propagate the event to
350 // the parent window (if any)
351 //
352 // this one doesn't have to be public, we don't have to worry about
353 // backwards compatibility as it is new
354 int m_propagationLevel;
355
b4b76d61 356protected:
42e69d6b 357 bool m_skipped;
193bf013 358 bool m_isCommandEvent;
1c624631 359
8e72b8b5 360private:
1648d51b 361 // it needs to access our m_propagationLevel
b5dbe15d 362 friend class WXDLLIMPEXP_FWD_BASE wxPropagateOnce;
1648d51b 363
8e72b8b5 364 DECLARE_ABSTRACT_CLASS(wxEvent)
c801d85f
KB
365};
366
1648d51b
VZ
367/*
368 * Helper class to temporarily change an event not to propagate.
369 */
370class WXDLLIMPEXP_BASE wxPropagationDisabler
371{
372public:
373 wxPropagationDisabler(wxEvent& event) : m_event(event)
374 {
375 m_propagationLevelOld = m_event.StopPropagation();
376 }
377
378 ~wxPropagationDisabler()
379 {
380 m_event.ResumePropagation(m_propagationLevelOld);
381 }
382
383private:
384 wxEvent& m_event;
385 int m_propagationLevelOld;
fc7a2a60
VZ
386
387 DECLARE_NO_COPY_CLASS(wxPropagationDisabler)
1648d51b
VZ
388};
389
390/*
391 * Another one to temporarily lower propagation level.
392 */
393class WXDLLIMPEXP_BASE wxPropagateOnce
394{
395public:
396 wxPropagateOnce(wxEvent& event) : m_event(event)
397 {
398 wxASSERT_MSG( m_event.m_propagationLevel > 0,
399 _T("shouldn't be used unless ShouldPropagate()!") );
400
401 m_event.m_propagationLevel--;
402 }
403
404 ~wxPropagateOnce()
405 {
406 m_event.m_propagationLevel++;
407 }
408
409private:
410 wxEvent& m_event;
fc7a2a60
VZ
411
412 DECLARE_NO_COPY_CLASS(wxPropagateOnce)
1648d51b
VZ
413};
414
c4fa5aa7 415
e90c1d2a
VZ
416#if wxUSE_GUI
417
1648d51b 418
c801d85f
KB
419// Item or menu event class
420/*
421 wxEVT_COMMAND_BUTTON_CLICKED
422 wxEVT_COMMAND_CHECKBOX_CLICKED
423 wxEVT_COMMAND_CHOICE_SELECTED
424 wxEVT_COMMAND_LISTBOX_SELECTED
425 wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
426 wxEVT_COMMAND_TEXT_UPDATED
427 wxEVT_COMMAND_TEXT_ENTER
428 wxEVT_COMMAND_MENU_SELECTED
429 wxEVT_COMMAND_SLIDER_UPDATED
430 wxEVT_COMMAND_RADIOBOX_SELECTED
431 wxEVT_COMMAND_RADIOBUTTON_SELECTED
432 wxEVT_COMMAND_SCROLLBAR_UPDATED
433 wxEVT_COMMAND_VLBOX_SELECTED
434 wxEVT_COMMAND_COMBOBOX_SELECTED
1db8dc4a 435 wxEVT_COMMAND_TOGGLEBUTTON_CLICKED
c801d85f
KB
436*/
437
bddd7a8d 438class WXDLLIMPEXP_CORE wxCommandEvent : public wxEvent
c801d85f 439{
2b854a32 440public:
d9e2e4c2 441 wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
c801d85f 442
e6a6feba 443 wxCommandEvent(const wxCommandEvent& event)
497dbbd3 444 : wxEvent(event),
b4b76d61 445 m_cmdString(event.m_cmdString),
497dbbd3
VZ
446 m_commandInt(event.m_commandInt),
447 m_extraLong(event.m_extraLong),
448 m_clientData(event.m_clientData),
449 m_clientObject(event.m_clientObject)
e6a6feba
GD
450 { }
451
2b854a32
VZ
452 // Set/Get client data from controls
453 void SetClientData(void* clientData) { m_clientData = clientData; }
454 void *GetClientData() const { return m_clientData; }
c801d85f 455
2b854a32
VZ
456 // Set/Get client object from controls
457 void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; }
88eadcf2 458 wxClientData *GetClientObject() const { return m_clientObject; }
f5e27805 459
2b854a32
VZ
460 // Get listbox selection if single-choice
461 int GetSelection() const { return m_commandInt; }
c801d85f 462
2b854a32 463 // Set/Get listbox/choice selection string
b4b76d61
KH
464 void SetString(const wxString& s) { m_cmdString = s; }
465 wxString GetString() const;
c801d85f 466
2b854a32 467 // Get checkbox value
3ca6a5f0 468 bool IsChecked() const { return m_commandInt != 0; }
c801d85f 469
a0d9c6cb 470 // true if the listbox event was a selection.
2b854a32 471 bool IsSelection() const { return (m_extraLong != 0); }
c801d85f 472
2b854a32 473 void SetExtraLong(long extraLong) { m_extraLong = extraLong; }
a7bc03c9 474 long GetExtraLong() const { return m_extraLong; }
c801d85f 475
2b854a32 476 void SetInt(int i) { m_commandInt = i; }
fd587c7a 477 int GetInt() const { return m_commandInt; }
c801d85f 478
8e72b8b5 479 virtual wxEvent *Clone() const { return new wxCommandEvent(*this); }
aadbdf11 480
b4b76d61 481protected:
b4b76d61 482 wxString m_cmdString; // String event argument
2b854a32
VZ
483 int m_commandInt;
484 long m_extraLong; // Additional information (e.g. select/deselect)
485 void* m_clientData; // Arbitrary client data
486 wxClientData* m_clientObject; // Arbitrary client object
f97500b8 487
8e72b8b5 488private:
fc7a2a60 489 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCommandEvent)
c801d85f
KB
490};
491
fd3f686c
VZ
492// this class adds a possibility to react (from the user) code to a control
493// notification: allow or veto the operation being reported.
bddd7a8d 494class WXDLLIMPEXP_CORE wxNotifyEvent : public wxCommandEvent
fd3f686c
VZ
495{
496public:
d9e2e4c2
DE
497 wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0)
498 : wxCommandEvent(commandType, winid)
a0d9c6cb 499 { m_bAllow = true; }
e6a6feba
GD
500
501 wxNotifyEvent(const wxNotifyEvent& event)
502 : wxCommandEvent(event)
497dbbd3 503 { m_bAllow = event.m_bAllow; }
fd3f686c 504
23f681ec 505 // veto the operation (usually it's allowed by default)
a0d9c6cb 506 void Veto() { m_bAllow = false; }
fd3f686c 507
23f681ec 508 // allow the operation if it was disabled by default
a0d9c6cb 509 void Allow() { m_bAllow = true; }
23f681ec 510
fd3f686c
VZ
511 // for implementation code only: is the operation allowed?
512 bool IsAllowed() const { return m_bAllow; }
513
8e72b8b5 514 virtual wxEvent *Clone() const { return new wxNotifyEvent(*this); }
924ef850 515
fd3f686c
VZ
516private:
517 bool m_bAllow;
518
8e72b8b5 519private:
fc7a2a60 520 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNotifyEvent)
fd3f686c
VZ
521};
522
d1367c3d 523// Scroll event class, derived form wxCommandEvent. wxScrollEvents are
e8b669d3 524// sent by wxSlider and wxScrollBar.
c801d85f
KB
525/*
526 wxEVT_SCROLL_TOP
527 wxEVT_SCROLL_BOTTOM
528 wxEVT_SCROLL_LINEUP
529 wxEVT_SCROLL_LINEDOWN
530 wxEVT_SCROLL_PAGEUP
531 wxEVT_SCROLL_PAGEDOWN
532 wxEVT_SCROLL_THUMBTRACK
7d56fb8f 533 wxEVT_SCROLL_THUMBRELEASE
cbc85508 534 wxEVT_SCROLL_CHANGED
c801d85f
KB
535*/
536
bddd7a8d 537class WXDLLIMPEXP_CORE wxScrollEvent : public wxCommandEvent
c801d85f 538{
2b854a32
VZ
539public:
540 wxScrollEvent(wxEventType commandType = wxEVT_NULL,
d9e2e4c2 541 int winid = 0, int pos = 0, int orient = 0);
2b854a32 542
a7bc03c9
VZ
543 int GetOrientation() const { return (int) m_extraLong; }
544 int GetPosition() const { return m_commandInt; }
2b854a32
VZ
545 void SetOrientation(int orient) { m_extraLong = (long) orient; }
546 void SetPosition(int pos) { m_commandInt = pos; }
f97500b8 547
8e72b8b5 548 virtual wxEvent *Clone() const { return new wxScrollEvent(*this); }
f97500b8 549
8e72b8b5 550private:
fc7a2a60 551 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollEvent)
c801d85f
KB
552};
553
d1367c3d
RR
554// ScrollWin event class, derived fom wxEvent. wxScrollWinEvents
555// are sent by wxWindow.
556/*
557 wxEVT_SCROLLWIN_TOP
558 wxEVT_SCROLLWIN_BOTTOM
559 wxEVT_SCROLLWIN_LINEUP
560 wxEVT_SCROLLWIN_LINEDOWN
561 wxEVT_SCROLLWIN_PAGEUP
562 wxEVT_SCROLLWIN_PAGEDOWN
563 wxEVT_SCROLLWIN_THUMBTRACK
7d56fb8f 564 wxEVT_SCROLLWIN_THUMBRELEASE
d1367c3d
RR
565*/
566
bddd7a8d 567class WXDLLIMPEXP_CORE wxScrollWinEvent : public wxEvent
d1367c3d 568{
d1367c3d
RR
569public:
570 wxScrollWinEvent(wxEventType commandType = wxEVT_NULL,
571 int pos = 0, int orient = 0);
b2697d42
VZ
572 wxScrollWinEvent(const wxScrollWinEvent & event) : wxEvent(event)
573 { m_commandInt = event.m_commandInt;
574 m_extraLong = event.m_extraLong; }
d1367c3d 575
a7bc03c9
VZ
576 int GetOrientation() const { return (int) m_extraLong; }
577 int GetPosition() const { return m_commandInt; }
d1367c3d
RR
578 void SetOrientation(int orient) { m_extraLong = (long) orient; }
579 void SetPosition(int pos) { m_commandInt = pos; }
580
8e72b8b5 581 virtual wxEvent *Clone() const { return new wxScrollWinEvent(*this); }
1e6feb95 582
b4b76d61 583protected:
8e72b8b5 584 int m_commandInt;
20947e08 585 long m_extraLong;
1e6feb95 586
8e72b8b5 587private:
fc7a2a60 588 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxScrollWinEvent)
d1367c3d
RR
589};
590
c801d85f
KB
591// Mouse event class
592
593/*
594 wxEVT_LEFT_DOWN
595 wxEVT_LEFT_UP
596 wxEVT_MIDDLE_DOWN
597 wxEVT_MIDDLE_UP
598 wxEVT_RIGHT_DOWN
599 wxEVT_RIGHT_UP
600 wxEVT_MOTION
601 wxEVT_ENTER_WINDOW
602 wxEVT_LEAVE_WINDOW
603 wxEVT_LEFT_DCLICK
604 wxEVT_MIDDLE_DCLICK
605 wxEVT_RIGHT_DCLICK
606 wxEVT_NC_LEFT_DOWN
607 wxEVT_NC_LEFT_UP,
608 wxEVT_NC_MIDDLE_DOWN,
609 wxEVT_NC_MIDDLE_UP,
610 wxEVT_NC_RIGHT_DOWN,
611 wxEVT_NC_RIGHT_UP,
612 wxEVT_NC_MOTION,
613 wxEVT_NC_ENTER_WINDOW,
614 wxEVT_NC_LEAVE_WINDOW,
615 wxEVT_NC_LEFT_DCLICK,
616 wxEVT_NC_MIDDLE_DCLICK,
617 wxEVT_NC_RIGHT_DCLICK,
618*/
619
497dbbd3
VZ
620// the symbolic names for the mouse buttons
621enum
622{
623 wxMOUSE_BTN_ANY = -1,
3e89999c
VZ
624 wxMOUSE_BTN_NONE = 0,
625 wxMOUSE_BTN_LEFT = 1,
626 wxMOUSE_BTN_MIDDLE = 2,
01101e2d
VZ
627 wxMOUSE_BTN_RIGHT = 3,
628 wxMOUSE_BTN_AUX1 = 4,
629 wxMOUSE_BTN_AUX2 = 5,
630 wxMOUSE_BTN_MAX
497dbbd3
VZ
631};
632
bddd7a8d 633class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent
c801d85f 634{
2b854a32
VZ
635public:
636 wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
8866abbb 637 wxMouseEvent(const wxMouseEvent& event) : wxEvent(event)
b2697d42 638 { Assign(event); }
c801d85f 639
2b854a32 640 // Was it a button event? (*doesn't* mean: is any button *down*?)
497dbbd3 641 bool IsButton() const { return Button(wxMOUSE_BTN_ANY); }
c801d85f 642
3e89999c 643 // Was it a down event from this (or any) button?
497dbbd3 644 bool ButtonDown(int but = wxMOUSE_BTN_ANY) const;
c801d85f 645
3e89999c 646 // Was it a dclick event from this (or any) button?
497dbbd3 647 bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const;
c801d85f 648
3e89999c 649 // Was it a up event from this (or any) button?
497dbbd3 650 bool ButtonUp(int but = wxMOUSE_BTN_ANY) const;
c801d85f 651
3e89999c 652 // Was the given button?
2b854a32 653 bool Button(int but) const;
c801d85f 654
3e89999c 655 // Was the given button in Down state?
2b854a32 656 bool ButtonIsDown(int but) const;
c801d85f 657
497dbbd3 658 // Get the button which is changing state (wxMOUSE_BTN_NONE if none)
1e6feb95
VZ
659 int GetButton() const;
660
2b854a32
VZ
661 // Find state of shift/control keys
662 bool ControlDown() const { return m_controlDown; }
663 bool MetaDown() const { return m_metaDown; }
664 bool AltDown() const { return m_altDown; }
665 bool ShiftDown() const { return m_shiftDown; }
a2bd1520
VZ
666 bool CmdDown() const
667 {
668#if defined(__WXMAC__) || defined(__WXCOCOA__)
669 return MetaDown();
670#else
671 return ControlDown();
672#endif
673 }
c801d85f 674
2b854a32
VZ
675 // Find which event was just generated
676 bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); }
677 bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); }
678 bool RightDown() const { return (m_eventType == wxEVT_RIGHT_DOWN); }
01101e2d
VZ
679 bool Aux1Down() const { return (m_eventType == wxEVT_AUX1_DOWN); }
680 bool Aux2Down() const { return (m_eventType == wxEVT_AUX2_DOWN); }
c801d85f 681
2b854a32
VZ
682 bool LeftUp() const { return (m_eventType == wxEVT_LEFT_UP); }
683 bool MiddleUp() const { return (m_eventType == wxEVT_MIDDLE_UP); }
684 bool RightUp() const { return (m_eventType == wxEVT_RIGHT_UP); }
01101e2d
VZ
685 bool Aux1Up() const { return (m_eventType == wxEVT_AUX1_UP); }
686 bool Aux2Up() const { return (m_eventType == wxEVT_AUX2_UP); }
c801d85f 687
2b854a32
VZ
688 bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); }
689 bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); }
690 bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); }
01101e2d
VZ
691 bool Aux1DClick() const { return (m_eventType == wxEVT_AUX1_UP); }
692 bool Aux2DClick() const { return (m_eventType == wxEVT_AUX2_UP); }
c801d85f 693
2b854a32
VZ
694 // Find the current state of the mouse buttons (regardless
695 // of current event type)
696 bool LeftIsDown() const { return m_leftDown; }
697 bool MiddleIsDown() const { return m_middleDown; }
698 bool RightIsDown() const { return m_rightDown; }
01101e2d
VZ
699 bool Aux1IsDown() const { return m_aux1Down; }
700 bool Aux2IsDown() const { return m_aux2Down; }
c801d85f 701
2b854a32
VZ
702 // True if a button is down and the mouse is moving
703 bool Dragging() const
704 {
5b66d31a 705 return (m_eventType == wxEVT_MOTION) && ButtonIsDown(wxMOUSE_BTN_ANY);
2b854a32 706 }
c801d85f 707
2b854a32 708 // True if the mouse is moving, and no button is down
6f63704f
VZ
709 bool Moving() const
710 {
5b66d31a 711 return (m_eventType == wxEVT_MOTION) && !ButtonIsDown(wxMOUSE_BTN_ANY);
6f63704f 712 }
c801d85f 713
2b854a32
VZ
714 // True if the mouse is just entering the window
715 bool Entering() const { return (m_eventType == wxEVT_ENTER_WINDOW); }
c801d85f 716
2b854a32
VZ
717 // True if the mouse is just leaving the window
718 bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); }
c801d85f 719
8866abbb
VZ
720 // Returns the number of mouse clicks associated with this event.
721 int GetClickCount() const { return m_clickCount; }
722
723
2b854a32 724 // Find the position of the event
20947e08 725 void GetPosition(wxCoord *xpos, wxCoord *ypos) const
b02da6b1
VZ
726 {
727 if (xpos)
20947e08 728 *xpos = m_x;
b02da6b1
VZ
729 if (ypos)
730 *ypos = m_y;
731 }
732
bf57d1ad 733 void GetPosition(long *xpos, long *ypos) const
b02da6b1
VZ
734 {
735 if (xpos)
20947e08 736 *xpos = (long)m_x;
b02da6b1 737 if (ypos)
bf57d1ad 738 *ypos = (long)m_y;
b02da6b1 739 }
c801d85f 740
2b854a32
VZ
741 // Find the position of the event
742 wxPoint GetPosition() const { return wxPoint(m_x, m_y); }
c801d85f 743
2b854a32 744 // Find the logical position of the event given the DC
a7bc03c9 745 wxPoint GetLogicalPosition(const wxDC& dc) const;
c801d85f 746
2b854a32 747 // Get X position
6cedba09 748 wxCoord GetX() const { return m_x; }
c801d85f 749
2b854a32 750 // Get Y position
6cedba09 751 wxCoord GetY() const { return m_y; }
c801d85f 752
d2c52078
RD
753 // Get wheel rotation, positive or negative indicates direction of
754 // rotation. Current devices all send an event when rotation is equal to
755 // +/-WheelDelta, but this allows for finer resolution devices to be
756 // created in the future. Because of this you shouldn't assume that one
757 // event is equal to 1 line or whatever, but you should be able to either
758 // do partial line scrolling or wait until +/-WheelDelta rotation values
759 // have been accumulated before scrolling.
760 int GetWheelRotation() const { return m_wheelRotation; }
761
762 // Get wheel delta, normally 120. This is the threshold for action to be
763 // taken, and one such action (for example, scrolling one increment)
764 // should occur for each delta.
765 int GetWheelDelta() const { return m_wheelDelta; }
766
aea37008
SC
767 // Gets the axis the wheel operation concerns, 0 being the y axis as on
768 // most mouse wheels, 1 is the x axis for things like MightyMouse scrolls
769 // or horizontal trackpad scrolling
770 int GetWheelAxis() const { return m_wheelAxis; }
771
d2c52078
RD
772 // Returns the configured number of lines (or whatever) to be scrolled per
773 // wheel action. Defaults to one.
774 int GetLinesPerAction() const { return m_linesPerAction; }
aa767a45 775
9b9337da 776 // Is the system set to do page scrolling?
c2bbeff0 777 bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); }
9b9337da 778
8e72b8b5 779 virtual wxEvent *Clone() const { return new wxMouseEvent(*this); }
aadbdf11 780
162e998c 781 wxMouseEvent& operator=(const wxMouseEvent& event) { if (&event != this) Assign(event); return *this; }
c7d176e2 782
c801d85f 783public:
b02da6b1
VZ
784 wxCoord m_x, m_y;
785
2b854a32
VZ
786 bool m_leftDown;
787 bool m_middleDown;
788 bool m_rightDown;
01101e2d
VZ
789 bool m_aux1Down;
790 bool m_aux2Down;
2b854a32
VZ
791
792 bool m_controlDown;
793 bool m_shiftDown;
794 bool m_altDown;
795 bool m_metaDown;
aa767a45 796
8866abbb
VZ
797 int m_clickCount;
798
aea37008 799 int m_wheelAxis;
d2c52078
RD
800 int m_wheelRotation;
801 int m_wheelDelta;
802 int m_linesPerAction;
1e6feb95 803
abcbaea7
VZ
804protected:
805 void Assign(const wxMouseEvent& evt);
806
1e6feb95
VZ
807private:
808 DECLARE_DYNAMIC_CLASS(wxMouseEvent)
c801d85f
KB
809};
810
43b5058d
VZ
811// Cursor set event
812
813/*
814 wxEVT_SET_CURSOR
815 */
816
bddd7a8d 817class WXDLLIMPEXP_CORE wxSetCursorEvent : public wxEvent
43b5058d
VZ
818{
819public:
8e72b8b5 820 wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0)
497dbbd3
VZ
821 : wxEvent(0, wxEVT_SET_CURSOR),
822 m_x(x), m_y(y), m_cursor()
e6a6feba 823 { }
43b5058d 824
b2697d42
VZ
825 wxSetCursorEvent(const wxSetCursorEvent & event)
826 : wxEvent(event),
827 m_x(event.m_x),
828 m_y(event.m_y),
829 m_cursor(event.m_cursor)
830 { }
1d2eddff 831
43b5058d
VZ
832 wxCoord GetX() const { return m_x; }
833 wxCoord GetY() const { return m_y; }
834
835 void SetCursor(const wxCursor& cursor) { m_cursor = cursor; }
836 const wxCursor& GetCursor() const { return m_cursor; }
837 bool HasCursor() const { return m_cursor.Ok(); }
838
8e72b8b5 839 virtual wxEvent *Clone() const { return new wxSetCursorEvent(*this); }
f97500b8 840
43b5058d
VZ
841private:
842 wxCoord m_x, m_y;
843 wxCursor m_cursor;
f97500b8 844
8e72b8b5 845private:
fc7a2a60 846 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSetCursorEvent)
43b5058d
VZ
847};
848
c801d85f
KB
849// Keyboard input event class
850
851/*
852 wxEVT_CHAR
853 wxEVT_CHAR_HOOK
4ce81a75 854 wxEVT_KEY_DOWN
c801d85f 855 wxEVT_KEY_UP
5048c832 856 wxEVT_HOTKEY
c801d85f
KB
857 */
858
bddd7a8d 859class WXDLLIMPEXP_CORE wxKeyEvent : public wxEvent
c801d85f 860{
c801d85f 861public:
2b854a32 862 wxKeyEvent(wxEventType keyType = wxEVT_NULL);
b2697d42 863 wxKeyEvent(const wxKeyEvent& evt);
c801d85f 864
e7102772
VZ
865 // can be used check if the key event has exactly the given modifiers:
866 // "GetModifiers() = wxMOD_CONTROL" is easier to write than "ControlDown()
867 // && !MetaDown() && !AltDown() && !ShiftDown()"
868 int GetModifiers() const
869 {
870 return (m_controlDown ? wxMOD_CONTROL : 0) |
871 (m_shiftDown ? wxMOD_SHIFT : 0) |
872 (m_metaDown ? wxMOD_META : 0) |
873 (m_altDown ? wxMOD_ALT : 0);
874 }
875
2b854a32
VZ
876 // Find state of shift/control keys
877 bool ControlDown() const { return m_controlDown; }
e7102772 878 bool ShiftDown() const { return m_shiftDown; }
2b854a32
VZ
879 bool MetaDown() const { return m_metaDown; }
880 bool AltDown() const { return m_altDown; }
f6bcfd97 881
a2bd1520
VZ
882 // "Cmd" is a pseudo key which is Control for PC and Unix platforms but
883 // Apple ("Command") key under Macs: it makes often sense to use it instead
884 // of, say, ControlDown() because Cmd key is used for the same thing under
885 // Mac as Ctrl elsewhere (but Ctrl still exists, just not used for this
886 // purpose under Mac)
887 bool CmdDown() const
888 {
889#if defined(__WXMAC__) || defined(__WXCOCOA__)
890 return MetaDown();
891#else
892 return ControlDown();
893#endif
894 }
895
d11710cb
VZ
896 // exclude MetaDown() from HasModifiers() because NumLock under X is often
897 // configured as mod2 modifier, yet the key events even when it is pressed
898 // should be processed normally, not like Ctrl- or Alt-key
899 bool HasModifiers() const { return ControlDown() || AltDown(); }
f6bcfd97
BP
900
901 // get the key code: an ASCII7 char or an element of wxKeyCode enum
902 int GetKeyCode() const { return (int)m_keyCode; }
c801d85f 903
a3db5254
VZ
904#if wxUSE_UNICODE
905 // get the Unicode character corresponding to this key
906 wxChar GetUnicodeKey() const { return m_uniChar; }
907#endif // wxUSE_UNICODE
908
9c7df356
VZ
909 // get the raw key code (platform-dependent)
910 wxUint32 GetRawKeyCode() const { return m_rawCode; }
911
912 // get the raw key flags (platform-dependent)
913 wxUint32 GetRawKeyFlags() const { return m_rawFlags; }
914
2b854a32 915 // Find the position of the event
b02da6b1
VZ
916 void GetPosition(wxCoord *xpos, wxCoord *ypos) const
917 {
20947e08 918 if (xpos) *xpos = m_x;
b02da6b1
VZ
919 if (ypos) *ypos = m_y;
920 }
921
bf57d1ad 922 void GetPosition(long *xpos, long *ypos) const
b02da6b1 923 {
20947e08 924 if (xpos) *xpos = (long)m_x;
bf57d1ad 925 if (ypos) *ypos = (long)m_y;
b02da6b1 926 }
803ef874
JS
927
928 wxPoint GetPosition() const
929 { return wxPoint(m_x, m_y); }
c801d85f 930
2b854a32 931 // Get X position
b02da6b1 932 wxCoord GetX() const { return m_x; }
c801d85f 933
2b854a32 934 // Get Y position
b02da6b1 935 wxCoord GetY() const { return m_y; }
c801d85f 936
8e72b8b5 937 virtual wxEvent *Clone() const { return new wxKeyEvent(*this); }
f97500b8
VZ
938
939 // we do need to copy wxKeyEvent sometimes (in wxTreeCtrl code, for
940 // example)
941 wxKeyEvent& operator=(const wxKeyEvent& evt)
942 {
162e998c
PC
943 if (&evt != this)
944 {
945 m_x = evt.m_x;
946 m_y = evt.m_y;
947
948 m_keyCode = evt.m_keyCode;
949
950 m_controlDown = evt.m_controlDown;
951 m_shiftDown = evt.m_shiftDown;
952 m_altDown = evt.m_altDown;
953 m_metaDown = evt.m_metaDown;
954 m_scanCode = evt.m_scanCode;
955 m_rawCode = evt.m_rawCode;
956 m_rawFlags = evt.m_rawFlags;
cedea72f 957#if wxUSE_UNICODE
162e998c 958 m_uniChar = evt.m_uniChar;
cedea72f 959#endif
162e998c 960 }
f97500b8
VZ
961 return *this;
962 }
963
2b854a32 964public:
b02da6b1
VZ
965 wxCoord m_x, m_y;
966
2b854a32 967 long m_keyCode;
b02da6b1 968
e7102772 969 // TODO: replace those with a single m_modifiers bitmask of wxMOD_XXX?
2b854a32
VZ
970 bool m_controlDown;
971 bool m_shiftDown;
972 bool m_altDown;
973 bool m_metaDown;
e7102772
VZ
974
975 // FIXME: what is this for? relation to m_rawXXX?
b0e813a0 976 bool m_scanCode;
f97500b8 977
2b5f62a0
VZ
978#if wxUSE_UNICODE
979 // This contains the full Unicode character
980 // in a character events in Unicode mode
981 wxChar m_uniChar;
982#endif
983
984 // these fields contain the platform-specific information about
985 // key that was pressed
9c7df356
VZ
986 wxUint32 m_rawCode;
987 wxUint32 m_rawFlags;
988
8e72b8b5
RR
989private:
990 DECLARE_DYNAMIC_CLASS(wxKeyEvent)
c801d85f
KB
991};
992
993// Size event class
994/*
995 wxEVT_SIZE
996 */
997
bddd7a8d 998class WXDLLIMPEXP_CORE wxSizeEvent : public wxEvent
c801d85f 999{
2b854a32 1000public:
497dbbd3 1001 wxSizeEvent() : wxEvent(0, wxEVT_SIZE)
e6a6feba 1002 { }
d9e2e4c2
DE
1003 wxSizeEvent(const wxSize& sz, int winid = 0)
1004 : wxEvent(winid, wxEVT_SIZE),
497dbbd3 1005 m_size(sz)
e6a6feba 1006 { }
1d2eddff 1007 wxSizeEvent(const wxSizeEvent & event)
b2697d42 1008 : wxEvent(event),
5706de1c 1009 m_size(event.m_size), m_rect(event.m_rect)
b2697d42 1010 { }
5706de1c 1011 wxSizeEvent(const wxRect& rect, int id = 0)
e00865fa 1012 : m_size(rect.GetSize()), m_rect(rect)
5706de1c 1013 { m_eventType = wxEVT_SIZING; m_id = id; }
c2bbeff0 1014
2b854a32 1015 wxSize GetSize() const { return m_size; }
5706de1c 1016 wxRect GetRect() const { return m_rect; }
fbfb8bcc 1017 void SetRect(const wxRect& rect) { m_rect = rect; }
aadbdf11 1018
8e72b8b5
RR
1019 virtual wxEvent *Clone() const { return new wxSizeEvent(*this); }
1020
1021public:
b4b76d61 1022 // For internal usage only. Will be converted to protected members.
8e72b8b5 1023 wxSize m_size;
5706de1c 1024 wxRect m_rect; // Used for wxEVT_SIZING
8e72b8b5 1025
f97500b8 1026private:
fc7a2a60 1027 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSizeEvent)
c801d85f
KB
1028};
1029
1030// Move event class
1031
1032/*
1033 wxEVT_MOVE
1034 */
1035
bddd7a8d 1036class WXDLLIMPEXP_CORE wxMoveEvent : public wxEvent
c801d85f 1037{
2b854a32 1038public:
e6a6feba
GD
1039 wxMoveEvent()
1040 : wxEvent(0, wxEVT_MOVE)
e6a6feba 1041 { }
d9e2e4c2
DE
1042 wxMoveEvent(const wxPoint& pos, int winid = 0)
1043 : wxEvent(winid, wxEVT_MOVE),
497dbbd3 1044 m_pos(pos)
e6a6feba 1045 { }
1d2eddff
JS
1046 wxMoveEvent(const wxMoveEvent& event)
1047 : wxEvent(event),
b2697d42
VZ
1048 m_pos(event.m_pos)
1049 { }
5706de1c
JS
1050 wxMoveEvent(const wxRect& rect, int id = 0)
1051 : m_pos(rect.GetPosition()), m_rect(rect)
1052 { m_eventType = wxEVT_MOVING; m_id = id; }
c2bbeff0 1053
2b854a32 1054 wxPoint GetPosition() const { return m_pos; }
d7f03cae 1055 void SetPosition(const wxPoint& pos) { m_pos = pos; }
5706de1c 1056 wxRect GetRect() const { return m_rect; }
fbfb8bcc 1057 void SetRect(const wxRect& rect) { m_rect = rect; }
aadbdf11 1058
8e72b8b5 1059 virtual wxEvent *Clone() const { return new wxMoveEvent(*this); }
f97500b8 1060
b4b76d61 1061protected:
8e72b8b5 1062 wxPoint m_pos;
5706de1c 1063 wxRect m_rect;
f97500b8 1064
8e72b8b5 1065private:
fc7a2a60 1066 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMoveEvent)
c801d85f
KB
1067};
1068
1069// Paint event class
1070/*
1071 wxEVT_PAINT
1072 wxEVT_NC_PAINT
1073 wxEVT_PAINT_ICON
1074 */
1075
b078fa02
JS
1076#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__))
1077 // see comments in src/msw|os2/dcclient.cpp where g_isPainting is defined
bddd7a8d 1078 extern WXDLLIMPEXP_CORE int g_isPainting;
edccf428
VZ
1079#endif // debug
1080
bddd7a8d 1081class WXDLLIMPEXP_CORE wxPaintEvent : public wxEvent
c801d85f 1082{
2b854a32 1083public:
edccf428 1084 wxPaintEvent(int Id = 0)
e6a6feba 1085 : wxEvent(Id, wxEVT_PAINT)
edccf428 1086 {
b078fa02 1087#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__))
edccf428
VZ
1088 // set the internal flag for the duration of processing of WM_PAINT
1089 g_isPainting++;
1090#endif // debug
1091 }
1092
4e689ecd
VZ
1093 // default copy ctor and dtor are normally fine, we only need them to keep
1094 // g_isPainting updated in debug build
b078fa02 1095#if defined(__WXDEBUG__) && (defined(__WXMSW__) || defined(__WXPM__))
4e689ecd
VZ
1096 wxPaintEvent(const wxPaintEvent& event)
1097 : wxEvent(event)
1098 {
1099 g_isPainting++;
1100 }
1101
d3c7fc99 1102 virtual ~wxPaintEvent()
edccf428
VZ
1103 {
1104 g_isPainting--;
1105 }
1106#endif // debug
8e72b8b5
RR
1107
1108 virtual wxEvent *Clone() const { return new wxPaintEvent(*this); }
f97500b8 1109
8e72b8b5 1110private:
fc7a2a60 1111 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaintEvent)
c801d85f
KB
1112};
1113
bddd7a8d 1114class WXDLLIMPEXP_CORE wxNcPaintEvent : public wxEvent
1e6feb95
VZ
1115{
1116public:
d9e2e4c2
DE
1117 wxNcPaintEvent(int winid = 0)
1118 : wxEvent(winid, wxEVT_NC_PAINT)
e6a6feba 1119 { }
f97500b8 1120
8e72b8b5 1121 virtual wxEvent *Clone() const { return new wxNcPaintEvent(*this); }
1e6feb95
VZ
1122
1123private:
fc7a2a60 1124 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNcPaintEvent)
1e6feb95
VZ
1125};
1126
c801d85f
KB
1127// Erase background event class
1128/*
1129 wxEVT_ERASE_BACKGROUND
1130 */
1131
bddd7a8d 1132class WXDLLIMPEXP_CORE wxEraseEvent : public wxEvent
c801d85f 1133{
2b854a32 1134public:
2b854a32 1135 wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL)
497dbbd3
VZ
1136 : wxEvent(Id, wxEVT_ERASE_BACKGROUND),
1137 m_dc(dc)
e6a6feba
GD
1138 { }
1139
1140 wxEraseEvent(const wxEraseEvent& event)
497dbbd3
VZ
1141 : wxEvent(event),
1142 m_dc(event.m_dc)
e6a6feba 1143 { }
f97500b8 1144
2b854a32 1145 wxDC *GetDC() const { return m_dc; }
aadbdf11 1146
8e72b8b5 1147 virtual wxEvent *Clone() const { return new wxEraseEvent(*this); }
f97500b8 1148
b4b76d61 1149protected:
8e72b8b5
RR
1150 wxDC *m_dc;
1151
1152private:
fc7a2a60 1153 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxEraseEvent)
c801d85f
KB
1154};
1155
1156// Focus event class
1157/*
1158 wxEVT_SET_FOCUS
1159 wxEVT_KILL_FOCUS
1160 */
1161
bddd7a8d 1162class WXDLLIMPEXP_CORE wxFocusEvent : public wxEvent
c801d85f 1163{
2b854a32 1164public:
d9e2e4c2
DE
1165 wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0)
1166 : wxEvent(winid, type)
497dbbd3 1167 { m_win = NULL; }
e6a6feba
GD
1168
1169 wxFocusEvent(const wxFocusEvent& event)
1170 : wxEvent(event)
497dbbd3 1171 { m_win = event.m_win; }
1e6feb95 1172
8e72b8b5 1173 // The window associated with this event is the window which had focus
1e6feb95 1174 // before for SET event and the window which will have focus for the KILL
8e72b8b5 1175 // one. NB: it may be NULL in both cases!
1e6feb95
VZ
1176 wxWindow *GetWindow() const { return m_win; }
1177 void SetWindow(wxWindow *win) { m_win = win; }
1178
8e72b8b5 1179 virtual wxEvent *Clone() const { return new wxFocusEvent(*this); }
f97500b8 1180
1e6feb95
VZ
1181private:
1182 wxWindow *m_win;
1183
8e72b8b5 1184private:
fc7a2a60 1185 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxFocusEvent)
c801d85f
KB
1186};
1187
456bc6d9 1188// wxChildFocusEvent notifies the parent that a child has got the focus: unlike
1648d51b 1189// wxFocusEvent it is propagated upwards the window chain
bddd7a8d 1190class WXDLLIMPEXP_CORE wxChildFocusEvent : public wxCommandEvent
456bc6d9
VZ
1191{
1192public:
1193 wxChildFocusEvent(wxWindow *win = NULL);
1194
1195 wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
1196
8e72b8b5 1197 virtual wxEvent *Clone() const { return new wxChildFocusEvent(*this); }
f97500b8 1198
8e72b8b5 1199private:
fc7a2a60 1200 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxChildFocusEvent)
456bc6d9
VZ
1201};
1202
c801d85f
KB
1203// Activate event class
1204/*
1205 wxEVT_ACTIVATE
1206 wxEVT_ACTIVATE_APP
afafd942 1207 wxEVT_HIBERNATE
c801d85f
KB
1208 */
1209
bddd7a8d 1210class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent
c801d85f 1211{
2b854a32 1212public:
a0d9c6cb 1213 wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0)
e6a6feba 1214 : wxEvent(Id, type)
497dbbd3 1215 { m_active = active; }
1d2eddff
JS
1216 wxActivateEvent(const wxActivateEvent& event)
1217 : wxEvent(event)
b2697d42 1218 { m_active = event.m_active; }
c2bbeff0 1219
2b854a32 1220 bool GetActive() const { return m_active; }
c801d85f 1221
8e72b8b5 1222 virtual wxEvent *Clone() const { return new wxActivateEvent(*this); }
aadbdf11 1223
2b854a32
VZ
1224private:
1225 bool m_active;
8e72b8b5
RR
1226
1227private:
fc7a2a60 1228 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxActivateEvent)
c801d85f
KB
1229};
1230
1231// InitDialog event class
1232/*
1233 wxEVT_INIT_DIALOG
1234 */
1235
bddd7a8d 1236class WXDLLIMPEXP_CORE wxInitDialogEvent : public wxEvent
c801d85f 1237{
2b854a32
VZ
1238public:
1239 wxInitDialogEvent(int Id = 0)
e6a6feba
GD
1240 : wxEvent(Id, wxEVT_INIT_DIALOG)
1241 { }
8e72b8b5
RR
1242
1243 virtual wxEvent *Clone() const { return new wxInitDialogEvent(*this); }
f97500b8
VZ
1244
1245private:
fc7a2a60 1246 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxInitDialogEvent)
c801d85f
KB
1247};
1248
1249// Miscellaneous menu event class
1250/*
ccef86c7
VZ
1251 wxEVT_MENU_OPEN,
1252 wxEVT_MENU_CLOSE,
c801d85f 1253 wxEVT_MENU_HIGHLIGHT,
c801d85f
KB
1254*/
1255
bddd7a8d 1256class WXDLLIMPEXP_CORE wxMenuEvent : public wxEvent
c801d85f 1257{
c801d85f 1258public:
92f1a59c 1259 wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL)
d9e2e4c2 1260 : wxEvent(winid, type)
fc7a2a60 1261 { m_menuId = winid; m_menu = menu; }
1d2eddff
JS
1262 wxMenuEvent(const wxMenuEvent & event)
1263 : wxEvent(event)
92f1a59c 1264 { m_menuId = event.m_menuId; m_menu = event.m_menu; }
c2bbeff0 1265
ccef86c7 1266 // only for wxEVT_MENU_HIGHLIGHT
aadbdf11 1267 int GetMenuId() const { return m_menuId; }
c801d85f 1268
ccef86c7 1269 // only for wxEVT_MENU_OPEN/CLOSE
1a18887b 1270 bool IsPopup() const { return m_menuId == wxID_ANY; }
ccef86c7 1271
92f1a59c
JS
1272 // only for wxEVT_MENU_OPEN/CLOSE
1273 wxMenu* GetMenu() const { return m_menu; }
1274
8e72b8b5 1275 virtual wxEvent *Clone() const { return new wxMenuEvent(*this); }
f97500b8 1276
2b854a32 1277private:
92f1a59c
JS
1278 int m_menuId;
1279 wxMenu* m_menu;
f97500b8 1280
fc7a2a60 1281 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMenuEvent)
c801d85f
KB
1282};
1283
1284// Window close or session close event class
1285/*
1286 wxEVT_CLOSE_WINDOW,
1287 wxEVT_END_SESSION,
1288 wxEVT_QUERY_END_SESSION
1289 */
1290
bddd7a8d 1291class WXDLLIMPEXP_CORE wxCloseEvent : public wxEvent
c801d85f 1292{
c801d85f 1293public:
d9e2e4c2
DE
1294 wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0)
1295 : wxEvent(winid, type),
a0d9c6cb
WS
1296 m_loggingOff(true),
1297 m_veto(false), // should be false by default
1298 m_canVeto(true) {}
a3bf7524 1299
1d2eddff
JS
1300 wxCloseEvent(const wxCloseEvent & event)
1301 : wxEvent(event),
b2697d42
VZ
1302 m_loggingOff(event.m_loggingOff),
1303 m_veto(event.m_veto),
a3bf7524 1304 m_canVeto(event.m_canVeto) {}
c2bbeff0 1305
2b854a32 1306 void SetLoggingOff(bool logOff) { m_loggingOff = logOff; }
4bcfcdef
VZ
1307 bool GetLoggingOff() const
1308 {
1309 // m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it
1310 // doesn't make sense for wxEVT_CLOSE_WINDOW
1311 wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW,
1312 _T("this flag is for end session events only") );
1313
1314 return m_loggingOff;
1315 }
2b854a32 1316
a0d9c6cb 1317 void Veto(bool veto = true)
fe4e9e6c 1318 {
a0d9c6cb 1319 // GetVeto() will return false anyhow...
fe4e9e6c 1320 wxCHECK_RET( m_canVeto,
223d09f6 1321 wxT("call to Veto() ignored (can't veto this event)") );
fe4e9e6c
VZ
1322
1323 m_veto = veto;
1324 }
2b854a32
VZ
1325 void SetCanVeto(bool canVeto) { m_canVeto = canVeto; }
1326 bool CanVeto() const { return m_canVeto; }
fe4e9e6c 1327 bool GetVeto() const { return m_canVeto && m_veto; }
c801d85f 1328
8e72b8b5 1329 virtual wxEvent *Clone() const { return new wxCloseEvent(*this); }
aadbdf11 1330
2b854a32 1331protected:
4bcfcdef
VZ
1332 bool m_loggingOff,
1333 m_veto,
1334 m_canVeto;
2b854a32 1335
8e72b8b5 1336private:
fc7a2a60 1337 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent)
c801d85f
KB
1338};
1339
1340/*
1341 wxEVT_SHOW
1342 */
1343
bddd7a8d 1344class WXDLLIMPEXP_CORE wxShowEvent : public wxEvent
c801d85f 1345{
c801d85f 1346public:
a0d9c6cb 1347 wxShowEvent(int winid = 0, bool show = false)
d9e2e4c2 1348 : wxEvent(winid, wxEVT_SHOW)
497dbbd3 1349 { m_show = show; }
1d2eddff
JS
1350 wxShowEvent(const wxShowEvent & event)
1351 : wxEvent(event)
b2697d42 1352 { m_show = event.m_show; }
c2bbeff0 1353
2b854a32
VZ
1354 void SetShow(bool show) { m_show = show; }
1355 bool GetShow() const { return m_show; }
c801d85f 1356
8e72b8b5 1357 virtual wxEvent *Clone() const { return new wxShowEvent(*this); }
aadbdf11 1358
c801d85f 1359protected:
2b854a32 1360 bool m_show;
3dd9b88a 1361
8e72b8b5 1362private:
fc7a2a60 1363 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxShowEvent)
c801d85f
KB
1364};
1365
1366/*
1367 wxEVT_ICONIZE
1368 */
1369
bddd7a8d 1370class WXDLLIMPEXP_CORE wxIconizeEvent : public wxEvent
c801d85f 1371{
2b854a32 1372public:
a0d9c6cb 1373 wxIconizeEvent(int winid = 0, bool iconized = true)
d9e2e4c2 1374 : wxEvent(winid, wxEVT_ICONIZE)
497dbbd3 1375 { m_iconized = iconized; }
1d2eddff
JS
1376 wxIconizeEvent(const wxIconizeEvent & event)
1377 : wxEvent(event)
b2697d42 1378 { m_iconized = event.m_iconized; }
c2bbeff0 1379
3dd9b88a
VZ
1380 // return true if the frame was iconized, false if restored
1381 bool Iconized() const { return m_iconized; }
1382
8e72b8b5 1383 virtual wxEvent *Clone() const { return new wxIconizeEvent(*this); }
f97500b8 1384
3dd9b88a
VZ
1385protected:
1386 bool m_iconized;
1387
8e72b8b5 1388private:
fc7a2a60 1389 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIconizeEvent)
c801d85f 1390};
c801d85f
KB
1391/*
1392 wxEVT_MAXIMIZE
1393 */
1394
bddd7a8d 1395class WXDLLIMPEXP_CORE wxMaximizeEvent : public wxEvent
c801d85f 1396{
2b854a32 1397public:
d9e2e4c2
DE
1398 wxMaximizeEvent(int winid = 0)
1399 : wxEvent(winid, wxEVT_MAXIMIZE)
e6a6feba 1400 { }
3dd9b88a 1401
8e72b8b5 1402 virtual wxEvent *Clone() const { return new wxMaximizeEvent(*this); }
f97500b8 1403
8e72b8b5 1404private:
fc7a2a60 1405 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMaximizeEvent)
c801d85f
KB
1406};
1407
1408// Joystick event class
1409/*
1410 wxEVT_JOY_BUTTON_DOWN,
1411 wxEVT_JOY_BUTTON_UP,
1412 wxEVT_JOY_MOVE,
1413 wxEVT_JOY_ZMOVE
1414*/
1415
1416// Which joystick? Same as Windows ids so no conversion necessary.
497dbbd3
VZ
1417enum
1418{
1419 wxJOYSTICK1,
1420 wxJOYSTICK2
1421};
c801d85f
KB
1422
1423// Which button is down?
497dbbd3
VZ
1424enum
1425{
1426 wxJOY_BUTTON_ANY = -1,
1427 wxJOY_BUTTON1 = 1,
1428 wxJOY_BUTTON2 = 2,
1429 wxJOY_BUTTON3 = 4,
1430 wxJOY_BUTTON4 = 8
1431};
c801d85f 1432
bddd7a8d 1433class WXDLLIMPEXP_CORE wxJoystickEvent : public wxEvent
c801d85f 1434{
b4b76d61 1435protected:
2b854a32
VZ
1436 wxPoint m_pos;
1437 int m_zPosition;
497dbbd3
VZ
1438 int m_buttonChange; // Which button changed?
1439 int m_buttonState; // Which buttons are down?
1440 int m_joyStick; // Which joystick?
2b854a32 1441
b4b76d61 1442public:
2b854a32
VZ
1443 wxJoystickEvent(wxEventType type = wxEVT_NULL,
1444 int state = 0,
1445 int joystick = wxJOYSTICK1,
1446 int change = 0)
497dbbd3 1447 : wxEvent(0, type),
8b5d5223 1448 m_pos(),
497dbbd3
VZ
1449 m_zPosition(0),
1450 m_buttonChange(change),
1451 m_buttonState(state),
1452 m_joyStick(joystick)
2b854a32 1453 {
2b854a32 1454 }
1d2eddff 1455 wxJoystickEvent(const wxJoystickEvent & event)
b2697d42
VZ
1456 : wxEvent(event),
1457 m_pos(event.m_pos),
1458 m_zPosition(event.m_zPosition),
1459 m_buttonChange(event.m_buttonChange),
1460 m_buttonState(event.m_buttonState),
1461 m_joyStick(event.m_joyStick)
1d2eddff 1462 { }
c2bbeff0 1463
2b854a32
VZ
1464 wxPoint GetPosition() const { return m_pos; }
1465 int GetZPosition() const { return m_zPosition; }
1466 int GetButtonState() const { return m_buttonState; }
1467 int GetButtonChange() const { return m_buttonChange; }
1468 int GetJoystick() const { return m_joyStick; }
1469
1470 void SetJoystick(int stick) { m_joyStick = stick; }
1471 void SetButtonState(int state) { m_buttonState = state; }
1472 void SetButtonChange(int change) { m_buttonChange = change; }
1473 void SetPosition(const wxPoint& pos) { m_pos = pos; }
1474 void SetZPosition(int zPos) { m_zPosition = zPos; }
1475
1476 // Was it a button event? (*doesn't* mean: is any button *down*?)
1477 bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) ||
b70ababc 1478 (GetEventType() == wxEVT_JOY_BUTTON_UP)); }
2b854a32
VZ
1479
1480 // Was it a move event?
a7bc03c9 1481 bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE); }
2b854a32
VZ
1482
1483 // Was it a zmove event?
a7bc03c9 1484 bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE); }
2b854a32
VZ
1485
1486 // Was it a down event from button 1, 2, 3, 4 or any?
1487 bool ButtonDown(int but = wxJOY_BUTTON_ANY) const
c801d85f 1488 { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) &&
2b854a32 1489 ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
c801d85f 1490
2b854a32
VZ
1491 // Was it a up event from button 1, 2, 3 or any?
1492 bool ButtonUp(int but = wxJOY_BUTTON_ANY) const
c801d85f 1493 { return ((GetEventType() == wxEVT_JOY_BUTTON_UP) &&
2b854a32 1494 ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
c801d85f 1495
2b854a32
VZ
1496 // Was the given button 1,2,3,4 or any in Down state?
1497 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const
c801d85f 1498 { return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) ||
2b854a32 1499 ((m_buttonState & but) == but)); }
f305c661 1500
8e72b8b5 1501 virtual wxEvent *Clone() const { return new wxJoystickEvent(*this); }
f97500b8 1502
8e72b8b5 1503private:
fc7a2a60 1504 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxJoystickEvent)
c801d85f
KB
1505};
1506
1507// Drop files event class
1508/*
1509 wxEVT_DROP_FILES
1510 */
1511
bddd7a8d 1512class WXDLLIMPEXP_CORE wxDropFilesEvent : public wxEvent
c801d85f 1513{
2b854a32
VZ
1514public:
1515 int m_noFiles;
1516 wxPoint m_pos;
c3c39620 1517 wxString* m_files;
2b854a32
VZ
1518
1519 wxDropFilesEvent(wxEventType type = wxEVT_NULL,
1520 int noFiles = 0,
1521 wxString *files = (wxString *) NULL)
497dbbd3
VZ
1522 : wxEvent(0, type),
1523 m_noFiles(noFiles),
1524 m_pos(),
1525 m_files(files)
e6a6feba 1526 { }
2b854a32 1527
c3c39620
VZ
1528 // we need a copy ctor to avoid deleting m_files pointer twice
1529 wxDropFilesEvent(const wxDropFilesEvent& other)
497dbbd3
VZ
1530 : wxEvent(other),
1531 m_noFiles(other.m_noFiles),
1532 m_pos(other.m_pos),
1533 m_files(NULL)
c3c39620 1534 {
c3c39620
VZ
1535 m_files = new wxString[m_noFiles];
1536 for ( int n = 0; n < m_noFiles; n++ )
1537 {
1538 m_files[n] = other.m_files[n];
1539 }
1540 }
1541
1542 virtual ~wxDropFilesEvent()
1543 {
1544 delete [] m_files;
1545 }
1546
2b854a32
VZ
1547 wxPoint GetPosition() const { return m_pos; }
1548 int GetNumberOfFiles() const { return m_noFiles; }
1549 wxString *GetFiles() const { return m_files; }
f305c661 1550
c3c39620 1551 virtual wxEvent *Clone() const { return new wxDropFilesEvent(*this); }
f97500b8 1552
8e72b8b5 1553private:
fc7a2a60 1554 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDropFilesEvent)
c801d85f
KB
1555};
1556
c801d85f
KB
1557// Update UI event
1558/*
1559 wxEVT_UPDATE_UI
1560 */
1561
e39af974
JS
1562// Whether to always send update events to windows, or
1563// to only send update events to those with the
1564// wxWS_EX_PROCESS_UI_UPDATES style.
1565
1566enum wxUpdateUIMode
1567{
1568 // Send UI update events to all windows
1569 wxUPDATE_UI_PROCESS_ALL,
1570
1571 // Send UI update events to windows that have
1572 // the wxWS_EX_PROCESS_UI_UPDATES flag specified
1573 wxUPDATE_UI_PROCESS_SPECIFIED
1574};
1575
bddd7a8d 1576class WXDLLIMPEXP_CORE wxUpdateUIEvent : public wxCommandEvent
c801d85f 1577{
2b854a32
VZ
1578public:
1579 wxUpdateUIEvent(wxWindowID commandId = 0)
e6a6feba 1580 : wxCommandEvent(wxEVT_UPDATE_UI, commandId)
497dbbd3
VZ
1581 {
1582 m_checked =
1583 m_enabled =
a3a4105d 1584 m_shown =
497dbbd3 1585 m_setEnabled =
a3a4105d 1586 m_setShown =
9b9337da 1587 m_setText =
a0d9c6cb 1588 m_setChecked = false;
497dbbd3 1589 }
1d2eddff
JS
1590 wxUpdateUIEvent(const wxUpdateUIEvent & event)
1591 : wxCommandEvent(event),
b2697d42
VZ
1592 m_checked(event.m_checked),
1593 m_enabled(event.m_enabled),
a3a4105d 1594 m_shown(event.m_shown),
b2697d42 1595 m_setEnabled(event.m_setEnabled),
a3a4105d 1596 m_setShown(event.m_setShown),
b2697d42
VZ
1597 m_setText(event.m_setText),
1598 m_setChecked(event.m_setChecked),
1599 m_text(event.m_text)
1600 { }
c2bbeff0 1601
2b854a32
VZ
1602 bool GetChecked() const { return m_checked; }
1603 bool GetEnabled() const { return m_enabled; }
a3a4105d 1604 bool GetShown() const { return m_shown; }
2b854a32
VZ
1605 wxString GetText() const { return m_text; }
1606 bool GetSetText() const { return m_setText; }
1607 bool GetSetChecked() const { return m_setChecked; }
1608 bool GetSetEnabled() const { return m_setEnabled; }
a3a4105d 1609 bool GetSetShown() const { return m_setShown; }
2b854a32 1610
a0d9c6cb
WS
1611 void Check(bool check) { m_checked = check; m_setChecked = true; }
1612 void Enable(bool enable) { m_enabled = enable; m_setEnabled = true; }
a3a4105d 1613 void Show(bool show) { m_shown = show; m_setShown = true; }
a0d9c6cb 1614 void SetText(const wxString& text) { m_text = text; m_setText = true; }
c801d85f 1615
0b30bb0b
JS
1616 // Sets the interval between updates in milliseconds.
1617 // Set to -1 to disable updates, or to 0 to update as frequently as possible.
e39af974 1618 static void SetUpdateInterval(long updateInterval) { sm_updateInterval = updateInterval; }
0b30bb0b
JS
1619
1620 // Returns the current interval between updates in milliseconds
a7bc03c9 1621 static long GetUpdateInterval() { return sm_updateInterval; }
0b30bb0b 1622
e39af974 1623 // Can we update this window?
a7bc03c9 1624 static bool CanUpdate(wxWindowBase *win);
0b30bb0b
JS
1625
1626 // Reset the update time to provide a delay until the next
1627 // time we should update
a7bc03c9 1628 static void ResetUpdateTime();
0b30bb0b 1629
77ffb593 1630 // Specify how wxWidgets will send update events: to
e39af974
JS
1631 // all windows, or only to those which specify that they
1632 // will process the events.
1633 static void SetMode(wxUpdateUIMode mode) { sm_updateMode = mode; }
1634
1635 // Returns the UI update mode
a7bc03c9 1636 static wxUpdateUIMode GetMode() { return sm_updateMode; }
e39af974 1637
8e72b8b5 1638 virtual wxEvent *Clone() const { return new wxUpdateUIEvent(*this); }
f305c661 1639
2b854a32
VZ
1640protected:
1641 bool m_checked;
1642 bool m_enabled;
a3a4105d 1643 bool m_shown;
2b854a32 1644 bool m_setEnabled;
a3a4105d 1645 bool m_setShown;
2b854a32
VZ
1646 bool m_setText;
1647 bool m_setChecked;
1648 wxString m_text;
0b30bb0b 1649#if wxUSE_LONGLONG
e39af974 1650 static wxLongLong sm_lastUpdate;
0b30bb0b 1651#endif
e39af974
JS
1652 static long sm_updateInterval;
1653 static wxUpdateUIMode sm_updateMode;
f97500b8 1654
8e72b8b5 1655private:
fc7a2a60 1656 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxUpdateUIEvent)
c801d85f
KB
1657};
1658
1659/*
1660 wxEVT_SYS_COLOUR_CHANGED
1661 */
1662
1663// TODO: shouldn't all events record the window ID?
bddd7a8d 1664class WXDLLIMPEXP_CORE wxSysColourChangedEvent : public wxEvent
c801d85f 1665{
2b854a32
VZ
1666public:
1667 wxSysColourChangedEvent()
e6a6feba
GD
1668 : wxEvent(0, wxEVT_SYS_COLOUR_CHANGED)
1669 { }
f97500b8 1670
8e72b8b5 1671 virtual wxEvent *Clone() const { return new wxSysColourChangedEvent(*this); }
f97500b8 1672
8e72b8b5 1673private:
fc7a2a60 1674 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSysColourChangedEvent)
c801d85f
KB
1675};
1676
a5e84126
JS
1677/*
1678 wxEVT_MOUSE_CAPTURE_CHANGED
1679 The window losing the capture receives this message
1680 (even if it released the capture itself).
1681 */
1682
bddd7a8d 1683class WXDLLIMPEXP_CORE wxMouseCaptureChangedEvent : public wxEvent
a5e84126
JS
1684{
1685public:
d9e2e4c2
DE
1686 wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL)
1687 : wxEvent(winid, wxEVT_MOUSE_CAPTURE_CHANGED),
497dbbd3 1688 m_gainedCapture(gainedCapture)
e6a6feba
GD
1689 { }
1690
1691 wxMouseCaptureChangedEvent(const wxMouseCaptureChangedEvent& event)
497dbbd3
VZ
1692 : wxEvent(event),
1693 m_gainedCapture(event.m_gainedCapture)
e6a6feba 1694 { }
a5e84126
JS
1695
1696 virtual wxEvent *Clone() const { return new wxMouseCaptureChangedEvent(*this); }
1697
47b378bd 1698 wxWindow* GetCapturedWindow() const { return m_gainedCapture; }
a5e84126
JS
1699
1700private:
1701 wxWindow* m_gainedCapture;
fc7a2a60
VZ
1702
1703 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureChangedEvent)
a5e84126
JS
1704};
1705
63e819f2
VS
1706/*
1707 wxEVT_MOUSE_CAPTURE_LOST
1708 The window losing the capture receives this message, unless it released it
1709 it itself or unless wxWindow::CaptureMouse was called on another window
1710 (and so capture will be restored when the new capturer releases it).
1711 */
1712
1713class WXDLLIMPEXP_CORE wxMouseCaptureLostEvent : public wxEvent
1714{
1715public:
1716 wxMouseCaptureLostEvent(wxWindowID winid = 0)
1717 : wxEvent(winid, wxEVT_MOUSE_CAPTURE_LOST)
1718 {}
1719
1720 wxMouseCaptureLostEvent(const wxMouseCaptureLostEvent& event)
1721 : wxEvent(event)
1722 {}
1723
1724 virtual wxEvent *Clone() const { return new wxMouseCaptureLostEvent(*this); }
1725
1726 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxMouseCaptureLostEvent)
1727};
1728
574c939e
KB
1729/*
1730 wxEVT_DISPLAY_CHANGED
1731 */
bddd7a8d 1732class WXDLLIMPEXP_CORE wxDisplayChangedEvent : public wxEvent
574c939e
KB
1733{
1734private:
fc7a2a60 1735 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxDisplayChangedEvent)
574c939e
KB
1736
1737public:
1738 wxDisplayChangedEvent()
e6a6feba
GD
1739 : wxEvent(0, wxEVT_DISPLAY_CHANGED)
1740 { }
574c939e
KB
1741
1742 virtual wxEvent *Clone() const { return new wxDisplayChangedEvent(*this); }
1743};
1744
f7bd2698
JS
1745/*
1746 wxEVT_PALETTE_CHANGED
1747 */
1748
bddd7a8d 1749class WXDLLIMPEXP_CORE wxPaletteChangedEvent : public wxEvent
f7bd2698 1750{
f7bd2698 1751public:
d9e2e4c2
DE
1752 wxPaletteChangedEvent(wxWindowID winid = 0)
1753 : wxEvent(winid, wxEVT_PALETTE_CHANGED),
497dbbd3
VZ
1754 m_changedWindow((wxWindow *) NULL)
1755 { }
e6a6feba
GD
1756
1757 wxPaletteChangedEvent(const wxPaletteChangedEvent& event)
497dbbd3
VZ
1758 : wxEvent(event),
1759 m_changedWindow(event.m_changedWindow)
e6a6feba 1760 { }
f7bd2698 1761
2b854a32
VZ
1762 void SetChangedWindow(wxWindow* win) { m_changedWindow = win; }
1763 wxWindow* GetChangedWindow() const { return m_changedWindow; }
f7bd2698 1764
8e72b8b5 1765 virtual wxEvent *Clone() const { return new wxPaletteChangedEvent(*this); }
f305c661 1766
f7bd2698 1767protected:
2b854a32 1768 wxWindow* m_changedWindow;
8e72b8b5
RR
1769
1770private:
fc7a2a60 1771 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxPaletteChangedEvent)
f7bd2698
JS
1772};
1773
1774/*
1775 wxEVT_QUERY_NEW_PALETTE
1776 Indicates the window is getting keyboard focus and should re-do its palette.
1777 */
1778
bddd7a8d 1779class WXDLLIMPEXP_CORE wxQueryNewPaletteEvent : public wxEvent
f7bd2698 1780{
f7bd2698 1781public:
d9e2e4c2
DE
1782 wxQueryNewPaletteEvent(wxWindowID winid = 0)
1783 : wxEvent(winid, wxEVT_QUERY_NEW_PALETTE),
a0d9c6cb 1784 m_paletteRealized(false)
e6a6feba 1785 { }
1d2eddff
JS
1786 wxQueryNewPaletteEvent(const wxQueryNewPaletteEvent & event)
1787 : wxEvent(event),
b2697d42
VZ
1788 m_paletteRealized(event.m_paletteRealized)
1789 { }
c2bbeff0 1790
2b854a32
VZ
1791 // App sets this if it changes the palette.
1792 void SetPaletteRealized(bool realized) { m_paletteRealized = realized; }
1793 bool GetPaletteRealized() const { return m_paletteRealized; }
f7bd2698 1794
8e72b8b5 1795 virtual wxEvent *Clone() const { return new wxQueryNewPaletteEvent(*this); }
f305c661 1796
f7bd2698 1797protected:
2b854a32 1798 bool m_paletteRealized;
f97500b8 1799
8e72b8b5 1800private:
fc7a2a60 1801 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxQueryNewPaletteEvent)
f7bd2698
JS
1802};
1803
7fdefd57
VZ
1804/*
1805 Event generated by dialog navigation keys
1806 wxEVT_NAVIGATION_KEY
1807 */
d9506e77 1808// NB: don't derive from command event to avoid being propagated to the parent
bddd7a8d 1809class WXDLLIMPEXP_CORE wxNavigationKeyEvent : public wxEvent
7fdefd57 1810{
7fdefd57 1811public:
d9506e77 1812 wxNavigationKeyEvent()
497dbbd3 1813 : wxEvent(0, wxEVT_NAVIGATION_KEY),
298ca00c 1814 m_flags(IsForward | FromTab), // defaults are for TAB
497dbbd3 1815 m_focus((wxWindow *)NULL)
aef35d0e
VZ
1816 {
1817 m_propagationLevel = wxEVENT_PROPAGATE_NONE;
1818 }
d9506e77 1819
e6a6feba 1820 wxNavigationKeyEvent(const wxNavigationKeyEvent& event)
497dbbd3
VZ
1821 : wxEvent(event),
1822 m_flags(event.m_flags),
1823 m_focus(event.m_focus)
e6a6feba 1824 { }
7fdefd57 1825
2b854a32 1826 // direction: forward (true) or backward (false)
d9506e77
VZ
1827 bool GetDirection() const
1828 { return (m_flags & IsForward) != 0; }
1829 void SetDirection(bool bForward)
1830 { if ( bForward ) m_flags |= IsForward; else m_flags &= ~IsForward; }
7fdefd57 1831
2b854a32
VZ
1832 // it may be a window change event (MDI, notebook pages...) or a control
1833 // change event
d9506e77
VZ
1834 bool IsWindowChange() const
1835 { return (m_flags & WinChange) != 0; }
1836 void SetWindowChange(bool bIs)
1837 { if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; }
1838
298ca00c
VZ
1839 // Set to true under MSW if the event was generated using the tab key.
1840 // This is required for proper navogation over radio buttons
1841 bool IsFromTab() const
1842 { return (m_flags & FromTab) != 0; }
1843 void SetFromTab(bool bIs)
1844 { if ( bIs ) m_flags |= FromTab; else m_flags &= ~FromTab; }
1845
2b854a32
VZ
1846 // the child which has the focus currently (may be NULL - use
1847 // wxWindow::FindFocus then)
d9506e77
VZ
1848 wxWindow* GetCurrentFocus() const { return m_focus; }
1849 void SetCurrentFocus(wxWindow *win) { m_focus = win; }
1850
54a69edf
JS
1851 // Set flags
1852 void SetFlags(long flags) { m_flags = flags; }
1853
8e72b8b5
RR
1854 virtual wxEvent *Clone() const { return new wxNavigationKeyEvent(*this); }
1855
d9506e77
VZ
1856 enum
1857 {
f2de9fee 1858 IsBackward = 0x0000,
d9506e77 1859 IsForward = 0x0001,
298ca00c
VZ
1860 WinChange = 0x0002,
1861 FromTab = 0x0004
d9506e77
VZ
1862 };
1863
1864 long m_flags;
1865 wxWindow *m_focus;
1866
8e72b8b5 1867private:
fc7a2a60 1868 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxNavigationKeyEvent)
7fdefd57
VZ
1869};
1870
42e69d6b
VZ
1871// Window creation/destruction events: the first is sent as soon as window is
1872// created (i.e. the underlying GUI object exists), but when the C++ object is
1873// fully initialized (so virtual functions may be called). The second,
1874// wxEVT_DESTROY, is sent right before the window is destroyed - again, it's
1875// still safe to call virtual functions at this moment
1876/*
1877 wxEVT_CREATE
1878 wxEVT_DESTROY
1879 */
1880
bddd7a8d 1881class WXDLLIMPEXP_CORE wxWindowCreateEvent : public wxCommandEvent
42e69d6b 1882{
42e69d6b
VZ
1883public:
1884 wxWindowCreateEvent(wxWindow *win = NULL);
1885
1886 wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
f97500b8 1887
8e72b8b5 1888 virtual wxEvent *Clone() const { return new wxWindowCreateEvent(*this); }
f97500b8 1889
8e72b8b5 1890private:
fc7a2a60 1891 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowCreateEvent)
42e69d6b
VZ
1892};
1893
bddd7a8d 1894class WXDLLIMPEXP_CORE wxWindowDestroyEvent : public wxCommandEvent
42e69d6b 1895{
42e69d6b
VZ
1896public:
1897 wxWindowDestroyEvent(wxWindow *win = NULL);
1898
1899 wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); }
f97500b8 1900
8e72b8b5
RR
1901 virtual wxEvent *Clone() const { return new wxWindowDestroyEvent(*this); }
1902
1903private:
fc7a2a60 1904 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxWindowDestroyEvent)
42e69d6b
VZ
1905};
1906
bd83cb56 1907// A help event is sent when the user clicks on a window in context-help mode.
b96340e6 1908/*
bd83cb56
VZ
1909 wxEVT_HELP
1910 wxEVT_DETAILED_HELP
1911*/
b96340e6 1912
bddd7a8d 1913class WXDLLIMPEXP_CORE wxHelpEvent : public wxCommandEvent
b96340e6 1914{
b96340e6 1915public:
b107e8d5
VZ
1916 // how was this help event generated?
1917 enum Origin
1918 {
1919 Origin_Unknown, // unrecognized event source
1920 Origin_Keyboard, // event generated from F1 key press
1921 Origin_HelpButton // event from [?] button on the title bar (Windows)
1922 };
1923
bd83cb56 1924 wxHelpEvent(wxEventType type = wxEVT_NULL,
d9e2e4c2 1925 wxWindowID winid = 0,
b107e8d5
VZ
1926 const wxPoint& pt = wxDefaultPosition,
1927 Origin origin = Origin_Unknown)
d9e2e4c2 1928 : wxCommandEvent(type, winid),
b107e8d5
VZ
1929 m_pos(pt),
1930 m_origin(GuessOrigin(origin))
e6a6feba 1931 { }
1d2eddff
JS
1932 wxHelpEvent(const wxHelpEvent & event)
1933 : wxCommandEvent(event),
b2697d42
VZ
1934 m_pos(event.m_pos),
1935 m_target(event.m_target),
b107e8d5
VZ
1936 m_link(event.m_link),
1937 m_origin(event.m_origin)
1d2eddff 1938 { }
c2bbeff0 1939
bd83cb56
VZ
1940 // Position of event (in screen coordinates)
1941 const wxPoint& GetPosition() const { return m_pos; }
1942 void SetPosition(const wxPoint& pos) { m_pos = pos; }
b96340e6 1943
bd83cb56
VZ
1944 // Optional link to further help
1945 const wxString& GetLink() const { return m_link; }
1946 void SetLink(const wxString& link) { m_link = link; }
fb6261e9 1947
bd83cb56
VZ
1948 // Optional target to display help in. E.g. a window specification
1949 const wxString& GetTarget() const { return m_target; }
1950 void SetTarget(const wxString& target) { m_target = target; }
fb6261e9 1951
8e72b8b5 1952 virtual wxEvent *Clone() const { return new wxHelpEvent(*this); }
f97500b8 1953
b107e8d5
VZ
1954 // optional indication of the event source
1955 Origin GetOrigin() const { return m_origin; }
1956 void SetOrigin(Origin origin) { m_origin = origin; }
1957
bd83cb56
VZ
1958protected:
1959 wxPoint m_pos;
1960 wxString m_target;
1961 wxString m_link;
b107e8d5
VZ
1962 Origin m_origin;
1963
1964 // we can try to guess the event origin ourselves, even if none is
1965 // specified in the ctor
1966 static Origin GuessOrigin(Origin origin);
bd83cb56
VZ
1967
1968private:
fc7a2a60 1969 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxHelpEvent)
b96340e6
JS
1970};
1971
78c91815
VZ
1972// A Clipboard Text event is sent when a window intercepts text copy/cut/paste
1973// message, i.e. the user has cut/copied/pasted data from/into a text control
1974// via ctrl-C/X/V, ctrl/shift-del/insert, a popup menu command, etc.
1975// NOTE : under windows these events are *NOT* generated automatically
1976// for a Rich Edit text control.
1977/*
1978wxEVT_COMMAND_TEXT_COPY
1979wxEVT_COMMAND_TEXT_CUT
1980wxEVT_COMMAND_TEXT_PASTE
1981*/
1982
1983class WXDLLIMPEXP_CORE wxClipboardTextEvent : public wxCommandEvent
1984{
1985public:
1986 wxClipboardTextEvent(wxEventType type = wxEVT_NULL,
1987 wxWindowID winid = 0)
1988 : wxCommandEvent(type, winid)
1989 { }
1990 wxClipboardTextEvent(const wxClipboardTextEvent & event)
1991 : wxCommandEvent(event)
1992 { }
1993
1994 virtual wxEvent *Clone() const { return new wxClipboardTextEvent(*this); }
1995
1996private:
1997 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxClipboardTextEvent)
1998};
1999
69231000
JS
2000// A Context event is sent when the user right clicks on a window or
2001// presses Shift-F10
2002// NOTE : Under windows this is a repackaged WM_CONTETXMENU message
2003// Under other systems it may have to be generated from a right click event
2004/*
2005 wxEVT_CONTEXT_MENU
2006*/
2007
bddd7a8d 2008class WXDLLIMPEXP_CORE wxContextMenuEvent : public wxCommandEvent
69231000
JS
2009{
2010public:
2011 wxContextMenuEvent(wxEventType type = wxEVT_NULL,
d9e2e4c2 2012 wxWindowID winid = 0,
e6a6feba 2013 const wxPoint& pt = wxDefaultPosition)
d9e2e4c2 2014 : wxCommandEvent(type, winid),
497dbbd3 2015 m_pos(pt)
e6a6feba 2016 { }
1d2eddff
JS
2017 wxContextMenuEvent(const wxContextMenuEvent & event)
2018 : wxCommandEvent(event),
b2697d42 2019 m_pos(event.m_pos)
1d2eddff 2020 { }
c2bbeff0 2021
69231000
JS
2022 // Position of event (in screen coordinates)
2023 const wxPoint& GetPosition() const { return m_pos; }
2024 void SetPosition(const wxPoint& pos) { m_pos = pos; }
2025
8e72b8b5 2026 virtual wxEvent *Clone() const { return new wxContextMenuEvent(*this); }
f97500b8 2027
69231000
JS
2028protected:
2029 wxPoint m_pos;
2030
2031private:
fc7a2a60 2032 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxContextMenuEvent)
69231000
JS
2033};
2034
b46b1d59
VZ
2035#endif // wxUSE_GUI
2036
e90c1d2a
VZ
2037// Idle event
2038/*
2039 wxEVT_IDLE
2040 */
2041
e39af974
JS
2042// Whether to always send idle events to windows, or
2043// to only send update events to those with the
2044// wxWS_EX_PROCESS_IDLE style.
2045
2046enum wxIdleMode
2047{
2048 // Send idle events to all windows
2049 wxIDLE_PROCESS_ALL,
2050
2051 // Send idle events to windows that have
2052 // the wxWS_EX_PROCESS_IDLE flag specified
2053 wxIDLE_PROCESS_SPECIFIED
2054};
2055
b46b1d59 2056class WXDLLIMPEXP_BASE wxIdleEvent : public wxEvent
e90c1d2a 2057{
e90c1d2a
VZ
2058public:
2059 wxIdleEvent()
497dbbd3 2060 : wxEvent(0, wxEVT_IDLE),
a0d9c6cb 2061 m_requestMore(false)
e6a6feba 2062 { }
1d2eddff
JS
2063 wxIdleEvent(const wxIdleEvent & event)
2064 : wxEvent(event),
b2697d42
VZ
2065 m_requestMore(event.m_requestMore)
2066 { }
c2bbeff0 2067
a0d9c6cb 2068 void RequestMore(bool needMore = true) { m_requestMore = needMore; }
e90c1d2a
VZ
2069 bool MoreRequested() const { return m_requestMore; }
2070
8e72b8b5 2071 virtual wxEvent *Clone() const { return new wxIdleEvent(*this); }
e90c1d2a 2072
77ffb593 2073 // Specify how wxWidgets will send idle events: to
e39af974
JS
2074 // all windows, or only to those which specify that they
2075 // will process the events.
2076 static void SetMode(wxIdleMode mode) { sm_idleMode = mode; }
2077
2078 // Returns the idle event mode
a7bc03c9 2079 static wxIdleMode GetMode() { return sm_idleMode; }
e39af974 2080
e90c1d2a
VZ
2081protected:
2082 bool m_requestMore;
e39af974 2083 static wxIdleMode sm_idleMode;
f97500b8 2084
8e72b8b5 2085private:
fc7a2a60 2086 DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxIdleEvent)
e90c1d2a
VZ
2087};
2088
e5fb7191 2089/* TODO
c801d85f
KB
2090 wxEVT_MOUSE_CAPTURE_CHANGED,
2091 wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
c801d85f
KB
2092// wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate
2093 // wxEVT_FONT_CHANGED to all other windows (maybe).
2094 wxEVT_DRAW_ITEM, // Leave these three as virtual functions in wxControl?? Platform-specific.
2095 wxEVT_MEASURE_ITEM,
2096 wxEVT_COMPARE_ITEM
2097*/
2098
88a9f974 2099
8e193f38
VZ
2100// ============================================================================
2101// event handler and related classes
2102// ============================================================================
2103
d5d51013
VZ
2104// for backwards compatibility and to prevent eVC 4 for ARM from crashing with
2105// internal compiler error when compiling wx, we define wxObjectEventFunction
2106// as a wxObject method even though it can only be a wxEvtHandler one
2107typedef void (wxObject::*wxObjectEventFunction)(wxEvent&);
c801d85f 2108
6164f93c
VZ
2109// struct containing the members common to static and dynamic event tables
2110// entries
bddd7a8d 2111struct WXDLLIMPEXP_BASE wxEventTableEntryBase
77d4384e 2112{
e6a6feba
GD
2113private:
2114 wxEventTableEntryBase& operator=(const wxEventTableEntryBase& event);
abcbaea7 2115
e6a6feba 2116public:
d9e2e4c2 2117 wxEventTableEntryBase(int winid, int idLast,
6164f93c 2118 wxObjectEventFunction fn, wxObject *data)
d9e2e4c2 2119 : m_id(winid),
497dbbd3
VZ
2120 m_lastId(idLast),
2121 m_fn(fn),
2122 m_callbackUserData(data)
e6a6feba
GD
2123 { }
2124
2125 wxEventTableEntryBase(const wxEventTableEntryBase& event)
497dbbd3
VZ
2126 : m_id(event.m_id),
2127 m_lastId(event.m_lastId),
2128 m_fn(event.m_fn),
2129 m_callbackUserData(event.m_callbackUserData)
abcbaea7 2130 { }
6164f93c 2131
497dbbd3
VZ
2132 // the range of ids for this entry: if m_lastId == wxID_ANY, the range
2133 // consists only of m_id, otherwise it is m_id..m_lastId inclusive
2134 int m_id,
2135 m_lastId;
82a5f02c 2136
6164f93c
VZ
2137 // function to call: not wxEventFunction, because of dependency problems
2138 wxObjectEventFunction m_fn;
77d4384e 2139
6164f93c 2140 // arbitrary user data asosciated with the callback
77d4384e
RR
2141 wxObject* m_callbackUserData;
2142};
2143
6164f93c 2144// an entry from a static event table
bddd7a8d 2145struct WXDLLIMPEXP_BASE wxEventTableEntry : public wxEventTableEntryBase
c801d85f 2146{
d9e2e4c2 2147 wxEventTableEntry(const int& evType, int winid, int idLast,
6164f93c 2148 wxObjectEventFunction fn, wxObject *data)
d9e2e4c2 2149 : wxEventTableEntryBase(winid, idLast, fn, data),
e6a6feba
GD
2150 m_eventType(evType)
2151 { }
6164f93c
VZ
2152
2153 // the reference to event type: this allows us to not care about the
2154 // (undefined) order in which the event table entries and the event types
2155 // are initialized: initially the value of this reference might be
2156 // invalid, but by the time it is used for the first time, all global
2157 // objects will have been initialized (including the event type constants)
2158 // and so it will have the correct value when it is needed
2159 const int& m_eventType;
fc7a2a60
VZ
2160
2161private:
2162 wxEventTableEntry& operator=(const wxEventTableEntry&);
6164f93c
VZ
2163};
2164
2165// an entry used in dynamic event table managed by wxEvtHandler::Connect()
bddd7a8d 2166struct WXDLLIMPEXP_BASE wxDynamicEventTableEntry : public wxEventTableEntryBase
6164f93c 2167{
d9e2e4c2 2168 wxDynamicEventTableEntry(int evType, int winid, int idLast,
65b17727 2169 wxObjectEventFunction fn, wxObject *data, wxEvtHandler* eventSink)
d9e2e4c2 2170 : wxEventTableEntryBase(winid, idLast, fn, data),
65b17727
JS
2171 m_eventType(evType),
2172 m_eventSink(eventSink)
e6a6feba 2173 { }
6164f93c
VZ
2174
2175 // not a reference here as we can't keep a reference to a temporary int
2176 // created to wrap the constant value typically passed to Connect() - nor
2177 // do we need it
2178 int m_eventType;
65b17727
JS
2179
2180 // Pointer to object whose function is fn - so we don't assume the
1c624631 2181 // EventFunction is always a member of the EventHandler receiving the
65b17727
JS
2182 // message
2183 wxEvtHandler* m_eventSink;
fc7a2a60
VZ
2184
2185 DECLARE_NO_COPY_CLASS(wxDynamicEventTableEntry)
c801d85f
KB
2186};
2187
2e4df4bf
VZ
2188// ----------------------------------------------------------------------------
2189// wxEventTable: an array of event entries terminated with {0, 0, 0, 0, 0}
2190// ----------------------------------------------------------------------------
886dd7d2 2191
bddd7a8d 2192struct WXDLLIMPEXP_BASE wxEventTable
c801d85f 2193{
0b5eceb6
VZ
2194 const wxEventTable *baseTable; // base event table (next in chain)
2195 const wxEventTableEntry *entries; // bottom of entry array
c801d85f
KB
2196};
2197
b5a98acd
VZ
2198// ----------------------------------------------------------------------------
2199// wxEventHashTable: a helper of wxEvtHandler to speed up wxEventTable lookups.
2200// ----------------------------------------------------------------------------
2201
d5d29b8a 2202WX_DEFINE_ARRAY_PTR(const wxEventTableEntry*, wxEventTableEntryPointerArray);
b5a98acd
VZ
2203
2204class WXDLLIMPEXP_BASE wxEventHashTable
2205{
2206private:
2207 // Internal data structs
2208 struct EventTypeTable
2209 {
2210 wxEventType eventType;
2211 wxEventTableEntryPointerArray eventEntryTable;
2212 };
2213 typedef EventTypeTable* EventTypeTablePointer;
2214
2215public:
2216 // Constructor, needs the event table it needs to hash later on.
1c624631
VZ
2217 // Note: hashing of the event table is not done in the constructor as it
2218 // can be that the event table is not yet full initialize, the hash
b5a98acd
VZ
2219 // will gets initialized when handling the first event look-up request.
2220 wxEventHashTable(const wxEventTable &table);
2221 // Destructor.
2222 ~wxEventHashTable();
2223
1c624631 2224 // Handle the given event, in other words search the event table hash
b5a98acd
VZ
2225 // and call self->ProcessEvent() if a match was found.
2226 bool HandleEvent(wxEvent &event, wxEvtHandler *self);
2227
afa039f9
JS
2228 // Clear table
2229 void Clear();
2230
aa767a45 2231#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING
afa039f9
JS
2232 // Clear all tables
2233 static void ClearAll();
a0826b11 2234#endif // __WXDEBUG__ && wxUSE_MEMORY_TRACING
afa039f9 2235
b5a98acd
VZ
2236protected:
2237 // Init the hash table with the entries of the static event table.
2238 void InitHashTable();
2239 // Helper funtion of InitHashTable() to insert 1 entry into the hash table.
2240 void AddEntry(const wxEventTableEntry &entry);
2241 // Allocate and init with null pointers the base hash table.
2242 void AllocEventTypeTable(size_t size);
1c624631 2243 // Grow the hash table in size and transfer all items currently
b5a98acd
VZ
2244 // in the table to the correct location in the new table.
2245 void GrowEventTypeTable();
2246
2247protected:
2248 const wxEventTable &m_table;
2249 bool m_rebuildHash;
2250
2251 size_t m_size;
2252 EventTypeTablePointer *m_eventTypeTable;
fc7a2a60 2253
afa039f9
JS
2254 static wxEventHashTable* sm_first;
2255 wxEventHashTable* m_previous;
2256 wxEventHashTable* m_next;
2257
fc7a2a60 2258 DECLARE_NO_COPY_CLASS(wxEventHashTable)
b5a98acd
VZ
2259};
2260
2ef989c9
RR
2261// ----------------------------------------------------------------------------
2262// wxEventConnectionRef: A class that represents all connections between two event
2263// handlers and enables automatic disconnect when an event handler sink goes
2264// out of scope. Each connection/disconnect increases/decreases ref count, and
2265// when zero the node goes out of scope.
2266// ----------------------------------------------------------------------------
2267
2268struct wxEventConnectionRef : public wxTrackerNode {
2269
2270 wxEventConnectionRef() : m_src(0), m_sink(0), m_refCount(0) { }
2271 wxEventConnectionRef( wxEvtHandler *src, wxEvtHandler *sink );
2272 virtual ~wxEventConnectionRef();
2273
2274 // The sink is being destroyed
2275 virtual void OnObjectDestroy( );
2276 virtual wxTrackerNodeType GetType( ){ return EventConnectionRef; }
2277
2278 void IncRef( ) { m_refCount++; }
2279 void DecRef( );
2280
2281protected:
2282 wxEvtHandler *m_src, *m_sink;
2283 int m_refCount;
2284
2285 friend class wxEvtHandler;
2286
2287private:
2288 // It makes no sense to copy objects of this class
162e998c 2289 wxEventConnectionRef& operator = (const wxEventConnectionRef& WXUNUSED(other)) { wxFAIL; return *this; }
2ef989c9
RR
2290};
2291
2292
2293
6164f93c 2294// ----------------------------------------------------------------------------
77ffb593 2295// wxEvtHandler: the base class for all objects handling wxWidgets events
6164f93c
VZ
2296// ----------------------------------------------------------------------------
2297
2ef989c9 2298class WXDLLIMPEXP_BASE wxEvtHandler : public wxObject, public wxTrackableBase
c801d85f 2299{
2b854a32
VZ
2300public:
2301 wxEvtHandler();
6164f93c 2302 virtual ~wxEvtHandler();
2b854a32
VZ
2303
2304 wxEvtHandler *GetNextHandler() const { return m_nextHandler; }
2305 wxEvtHandler *GetPreviousHandler() const { return m_previousHandler; }
2306 void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; }
2307 void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; }
2308
8e193f38 2309 void SetEvtHandlerEnabled(bool enabled) { m_enabled = enabled; }
2b854a32
VZ
2310 bool GetEvtHandlerEnabled() const { return m_enabled; }
2311
8e193f38
VZ
2312 // process an event right now
2313 virtual bool ProcessEvent(wxEvent& event);
2b854a32 2314
937013e0
VS
2315 // Process an event by calling ProcessEvent and handling any exceptions
2316 // thrown by event handlers. It's mostly useful when processing wx events
2317 // when called from C code (e.g. in GTK+ callback) when the exception
2318 // wouldn't correctly propagate to wxEventLoop.
2319 bool SafelyProcessEvent(wxEvent& event);
2320
8e193f38 2321 // add an event to be processed later
76bfdc9a 2322 virtual void AddPendingEvent(const wxEvent& event);
2b854a32 2323
8e193f38 2324 void ProcessPendingEvents();
2b854a32 2325
7214297d 2326#if wxUSE_THREADS
76bfdc9a 2327 bool ProcessThreadEvent(const wxEvent& event);
7214297d 2328#endif
2b854a32
VZ
2329
2330 // Dynamic association of a member function handler with the event handler,
d9e2e4c2 2331 // winid and event type
7fa03f04
VZ
2332 void Connect(int winid,
2333 int lastId,
2334 int eventType,
2335 wxObjectEventFunction func,
2336 wxObject *userData = (wxObject *) NULL,
2337 wxEvtHandler *eventSink = (wxEvtHandler *) NULL);
2b854a32
VZ
2338
2339 // Convenience function: take just one id
7fa03f04
VZ
2340 void Connect(int winid,
2341 int eventType,
2342 wxObjectEventFunction func,
2343 wxObject *userData = (wxObject *) NULL,
2344 wxEvtHandler *eventSink = (wxEvtHandler *) NULL)
65b17727 2345 { Connect(winid, wxID_ANY, eventType, func, userData, eventSink); }
2b854a32 2346
7fa03f04
VZ
2347 // Even more convenient: without id (same as using id of wxID_ANY)
2348 void Connect(int eventType,
2349 wxObjectEventFunction func,
2350 wxObject *userData = (wxObject *) NULL,
2351 wxEvtHandler *eventSink = (wxEvtHandler *) NULL)
2352 { Connect(wxID_ANY, wxID_ANY, eventType, func, userData, eventSink); }
2353
2354 bool Disconnect(int winid,
2355 int lastId,
2356 wxEventType eventType,
2357 wxObjectEventFunction func = NULL,
2358 wxObject *userData = (wxObject *) NULL,
2359 wxEvtHandler *eventSink = (wxEvtHandler *) NULL);
2360
e554d626 2361 bool Disconnect(int winid = wxID_ANY,
7fa03f04
VZ
2362 wxEventType eventType = wxEVT_NULL,
2363 wxObjectEventFunction func = NULL,
2364 wxObject *userData = (wxObject *) NULL,
2365 wxEvtHandler *eventSink = (wxEvtHandler *) NULL)
65b17727 2366 { return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); }
98243fed 2367
bdbe28fa 2368 bool Disconnect(wxEventType eventType,
e0685bb0 2369 wxObjectEventFunction func,
bdbe28fa
VZ
2370 wxObject *userData = (wxObject *) NULL,
2371 wxEvtHandler *eventSink = (wxEvtHandler *) NULL)
2372 { return Disconnect(wxID_ANY, eventType, func, userData, eventSink); }
7fa03f04 2373
10da6a8f 2374 wxList* GetDynamicEventTable() const { return m_dynamicEvents ; }
b88c44e7
RD
2375
2376 // User data can be associated with each wxEvtHandler
2377 void SetClientObject( wxClientData *data ) { DoSetClientObject(data); }
2378 wxClientData *GetClientObject() const { return DoGetClientObject(); }
2379
2380 void SetClientData( void *data ) { DoSetClientData(data); }
2381 void *GetClientData() const { return DoGetClientData(); }
2382
1c624631
VZ
2383 // check if the given event table entry matches this event and call the
2384 // handler if it does
2385 //
2386 // return true if the event was processed, false otherwise (no match or the
2387 // handler decided to skip the event)
2388 static bool ProcessEventIfMatches(const wxEventTableEntryBase& tableEntry,
2389 wxEvtHandler *handler,
2390 wxEvent& event);
b88c44e7 2391
8e193f38
VZ
2392 // implementation from now on
2393 virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
2b854a32 2394 bool SearchDynamicEventTable( wxEvent& event );
c801d85f 2395
afa039f9
JS
2396 // Avoid problems at exit by cleaning up static hash table gracefully
2397 void ClearEventHashTable() { GetEventHashTable().Clear(); }
2ef989c9 2398 void OnSinkDestroyed( wxEvtHandler *sink );
afa039f9 2399
c801d85f 2400private:
8e193f38 2401 static const wxEventTableEntry sm_eventTableEntries[];
2b854a32 2402
c801d85f 2403protected:
4caf847c
VZ
2404 // hooks for wxWindow used by ProcessEvent()
2405 // -----------------------------------------
2406
6eabf58c
VS
2407 // This one is called before trying our own event table to allow plugging
2408 // in the validators.
1c624631 2409 //
6eabf58c
VS
2410 // NB: This method is intentionally *not* inside wxUSE_VALIDATORS!
2411 // It is part of wxBase which doesn't use validators and the code
2412 // is compiled out when building wxBase w/o GUI classes, which affects
3103e8a9 2413 // binary compatibility and wxBase library can't be used by GUI
6eabf58c 2414 // ports.
4caf847c 2415 virtual bool TryValidator(wxEvent& WXUNUSED(event)) { return false; }
4caf847c
VZ
2416
2417 // this one is called after failing to find the event handle in our own
2418 // table to give a chance to the other windows to process it
2419 //
2420 // base class implementation passes the event to wxTheApp
2421 virtual bool TryParent(wxEvent& event);
2422
2423
1c624631 2424 static const wxEventTable sm_eventTable;
193bf013
VZ
2425 virtual const wxEventTable *GetEventTable() const;
2426
b5a98acd
VZ
2427 static wxEventHashTable sm_eventHashTable;
2428 virtual wxEventHashTable& GetEventHashTable() const;
2429
63863e09
JS
2430 wxEvtHandler* m_nextHandler;
2431 wxEvtHandler* m_previousHandler;
63863e09 2432 wxList* m_dynamicEvents;
42e69d6b 2433 wxList* m_pendingEvents;
6164f93c 2434
7214297d 2435#if wxUSE_THREADS
8ebec7dc
VZ
2436 // critical section protecting m_pendingEvents
2437 wxCriticalSection m_pendingEventsLock;
2438#endif // wxUSE_THREADS
193bf013 2439
8e193f38
VZ
2440 // Is event handler enabled?
2441 bool m_enabled;
6164f93c 2442
b88c44e7
RD
2443
2444 // The user data: either an object which will be deleted by the container
2445 // when it's deleted or some raw pointer which we do nothing with - only
2446 // one type of data can be used with the given window (i.e. you cannot set
2447 // the void data and then associate the container with wxClientData or vice
2448 // versa)
2449 union
2450 {
2451 wxClientData *m_clientObject;
2452 void *m_clientData;
2453 };
2454
2455 // what kind of data do we have?
2456 wxClientDataType m_clientDataType;
2457
2458 // client data accessors
2459 virtual void DoSetClientObject( wxClientData *data );
2460 virtual wxClientData *DoGetClientObject() const;
2461
2462 virtual void DoSetClientData( void *data );
2463 virtual void *DoGetClientData() const;
2464
2ef989c9
RR
2465 // Search tracker objects for event connection with this sink
2466 wxEventConnectionRef *FindRefInTrackerList( wxEvtHandler *eventSink );
2467
6164f93c 2468private:
fc7a2a60 2469 DECLARE_DYNAMIC_CLASS_NO_COPY(wxEvtHandler)
c801d85f
KB
2470};
2471
e2478fde
VZ
2472// Post a message to the given eventhandler which will be processed during the
2473// next event loop iteration
76bfdc9a 2474inline void wxPostEvent(wxEvtHandler *dest, const wxEvent& event)
e2478fde
VZ
2475{
2476 wxCHECK_RET( dest, wxT("need an object to post event to in wxPostEvent") );
2477
2478 dest->AddPendingEvent(event);
2479}
2480
96d38c7e
VS
2481typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
2482
7fa03f04
VZ
2483#define wxEventHandler(func) \
2484 (wxObjectEventFunction)wxStaticCastEvent(wxEventFunction, &func)
2485
e90c1d2a 2486#if wxUSE_GUI
7fa03f04 2487
c4fa5aa7
VZ
2488// ----------------------------------------------------------------------------
2489// wxEventBlocker: helper class to temporarily disable event handling for a window
2490// ----------------------------------------------------------------------------
2491
b483f5fe 2492class WXDLLIMPEXP_CORE wxEventBlocker : public wxEvtHandler
c4fa5aa7
VZ
2493{
2494public:
2495 wxEventBlocker(wxWindow *win, wxEventType type = wxEVT_ANY);
2496 virtual ~wxEventBlocker();
2497
2498 void Block(wxEventType type)
2499 {
2500 m_eventsToBlock.push_back(type);
2501 }
2502
2503 virtual bool ProcessEvent(wxEvent& event);
2504
2505protected:
2506 wxArrayInt m_eventsToBlock;
2507 wxWindow *m_window;
2508
2509 DECLARE_NO_COPY_CLASS(wxEventBlocker)
2510};
2511
c801d85f
KB
2512typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&);
2513typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&);
c5b42c87 2514typedef void (wxEvtHandler::*wxScrollWinEventFunction)(wxScrollWinEvent&);
c801d85f
KB
2515typedef void (wxEvtHandler::*wxSizeEventFunction)(wxSizeEvent&);
2516typedef void (wxEvtHandler::*wxMoveEventFunction)(wxMoveEvent&);
2517typedef void (wxEvtHandler::*wxPaintEventFunction)(wxPaintEvent&);
7309deea 2518typedef void (wxEvtHandler::*wxNcPaintEventFunction)(wxNcPaintEvent&);
c801d85f
KB
2519typedef void (wxEvtHandler::*wxEraseEventFunction)(wxEraseEvent&);
2520typedef void (wxEvtHandler::*wxMouseEventFunction)(wxMouseEvent&);
2521typedef void (wxEvtHandler::*wxCharEventFunction)(wxKeyEvent&);
2522typedef void (wxEvtHandler::*wxFocusEventFunction)(wxFocusEvent&);
456bc6d9 2523typedef void (wxEvtHandler::*wxChildFocusEventFunction)(wxChildFocusEvent&);
c801d85f
KB
2524typedef void (wxEvtHandler::*wxActivateEventFunction)(wxActivateEvent&);
2525typedef void (wxEvtHandler::*wxMenuEventFunction)(wxMenuEvent&);
2526typedef void (wxEvtHandler::*wxJoystickEventFunction)(wxJoystickEvent&);
2527typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&);
2528typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&);
7fa03f04
VZ
2529typedef void (wxEvtHandler::*wxSysColourChangedEventFunction)(wxSysColourChangedEvent&);
2530typedef void (wxEvtHandler::*wxDisplayChangedEventFunction)(wxDisplayChangedEvent&);
c801d85f
KB
2531typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&);
2532typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&);
2533typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&);
2534typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&);
9bc13858 2535typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxIconizeEvent&);
98e78a5e 2536typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxMaximizeEvent&);
81d66cf3 2537typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&);
f7bd2698
JS
2538typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&);
2539typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&);
43b5058d
VZ
2540typedef void (wxEvtHandler::*wxWindowCreateEventFunction)(wxWindowCreateEvent&);
2541typedef void (wxEvtHandler::*wxWindowDestroyEventFunction)(wxWindowDestroyEvent&);
2542typedef void (wxEvtHandler::*wxSetCursorEventFunction)(wxSetCursorEvent&);
669f7a11 2543typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&);
b96340e6 2544typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&);
69231000 2545typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&);
a5e84126 2546typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureChangedEvent&);
63e819f2 2547typedef void (wxEvtHandler::*wxMouseCaptureLostEventFunction)(wxMouseCaptureLostEvent&);
78c91815 2548typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent&);
7fa03f04 2549
7fa03f04
VZ
2550
2551#define wxCommandEventHandler(func) \
8bc3ec1f 2552 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &func)
7fa03f04 2553#define wxScrollEventHandler(func) \
8bc3ec1f 2554 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollEventFunction, &func)
7fa03f04 2555#define wxScrollWinEventHandler(func) \
8bc3ec1f 2556 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollWinEventFunction, &func)
7fa03f04 2557#define wxSizeEventHandler(func) \
8bc3ec1f 2558 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSizeEventFunction, &func)
7fa03f04 2559#define wxMoveEventHandler(func) \
8bc3ec1f 2560 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMoveEventFunction, &func)
7fa03f04 2561#define wxPaintEventHandler(func) \
8bc3ec1f 2562 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaintEventFunction, &func)
7fa03f04 2563#define wxNcPaintEventHandler(func) \
8bc3ec1f 2564 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNcPaintEventFunction, &func)
7fa03f04 2565#define wxEraseEventHandler(func) \
8bc3ec1f 2566 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxEraseEventFunction, &func)
7fa03f04 2567#define wxMouseEventHandler(func) \
8bc3ec1f 2568 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseEventFunction, &func)
7fa03f04 2569#define wxCharEventHandler(func) \
8bc3ec1f 2570 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCharEventFunction, &func)
7fa03f04
VZ
2571#define wxKeyEventHandler(func) wxCharEventHandler(func)
2572#define wxFocusEventHandler(func) \
8bc3ec1f 2573 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFocusEventFunction, &func)
7fa03f04 2574#define wxChildFocusEventHandler(func) \
8bc3ec1f 2575 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChildFocusEventFunction, &func)
7fa03f04 2576#define wxActivateEventHandler(func) \
8bc3ec1f 2577 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxActivateEventFunction, &func)
7fa03f04 2578#define wxMenuEventHandler(func) \
8bc3ec1f 2579 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMenuEventFunction, &func)
7fa03f04 2580#define wxJoystickEventHandler(func) \
8bc3ec1f 2581 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxJoystickEventFunction, &func)
7fa03f04 2582#define wxDropFilesEventHandler(func) \
8bc3ec1f 2583 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDropFilesEventFunction, &func)
7fa03f04 2584#define wxInitDialogEventHandler(func) \
8bc3ec1f 2585 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxInitDialogEventFunction, &func)
7fa03f04 2586#define wxSysColourChangedEventHandler(func) \
8bc3ec1f 2587 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSysColourChangedEventFunction, &func)
7fa03f04 2588#define wxDisplayChangedEventHandler(func) \
8bc3ec1f 2589 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDisplayChangedEventFunction, &func)
7fa03f04 2590#define wxUpdateUIEventHandler(func) \
8bc3ec1f 2591 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxUpdateUIEventFunction, &func)
7fa03f04 2592#define wxIdleEventHandler(func) \
8bc3ec1f 2593 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIdleEventFunction, &func)
7fa03f04 2594#define wxCloseEventHandler(func) \
8bc3ec1f 2595 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCloseEventFunction, &func)
7fa03f04 2596#define wxShowEventHandler(func) \
8bc3ec1f 2597 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxShowEventFunction, &func)
7fa03f04 2598#define wxIconizeEventHandler(func) \
8bc3ec1f 2599 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIconizeEventFunction, &func)
7fa03f04 2600#define wxMaximizeEventHandler(func) \
8bc3ec1f 2601 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMaximizeEventFunction, &func)
7fa03f04 2602#define wxNavigationKeyEventHandler(func) \
8bc3ec1f 2603 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNavigationKeyEventFunction, &func)
7fa03f04 2604#define wxPaletteChangedEventHandler(func) \
8bc3ec1f 2605 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaletteChangedEventFunction, &func)
7fa03f04 2606#define wxQueryNewPaletteEventHandler(func) \
8bc3ec1f 2607 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxQueryNewPaletteEventFunction, &func)
7fa03f04 2608#define wxWindowCreateEventHandler(func) \
8bc3ec1f 2609 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowCreateEventFunction, &func)
7fa03f04 2610#define wxWindowDestroyEventHandler(func) \
8bc3ec1f 2611 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowDestroyEventFunction, &func)
7fa03f04 2612#define wxSetCursorEventHandler(func) \
8bc3ec1f 2613 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSetCursorEventFunction, &func)
7fa03f04 2614#define wxNotifyEventHandler(func) \
8bc3ec1f 2615 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNotifyEventFunction, &func)
7fa03f04 2616#define wxHelpEventHandler(func) \
8bc3ec1f 2617 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxHelpEventFunction, &func)
7fa03f04 2618#define wxContextMenuEventHandler(func) \
8bc3ec1f 2619 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxContextMenuEventFunction, &func)
7fa03f04 2620#define wxMouseCaptureChangedEventHandler(func) \
8bc3ec1f 2621 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureChangedEventFunction, &func)
63e819f2
VS
2622#define wxMouseCaptureLostEventHandler(func) \
2623 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureLostEventFunction, &func)
78c91815
VZ
2624#define wxClipboardTextEventHandler(func) \
2625 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxClipboardTextEventFunction, &func)
7fa03f04 2626
e90c1d2a 2627#endif // wxUSE_GUI
c801d85f
KB
2628
2629// N.B. In GNU-WIN32, you *have* to take the address of a member function
2630// (use &) or the compiler crashes...
2631
2632#define DECLARE_EVENT_TABLE() \
2e4df4bf
VZ
2633 private: \
2634 static const wxEventTableEntry sm_eventTableEntries[]; \
2635 protected: \
2636 static const wxEventTable sm_eventTable; \
b5a98acd
VZ
2637 virtual const wxEventTable* GetEventTable() const; \
2638 static wxEventHashTable sm_eventHashTable; \
2639 virtual wxEventHashTable& GetEventHashTable() const;
c801d85f 2640
48276300
VZ
2641// N.B.: when building DLL with Borland C++ 5.5 compiler, you must initialize
2642// sm_eventTable before using it in GetEventTable() or the compiler gives
2643// E2233 (see http://groups.google.com/groups?selm=397dcc8a%241_2%40dnews)
b5a98acd 2644
c801d85f 2645#define BEGIN_EVENT_TABLE(theClass, baseClass) \
2e4df4bf
VZ
2646 const wxEventTable theClass::sm_eventTable = \
2647 { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] }; \
48276300
VZ
2648 const wxEventTable *theClass::GetEventTable() const \
2649 { return &theClass::sm_eventTable; } \
b5a98acd
VZ
2650 wxEventHashTable theClass::sm_eventHashTable(theClass::sm_eventTable); \
2651 wxEventHashTable &theClass::GetEventHashTable() const \
2652 { return theClass::sm_eventHashTable; } \
2e4df4bf 2653 const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
c801d85f 2654
f96a9d34
JS
2655#define BEGIN_EVENT_TABLE_TEMPLATE1(theClass, baseClass, T1) \
2656 template<typename T1> \
2657 const wxEventTable theClass<T1>::sm_eventTable = \
2658 { &baseClass::sm_eventTable, &theClass<T1>::sm_eventTableEntries[0] }; \
2659 template<typename T1> \
2660 const wxEventTable *theClass<T1>::GetEventTable() const \
2661 { return &theClass<T1>::sm_eventTable; } \
2662 template<typename T1> \
2663 wxEventHashTable theClass<T1>::sm_eventHashTable(theClass<T1>::sm_eventTable); \
2664 template<typename T1> \
2665 wxEventHashTable &theClass<T1>::GetEventHashTable() const \
2666 { return theClass<T1>::sm_eventHashTable; } \
2667 template<typename T1> \
2668 const wxEventTableEntry theClass<T1>::sm_eventTableEntries[] = { \
2669
2670#define BEGIN_EVENT_TABLE_TEMPLATE2(theClass, baseClass, T1, T2) \
2671 template<typename T1, typename T2> \
2672 const wxEventTable theClass<T1, T2>::sm_eventTable = \
2673 { &baseClass::sm_eventTable, &theClass<T1, T2>::sm_eventTableEntries[0] }; \
2674 template<typename T1, typename T2> \
2675 const wxEventTable *theClass<T1, T2>::GetEventTable() const \
2676 { return &theClass<T1, T2>::sm_eventTable; } \
2677 template<typename T1, typename T2> \
2678 wxEventHashTable theClass<T1, T2>::sm_eventHashTable(theClass<T1, T2>::sm_eventTable); \
2679 template<typename T1, typename T2> \
2680 wxEventHashTable &theClass<T1, T2>::GetEventHashTable() const \
2681 { return theClass<T1, T2>::sm_eventHashTable; } \
2682 template<typename T1, typename T2> \
2683 const wxEventTableEntry theClass<T1, T2>::sm_eventTableEntries[] = { \
2684
2685#define BEGIN_EVENT_TABLE_TEMPLATE3(theClass, baseClass, T1, T2, T3) \
2686 template<typename T1, typename T2, typename T3> \
2687 const wxEventTable theClass<T1, T2, T3>::sm_eventTable = \
2688 { &baseClass::sm_eventTable, &theClass<T1, T2, T3>::sm_eventTableEntries[0] }; \
2689 template<typename T1, typename T2, typename T3> \
2690 const wxEventTable *theClass<T1, T2, T3>::GetEventTable() const \
2691 { return &theClass<T1, T2, T3>::sm_eventTable; } \
2692 template<typename T1, typename T2, typename T3> \
2693 wxEventHashTable theClass<T1, T2, T3>::sm_eventHashTable(theClass<T1, T2, T3>::sm_eventTable); \
2694 template<typename T1, typename T2, typename T3> \
2695 wxEventHashTable &theClass<T1, T2, T3>::GetEventHashTable() const \
2696 { return theClass<T1, T2, T3>::sm_eventHashTable; } \
2697 template<typename T1, typename T2, typename T3> \
2698 const wxEventTableEntry theClass<T1, T2, T3>::sm_eventTableEntries[] = { \
2699
2700#define BEGIN_EVENT_TABLE_TEMPLATE4(theClass, baseClass, T1, T2, T3, T4) \
2701 template<typename T1, typename T2, typename T3, typename T4> \
2702 const wxEventTable theClass<T1, T2, T3, T4>::sm_eventTable = \
2703 { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4>::sm_eventTableEntries[0] }; \
2704 template<typename T1, typename T2, typename T3, typename T4> \
2705 const wxEventTable *theClass<T1, T2, T3, T4>::GetEventTable() const \
2706 { return &theClass<T1, T2, T3, T4>::sm_eventTable; } \
2707 template<typename T1, typename T2, typename T3, typename T4> \
2708 wxEventHashTable theClass<T1, T2, T3, T4>::sm_eventHashTable(theClass<T1, T2, T3, T4>::sm_eventTable); \
2709 template<typename T1, typename T2, typename T3, typename T4> \
2710 wxEventHashTable &theClass<T1, T2, T3, T4>::GetEventHashTable() const \
2711 { return theClass<T1, T2, T3, T4>::sm_eventHashTable; } \
2712 template<typename T1, typename T2, typename T3, typename T4> \
2713 const wxEventTableEntry theClass<T1, T2, T3, T4>::sm_eventTableEntries[] = { \
2714
2715#define BEGIN_EVENT_TABLE_TEMPLATE5(theClass, baseClass, T1, T2, T3, T4, T5) \
2716 template<typename T1, typename T2, typename T3, typename T4, typename T5> \
2717 const wxEventTable theClass<T1, T2, T3, T4, T5>::sm_eventTable = \
2718 { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5>::sm_eventTableEntries[0] }; \
2719 template<typename T1, typename T2, typename T3, typename T4, typename T5> \
2720 const wxEventTable *theClass<T1, T2, T3, T4, T5>::GetEventTable() const \
2721 { return &theClass<T1, T2, T3, T4, T5>::sm_eventTable; } \
2722 template<typename T1, typename T2, typename T3, typename T4, typename T5> \
2723 wxEventHashTable theClass<T1, T2, T3, T4, T5>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5>::sm_eventTable); \
2724 template<typename T1, typename T2, typename T3, typename T4, typename T5> \
2725 wxEventHashTable &theClass<T1, T2, T3, T4, T5>::GetEventHashTable() const \
2726 { return theClass<T1, T2, T3, T4, T5>::sm_eventHashTable; } \
2727 template<typename T1, typename T2, typename T3, typename T4, typename T5> \
2728 const wxEventTableEntry theClass<T1, T2, T3, T4, T5>::sm_eventTableEntries[] = { \
2729
2730#define BEGIN_EVENT_TABLE_TEMPLATE7(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7) \
2731 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
2732 const wxEventTable theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable = \
2733 { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTableEntries[0] }; \
2734 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
2735 const wxEventTable *theClass<T1, T2, T3, T4, T5, T6, T7>::GetEventTable() const \
2736 { return &theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable; } \
2737 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
2738 wxEventHashTable theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTable); \
2739 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
2740 wxEventHashTable &theClass<T1, T2, T3, T4, T5, T6, T7>::GetEventHashTable() const \
2741 { return theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventHashTable; } \
2742 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> \
2743 const wxEventTableEntry theClass<T1, T2, T3, T4, T5, T6, T7>::sm_eventTableEntries[] = { \
2744
2745#define BEGIN_EVENT_TABLE_TEMPLATE8(theClass, baseClass, T1, T2, T3, T4, T5, T6, T7, T8) \
2746 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
2747 const wxEventTable theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable = \
2748 { &baseClass::sm_eventTable, &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTableEntries[0] }; \
2749 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
2750 const wxEventTable *theClass<T1, T2, T3, T4, T5, T6, T7, T8>::GetEventTable() const \
2751 { return &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable; } \
2752 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
2753 wxEventHashTable theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventHashTable(theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTable); \
2754 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
2755 wxEventHashTable &theClass<T1, T2, T3, T4, T5, T6, T7, T8>::GetEventHashTable() const \
2756 { return theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventHashTable; } \
2757 template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8> \
2758 const wxEventTableEntry theClass<T1, T2, T3, T4, T5, T6, T7, T8>::sm_eventTableEntries[] = { \
2759
33e29419 2760#define END_EVENT_TABLE() DECLARE_EVENT_TABLE_ENTRY( wxEVT_NULL, 0, 0, 0, 0 ) };
2b854a32 2761
c801d85f
KB
2762/*
2763 * Event table macros
2764 */
2765
7fa03f04
VZ
2766// helpers for writing shorter code below: declare an event macro taking 2, 1
2767// or none ids (the missing ids default to wxID_ANY)
2768//
2769// macro arguments:
2770// - evt one of wxEVT_XXX constants
2771// - id1, id2 ids of the first/last id
2772// - fn the function (should be cast to the right type)
2773#define wx__DECLARE_EVT2(evt, id1, id2, fn) \
2774 DECLARE_EVENT_TABLE_ENTRY(evt, id1, id2, fn, NULL),
2775#define wx__DECLARE_EVT1(evt, id, fn) \
2776 wx__DECLARE_EVT2(evt, id, wxID_ANY, fn)
2777#define wx__DECLARE_EVT0(evt, fn) \
2778 wx__DECLARE_EVT1(evt, wxID_ANY, fn)
2779
2780
c801d85f 2781// Generic events
7fa03f04
VZ
2782#define EVT_CUSTOM(event, winid, func) \
2783 wx__DECLARE_EVT1(event, winid, wxEventHandler(func))
2784#define EVT_CUSTOM_RANGE(event, id1, id2, func) \
2785 wx__DECLARE_EVT2(event, id1, id2, wxEventHandler(func))
c801d85f 2786
265accbe 2787// EVT_COMMAND
96eb51bb 2788#define EVT_COMMAND(winid, event, func) \
7fa03f04 2789 wx__DECLARE_EVT1(event, winid, wxCommandEventHandler(func))
96eb51bb 2790#define EVT_COMMAND_RANGE(id1, id2, event, func) \
7fa03f04 2791 wx__DECLARE_EVT2(event, id1, id2, wxCommandEventHandler(func))
265accbe 2792
7fa03f04
VZ
2793#define EVT_NOTIFY(event, winid, func) \
2794 wx__DECLARE_EVT1(event, winid, wxNotifyEventHandler(func))
2795#define EVT_NOTIFY_RANGE(event, id1, id2, func) \
2796 wx__DECLARE_EVT2(event, id1, id2, wxNotifyEventHandler(func))
265accbe 2797
c801d85f 2798// Miscellaneous
7fa03f04
VZ
2799#define EVT_SIZE(func) wx__DECLARE_EVT0(wxEVT_SIZE, wxSizeEventHandler(func))
2800#define EVT_SIZING(func) wx__DECLARE_EVT0(wxEVT_SIZING, wxSizeEventHandler(func))
2801#define EVT_MOVE(func) wx__DECLARE_EVT0(wxEVT_MOVE, wxMoveEventHandler(func))
2802#define EVT_MOVING(func) wx__DECLARE_EVT0(wxEVT_MOVING, wxMoveEventHandler(func))
aa767a45
JS
2803#define EVT_MOVE_START(func) wx__DECLARE_EVT0(wxEVT_MOVE_START, wxMoveEventHandler(func))
2804#define EVT_MOVE_END(func) wx__DECLARE_EVT0(wxEVT_MOVE_END, wxMoveEventHandler(func))
7fa03f04
VZ
2805#define EVT_CLOSE(func) wx__DECLARE_EVT0(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(func))
2806#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
2807#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
2808#define EVT_PAINT(func) wx__DECLARE_EVT0(wxEVT_PAINT, wxPaintEventHandler(func))
2809#define EVT_NC_PAINT(func) wx__DECLARE_EVT0(wxEVT_NC_PAINT, wxNcPaintEventHandler(func))
2810#define EVT_ERASE_BACKGROUND(func) wx__DECLARE_EVT0(wxEVT_ERASE_BACKGROUND, wxEraseEventHandler(func))
2811#define EVT_CHAR(func) wx__DECLARE_EVT0(wxEVT_CHAR, wxCharEventHandler(func))
2812#define EVT_KEY_DOWN(func) wx__DECLARE_EVT0(wxEVT_KEY_DOWN, wxKeyEventHandler(func))
2813#define EVT_KEY_UP(func) wx__DECLARE_EVT0(wxEVT_KEY_UP, wxKeyEventHandler(func))
5048c832 2814#if wxUSE_HOTKEY
7fa03f04 2815#define EVT_HOTKEY(winid, func) wx__DECLARE_EVT1(wxEVT_HOTKEY, winid, wxCharEventHandler(func))
5048c832 2816#endif
7fa03f04
VZ
2817#define EVT_CHAR_HOOK(func) wx__DECLARE_EVT0(wxEVT_CHAR_HOOK, wxCharEventHandler(func))
2818#define EVT_MENU_OPEN(func) wx__DECLARE_EVT0(wxEVT_MENU_OPEN, wxMenuEventHandler(func))
2819#define EVT_MENU_CLOSE(func) wx__DECLARE_EVT0(wxEVT_MENU_CLOSE, wxMenuEventHandler(func))
2820#define EVT_MENU_HIGHLIGHT(winid, func) wx__DECLARE_EVT1(wxEVT_MENU_HIGHLIGHT, winid, wxMenuEventHandler(func))
2821#define EVT_MENU_HIGHLIGHT_ALL(func) wx__DECLARE_EVT0(wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler(func))
2822#define EVT_SET_FOCUS(func) wx__DECLARE_EVT0(wxEVT_SET_FOCUS, wxFocusEventHandler(func))
2823#define EVT_KILL_FOCUS(func) wx__DECLARE_EVT0(wxEVT_KILL_FOCUS, wxFocusEventHandler(func))
2824#define EVT_CHILD_FOCUS(func) wx__DECLARE_EVT0(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(func))
2825#define EVT_ACTIVATE(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE, wxActivateEventHandler(func))
2826#define EVT_ACTIVATE_APP(func) wx__DECLARE_EVT0(wxEVT_ACTIVATE_APP, wxActivateEventHandler(func))
afafd942 2827#define EVT_HIBERNATE(func) wx__DECLARE_EVT0(wxEVT_HIBERNATE, wxActivateEventHandler(func))
7fa03f04
VZ
2828#define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
2829#define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
2830#define EVT_DROP_FILES(func) wx__DECLARE_EVT0(wxEVT_DROP_FILES, wxDropFilesEventHandler(func))
2831#define EVT_INIT_DIALOG(func) wx__DECLARE_EVT0(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(func))
2832#define EVT_SYS_COLOUR_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEventHandler(func))
2833#define EVT_DISPLAY_CHANGED(func) wx__DECLARE_EVT0(wxEVT_DISPLAY_CHANGED, wxDisplayChangedEventHandler(func))
2834#define EVT_SHOW(func) wx__DECLARE_EVT0(wxEVT_SHOW, wxShowEventHandler(func))
2835#define EVT_MAXIMIZE(func) wx__DECLARE_EVT0(wxEVT_MAXIMIZE, wxMaximizeEventHandler(func))
2836#define EVT_ICONIZE(func) wx__DECLARE_EVT0(wxEVT_ICONIZE, wxIconizeEventHandler(func))
2837#define EVT_NAVIGATION_KEY(func) wx__DECLARE_EVT0(wxEVT_NAVIGATION_KEY, wxNavigationKeyEventHandler(func))
2838#define EVT_PALETTE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_PALETTE_CHANGED, wxPaletteChangedEventHandler(func))
2839#define EVT_QUERY_NEW_PALETTE(func) wx__DECLARE_EVT0(wxEVT_QUERY_NEW_PALETTE, wxQueryNewPaletteEventHandler(func))
2840#define EVT_WINDOW_CREATE(func) wx__DECLARE_EVT0(wxEVT_CREATE, wxWindowCreateEventHandler(func))
2841#define EVT_WINDOW_DESTROY(func) wx__DECLARE_EVT0(wxEVT_DESTROY, wxWindowDestroyEventHandler(func))
2842#define EVT_SET_CURSOR(func) wx__DECLARE_EVT0(wxEVT_SET_CURSOR, wxSetCursorEventHandler(func))
2843#define EVT_MOUSE_CAPTURE_CHANGED(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_CHANGED, wxMouseCaptureChangedEventHandler(func))
63e819f2 2844#define EVT_MOUSE_CAPTURE_LOST(func) wx__DECLARE_EVT0(wxEVT_MOUSE_CAPTURE_LOST, wxMouseCaptureLostEventHandler(func))
c801d85f
KB
2845
2846// Mouse events
7fa03f04
VZ
2847#define EVT_LEFT_DOWN(func) wx__DECLARE_EVT0(wxEVT_LEFT_DOWN, wxMouseEventHandler(func))
2848#define EVT_LEFT_UP(func) wx__DECLARE_EVT0(wxEVT_LEFT_UP, wxMouseEventHandler(func))
2849#define EVT_MIDDLE_DOWN(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DOWN, wxMouseEventHandler(func))
2850#define EVT_MIDDLE_UP(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_UP, wxMouseEventHandler(func))
2851#define EVT_RIGHT_DOWN(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DOWN, wxMouseEventHandler(func))
2852#define EVT_RIGHT_UP(func) wx__DECLARE_EVT0(wxEVT_RIGHT_UP, wxMouseEventHandler(func))
2853#define EVT_MOTION(func) wx__DECLARE_EVT0(wxEVT_MOTION, wxMouseEventHandler(func))
2854#define EVT_LEFT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_LEFT_DCLICK, wxMouseEventHandler(func))
2855#define EVT_MIDDLE_DCLICK(func) wx__DECLARE_EVT0(wxEVT_MIDDLE_DCLICK, wxMouseEventHandler(func))
2856#define EVT_RIGHT_DCLICK(func) wx__DECLARE_EVT0(wxEVT_RIGHT_DCLICK, wxMouseEventHandler(func))
2857#define EVT_LEAVE_WINDOW(func) wx__DECLARE_EVT0(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(func))
2858#define EVT_ENTER_WINDOW(func) wx__DECLARE_EVT0(wxEVT_ENTER_WINDOW, wxMouseEventHandler(func))
2859#define EVT_MOUSEWHEEL(func) wx__DECLARE_EVT0(wxEVT_MOUSEWHEEL, wxMouseEventHandler(func))
01101e2d
VZ
2860#define EVT_MOUSE_AUX1_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX1_DOWN, wxMouseEventHandler(func))
2861#define EVT_MOUSE_AUX1_UP(func) wx__DECLARE_EVT0(wxEVT_AUX1_UP, wxMouseEventHandler(func))
2862#define EVT_MOUSE_AUX1_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX1_DCLICK, wxMouseEventHandler(func))
2863#define EVT_MOUSE_AUX2_DOWN(func) wx__DECLARE_EVT0(wxEVT_AUX2_DOWN, wxMouseEventHandler(func))
2864#define EVT_MOUSE_AUX2_UP(func) wx__DECLARE_EVT0(wxEVT_AUX2_UP, wxMouseEventHandler(func))
2865#define EVT_MOUSE_AUX2_DCLICK(func) wx__DECLARE_EVT0(wxEVT_AUX2_DCLICK, wxMouseEventHandler(func))
c801d85f
KB
2866
2867// All mouse events
2868#define EVT_MOUSE_EVENTS(func) \
7fa03f04
VZ
2869 EVT_LEFT_DOWN(func) \
2870 EVT_LEFT_UP(func) \
01101e2d 2871 EVT_LEFT_DCLICK(func) \
7fa03f04
VZ
2872 EVT_MIDDLE_DOWN(func) \
2873 EVT_MIDDLE_UP(func) \
01101e2d 2874 EVT_MIDDLE_DCLICK(func) \
7fa03f04
VZ
2875 EVT_RIGHT_DOWN(func) \
2876 EVT_RIGHT_UP(func) \
7fa03f04 2877 EVT_RIGHT_DCLICK(func) \
01101e2d
VZ
2878 EVT_MOUSE_AUX1_DOWN(func) \
2879 EVT_MOUSE_AUX1_UP(func) \
2880 EVT_MOUSE_AUX1_DCLICK(func) \
2881 EVT_MOUSE_AUX2_DOWN(func) \
2882 EVT_MOUSE_AUX2_UP(func) \
2883 EVT_MOUSE_AUX2_DCLICK(func) \
2884 EVT_MOTION(func) \
7fa03f04
VZ
2885 EVT_LEAVE_WINDOW(func) \
2886 EVT_ENTER_WINDOW(func) \
2887 EVT_MOUSEWHEEL(func)
c801d85f 2888
c5b42c87 2889// Scrolling from wxWindow (sent to wxScrolledWindow)
7fa03f04
VZ
2890#define EVT_SCROLLWIN_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(func))
2891#define EVT_SCROLLWIN_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEventHandler(func))
2892#define EVT_SCROLLWIN_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEUP, wxScrollWinEventHandler(func))
2893#define EVT_SCROLLWIN_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEventHandler(func))
2894#define EVT_SCROLLWIN_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEventHandler(func))
2895#define EVT_SCROLLWIN_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEventHandler(func))
2896#define EVT_SCROLLWIN_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(func))
2897#define EVT_SCROLLWIN_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(func))
2898
c5b42c87 2899#define EVT_SCROLLWIN(func) \
7fa03f04
VZ
2900 EVT_SCROLLWIN_TOP(func) \
2901 EVT_SCROLLWIN_BOTTOM(func) \
2902 EVT_SCROLLWIN_LINEUP(func) \
2903 EVT_SCROLLWIN_LINEDOWN(func) \
2904 EVT_SCROLLWIN_PAGEUP(func) \
2905 EVT_SCROLLWIN_PAGEDOWN(func) \
2906 EVT_SCROLLWIN_THUMBTRACK(func) \
2907 EVT_SCROLLWIN_THUMBRELEASE(func)
c5b42c87
RR
2908
2909// Scrolling from wxSlider and wxScrollBar
7fa03f04
VZ
2910#define EVT_SCROLL_TOP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_TOP, wxScrollEventHandler(func))
2911#define EVT_SCROLL_BOTTOM(func) wx__DECLARE_EVT0(wxEVT_SCROLL_BOTTOM, wxScrollEventHandler(func))
2912#define EVT_SCROLL_LINEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEUP, wxScrollEventHandler(func))
2913#define EVT_SCROLL_LINEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler(func))
2914#define EVT_SCROLL_PAGEUP(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEUP, wxScrollEventHandler(func))
2915#define EVT_SCROLL_PAGEDOWN(func) wx__DECLARE_EVT0(wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler(func))
2916#define EVT_SCROLL_THUMBTRACK(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler(func))
2917#define EVT_SCROLL_THUMBRELEASE(func) wx__DECLARE_EVT0(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(func))
cbc85508 2918#define EVT_SCROLL_CHANGED(func) wx__DECLARE_EVT0(wxEVT_SCROLL_CHANGED, wxScrollEventHandler(func))
7fa03f04 2919
c801d85f 2920#define EVT_SCROLL(func) \
7fa03f04
VZ
2921 EVT_SCROLL_TOP(func) \
2922 EVT_SCROLL_BOTTOM(func) \
2923 EVT_SCROLL_LINEUP(func) \
2924 EVT_SCROLL_LINEDOWN(func) \
2925 EVT_SCROLL_PAGEUP(func) \
2926 EVT_SCROLL_PAGEDOWN(func) \
2927 EVT_SCROLL_THUMBTRACK(func) \
e8739575 2928 EVT_SCROLL_THUMBRELEASE(func) \
84006e65 2929 EVT_SCROLL_CHANGED(func)
c801d85f 2930
c5b42c87 2931// Scrolling from wxSlider and wxScrollBar, with an id
7fa03f04
VZ
2932#define EVT_COMMAND_SCROLL_TOP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_TOP, winid, wxScrollEventHandler(func))
2933#define EVT_COMMAND_SCROLL_BOTTOM(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_BOTTOM, winid, wxScrollEventHandler(func))
2934#define EVT_COMMAND_SCROLL_LINEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEUP, winid, wxScrollEventHandler(func))
2935#define EVT_COMMAND_SCROLL_LINEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_LINEDOWN, winid, wxScrollEventHandler(func))
2936#define EVT_COMMAND_SCROLL_PAGEUP(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEUP, winid, wxScrollEventHandler(func))
2937#define EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_PAGEDOWN, winid, wxScrollEventHandler(func))
2938#define EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBTRACK, winid, wxScrollEventHandler(func))
2939#define EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_THUMBRELEASE, winid, wxScrollEventHandler(func))
cbc85508 2940#define EVT_COMMAND_SCROLL_CHANGED(winid, func) wx__DECLARE_EVT1(wxEVT_SCROLL_CHANGED, winid, wxScrollEventHandler(func))
7fa03f04 2941
d9e2e4c2 2942#define EVT_COMMAND_SCROLL(winid, func) \
7fa03f04
VZ
2943 EVT_COMMAND_SCROLL_TOP(winid, func) \
2944 EVT_COMMAND_SCROLL_BOTTOM(winid, func) \
2945 EVT_COMMAND_SCROLL_LINEUP(winid, func) \
2946 EVT_COMMAND_SCROLL_LINEDOWN(winid, func) \
2947 EVT_COMMAND_SCROLL_PAGEUP(winid, func) \
2948 EVT_COMMAND_SCROLL_PAGEDOWN(winid, func) \
2949 EVT_COMMAND_SCROLL_THUMBTRACK(winid, func) \
e8739575 2950 EVT_COMMAND_SCROLL_THUMBRELEASE(winid, func) \
84006e65 2951 EVT_COMMAND_SCROLL_CHANGED(winid, func)
cbc85508 2952
ca3e85cf
WS
2953#if WXWIN_COMPATIBILITY_2_6
2954 // compatibility macros for the old name, deprecated in 2.8
2955 #define wxEVT_SCROLL_ENDSCROLL wxEVT_SCROLL_CHANGED
2956 #define EVT_COMMAND_SCROLL_ENDSCROLL EVT_COMMAND_SCROLL_CHANGED
2957 #define EVT_SCROLL_ENDSCROLL EVT_SCROLL_CHANGED
2958#endif // WXWIN_COMPATIBILITY_2_6
c801d85f
KB
2959
2960// Convenience macros for commonly-used commands
7fa03f04
VZ
2961#define EVT_CHECKBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKBOX_CLICKED, winid, wxCommandEventHandler(func))
2962#define EVT_CHOICE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHOICE_SELECTED, winid, wxCommandEventHandler(func))
2963#define EVT_LISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOX_SELECTED, winid, wxCommandEventHandler(func))
2964#define EVT_LISTBOX_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, winid, wxCommandEventHandler(func))
2965#define EVT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_MENU_SELECTED, winid, wxCommandEventHandler(func))
2966#define EVT_MENU_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_MENU_SELECTED, id1, id2, wxCommandEventHandler(func))
119727ad 2967#if defined(__SMARTPHONE__)
7fa03f04 2968# define EVT_BUTTON(winid, func) EVT_MENU(winid, func)
119727ad 2969#else
7fa03f04 2970# define EVT_BUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_BUTTON_CLICKED, winid, wxCommandEventHandler(func))
119727ad 2971#endif
7fa03f04
VZ
2972#define EVT_SLIDER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SLIDER_UPDATED, winid, wxCommandEventHandler(func))
2973#define EVT_RADIOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RADIOBOX_SELECTED, winid, wxCommandEventHandler(func))
2974#define EVT_RADIOBUTTON(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RADIOBUTTON_SELECTED, winid, wxCommandEventHandler(func))
c801d85f 2975// EVT_SCROLLBAR is now obsolete since we use EVT_COMMAND_SCROLL... events
7fa03f04
VZ
2976#define EVT_SCROLLBAR(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SCROLLBAR_UPDATED, winid, wxCommandEventHandler(func))
2977#define EVT_VLBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_VLBOX_SELECTED, winid, wxCommandEventHandler(func))
2978#define EVT_COMBOBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_COMBOBOX_SELECTED, winid, wxCommandEventHandler(func))
2979#define EVT_TOOL(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_CLICKED, winid, wxCommandEventHandler(func))
a9a0ceca 2980#define EVT_TOOL_DROPDOWN(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED, winid, wxCommandEventHandler(func))
7fa03f04
VZ
2981#define EVT_TOOL_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_CLICKED, id1, id2, wxCommandEventHandler(func))
2982#define EVT_TOOL_RCLICKED(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_RCLICKED, winid, wxCommandEventHandler(func))
2983#define EVT_TOOL_RCLICKED_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, wxCommandEventHandler(func))
2984#define EVT_TOOL_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TOOL_ENTER, winid, wxCommandEventHandler(func))
2985#define EVT_CHECKLISTBOX(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, winid, wxCommandEventHandler(func))
c801d85f
KB
2986
2987// Generic command events
7fa03f04
VZ
2988#define EVT_COMMAND_LEFT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_CLICK, winid, wxCommandEventHandler(func))
2989#define EVT_COMMAND_LEFT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_LEFT_DCLICK, winid, wxCommandEventHandler(func))
2990#define EVT_COMMAND_RIGHT_CLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_CLICK, winid, wxCommandEventHandler(func))
2991#define EVT_COMMAND_RIGHT_DCLICK(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_RIGHT_DCLICK, winid, wxCommandEventHandler(func))
2992#define EVT_COMMAND_SET_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_SET_FOCUS, winid, wxCommandEventHandler(func))
2993#define EVT_COMMAND_KILL_FOCUS(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_KILL_FOCUS, winid, wxCommandEventHandler(func))
2994#define EVT_COMMAND_ENTER(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_ENTER, winid, wxCommandEventHandler(func))
c801d85f
KB
2995
2996// Joystick events
1241ab8b 2997
7fa03f04
VZ
2998#define EVT_JOY_BUTTON_DOWN(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_DOWN, wxJoystickEventHandler(func))
2999#define EVT_JOY_BUTTON_UP(func) wx__DECLARE_EVT0(wxEVT_JOY_BUTTON_UP, wxJoystickEventHandler(func))
3000#define EVT_JOY_MOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_MOVE, wxJoystickEventHandler(func))
3001#define EVT_JOY_ZMOVE(func) wx__DECLARE_EVT0(wxEVT_JOY_ZMOVE, wxJoystickEventHandler(func))
c801d85f
KB
3002
3003// All joystick events
3004#define EVT_JOYSTICK_EVENTS(func) \
7fa03f04
VZ
3005 EVT_JOY_BUTTON_DOWN(func) \
3006 EVT_JOY_BUTTON_UP(func) \
3007 EVT_JOY_MOVE(func) \
3008 EVT_JOY_ZMOVE(func)
c801d85f
KB
3009
3010// Idle event
7fa03f04 3011#define EVT_IDLE(func) wx__DECLARE_EVT0(wxEVT_IDLE, wxIdleEventHandler(func))
c801d85f
KB
3012
3013// Update UI event
7fa03f04
VZ
3014#define EVT_UPDATE_UI(winid, func) wx__DECLARE_EVT1(wxEVT_UPDATE_UI, winid, wxUpdateUIEventHandler(func))
3015#define EVT_UPDATE_UI_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_UPDATE_UI, id1, id2, wxUpdateUIEventHandler(func))
c801d85f 3016
b96340e6 3017// Help events
7fa03f04
VZ
3018#define EVT_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_HELP, winid, wxHelpEventHandler(func))
3019#define EVT_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_HELP, id1, id2, wxHelpEventHandler(func))
3020#define EVT_DETAILED_HELP(winid, func) wx__DECLARE_EVT1(wxEVT_DETAILED_HELP, winid, wxHelpEventHandler(func))
3021#define EVT_DETAILED_HELP_RANGE(id1, id2, func) wx__DECLARE_EVT2(wxEVT_DETAILED_HELP, id1, id2, wxHelpEventHandler(func))
fb6261e9 3022
69231000 3023// Context Menu Events
7fa03f04 3024#define EVT_CONTEXT_MENU(func) wx__DECLARE_EVT0(wxEVT_CONTEXT_MENU, wxContextMenuEventHandler(func))
5cd2a6ae 3025#define EVT_COMMAND_CONTEXT_MENU(winid, func) wx__DECLARE_EVT1(wxEVT_CONTEXT_MENU, winid, wxContextMenuEventHandler(func))
69231000 3026
78c91815
VZ
3027// Clipboard text Events
3028#define EVT_TEXT_CUT(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_CUT, winid, wxClipboardTextEventHandler(func))
3029#define EVT_TEXT_COPY(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_COPY, winid, wxClipboardTextEventHandler(func))
3030#define EVT_TEXT_PASTE(winid, func) wx__DECLARE_EVT1(wxEVT_COMMAND_TEXT_PASTE, winid, wxClipboardTextEventHandler(func))
3031
8e193f38
VZ
3032// ----------------------------------------------------------------------------
3033// Global data
3034// ----------------------------------------------------------------------------
3035
19c4d916
VZ
3036// list containing event handlers with pending events for them
3037//
3038// notice that each event handler should occur at most once in this list
bddd7a8d 3039extern WXDLLIMPEXP_BASE wxList *wxPendingEvents;
8e193f38 3040#if wxUSE_THREADS
bddd7a8d 3041 extern WXDLLIMPEXP_BASE wxCriticalSection *wxPendingEventsLocker;
8e193f38
VZ
3042#endif
3043
e90c1d2a
VZ
3044// ----------------------------------------------------------------------------
3045// Helper functions
3046// ----------------------------------------------------------------------------
3047
3048#if wxUSE_GUI
e702ff0f
JS
3049
3050// Find a window with the focus, that is also a descendant of the given window.
3051// This is used to determine the window to initially send commands to.
9f8b9d9c 3052WXDLLIMPEXP_CORE wxWindow* wxFindFocusDescendant(wxWindow* ancestor);
e702ff0f 3053
e90c1d2a
VZ
3054#endif // wxUSE_GUI
3055
204abcd4 3056#endif // _WX_EVENT_H_