]> git.saurik.com Git - wxWidgets.git/blame - include/wx/event.h
Removed some consts from tabctrl.h; fixed some other errors
[wxWidgets.git] / include / wx / event.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: event.h
3// Purpose: Event classes
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c)
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __EVENTH__
13#define __EVENTH__
14
15#ifdef __GNUG__
16#pragma interface "event.h"
17#endif
18
19#include "wx/defs.h"
20#include "wx/object.h"
21#include "wx/gdicmn.h"
22
23/*
24 * Event types
25 *
26 */
64693098
JS
27
28enum wxEventType {
29 wxEVT_NULL = 0,
c801d85f
KB
30 wxEVT_FIRST = 10000,
31
32 // New names
33 wxEVT_COMMAND_BUTTON_CLICKED,
34 wxEVT_COMMAND_CHECKBOX_CLICKED,
35 wxEVT_COMMAND_CHOICE_SELECTED,
36 wxEVT_COMMAND_LISTBOX_SELECTED,
37 wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,
38 wxEVT_COMMAND_CHECKLISTBOX_TOGGLED,
39 wxEVT_COMMAND_TEXT_UPDATED,
40 wxEVT_COMMAND_TEXT_ENTER,
41 wxEVT_COMMAND_MENU_SELECTED,
42 wxEVT_COMMAND_SLIDER_UPDATED,
43 wxEVT_COMMAND_RADIOBOX_SELECTED,
44 wxEVT_COMMAND_RADIOBUTTON_SELECTED,
45// wxEVT_COMMAND_SCROLLBAR_UPDATED is now obsolete since we use wxEVT_SCROLL... events
46 wxEVT_COMMAND_SCROLLBAR_UPDATED,
47 wxEVT_COMMAND_VLBOX_SELECTED,
48 wxEVT_COMMAND_COMBOBOX_SELECTED,
49 wxEVT_COMMAND_TOOL_CLICKED,
50 wxEVT_COMMAND_TOOL_RCLICKED,
51 wxEVT_COMMAND_TOOL_ENTER,
52 wxEVT_SET_FOCUS,
53 wxEVT_KILL_FOCUS,
54
55/* Mouse event types */
56 wxEVT_LEFT_DOWN,
57 wxEVT_LEFT_UP,
58 wxEVT_MIDDLE_DOWN,
59 wxEVT_MIDDLE_UP,
60 wxEVT_RIGHT_DOWN,
61 wxEVT_RIGHT_UP,
62 wxEVT_MOTION,
63 wxEVT_ENTER_WINDOW,
64 wxEVT_LEAVE_WINDOW,
65 wxEVT_LEFT_DCLICK,
66 wxEVT_MIDDLE_DCLICK,
67 wxEVT_RIGHT_DCLICK,
68
69 // Non-client mouse events
70 wxEVT_NC_LEFT_DOWN = wxEVT_FIRST + 100,
71 wxEVT_NC_LEFT_UP,
72 wxEVT_NC_MIDDLE_DOWN,
73 wxEVT_NC_MIDDLE_UP,
74 wxEVT_NC_RIGHT_DOWN,
75 wxEVT_NC_RIGHT_UP,
76 wxEVT_NC_MOTION,
77 wxEVT_NC_ENTER_WINDOW,
78 wxEVT_NC_LEAVE_WINDOW,
79 wxEVT_NC_LEFT_DCLICK,
80 wxEVT_NC_MIDDLE_DCLICK,
81 wxEVT_NC_RIGHT_DCLICK,
82
83/* Character input event type */
84 wxEVT_CHAR,
85
86 /*
87 * Scrollbar event identifiers
88 */
89 wxEVT_SCROLL_TOP,
90 wxEVT_SCROLL_BOTTOM,
91 wxEVT_SCROLL_LINEUP,
92 wxEVT_SCROLL_LINEDOWN,
93 wxEVT_SCROLL_PAGEUP,
94 wxEVT_SCROLL_PAGEDOWN,
95 wxEVT_SCROLL_THUMBTRACK,
96
97 wxEVT_SIZE = wxEVT_FIRST + 200,
98 wxEVT_MOVE,
99 wxEVT_CLOSE_WINDOW,
100 wxEVT_END_SESSION,
101 wxEVT_QUERY_END_SESSION,
102 wxEVT_ACTIVATE_APP,
103 wxEVT_POWER,
104 wxEVT_CHAR_HOOK,
105 wxEVT_KEY_UP,
106 wxEVT_ACTIVATE,
107 wxEVT_CREATE,
108 wxEVT_DESTROY,
109 wxEVT_SHOW,
110 wxEVT_ICONIZE,
111 wxEVT_MAXIMIZE,
112 wxEVT_MOUSE_CAPTURE_CHANGED,
113 wxEVT_PAINT,
114 wxEVT_ERASE_BACKGROUND,
115 wxEVT_NC_PAINT,
116 wxEVT_PAINT_ICON,
117 wxEVT_MENU_CHAR,
118 wxEVT_MENU_INIT,
119 wxEVT_MENU_HIGHLIGHT,
120 wxEVT_POPUP_MENU_INIT,
121 wxEVT_CONTEXT_MENU,
122 wxEVT_SYS_COLOUR_CHANGED,
123 wxEVT_SETTING_CHANGED,
124 wxEVT_QUERY_NEW_PALETTE,
125 wxEVT_PALETTE_CHANGED,
126 wxEVT_JOY_BUTTON_DOWN,
127 wxEVT_JOY_BUTTON_UP,
128 wxEVT_JOY_MOVE,
129 wxEVT_JOY_ZMOVE,
130 wxEVT_DROP_FILES,
131 wxEVT_DRAW_ITEM,
132 wxEVT_MEASURE_ITEM,
133 wxEVT_COMPARE_ITEM,
134 wxEVT_INIT_DIALOG,
135 wxEVT_IDLE,
136 wxEVT_UPDATE_UI,
137
138 /* Generic command events */
139 // Note: a click is a higher-level event
140 // than button down/up
141 wxEVT_COMMAND_LEFT_CLICK,
142 wxEVT_COMMAND_LEFT_DCLICK,
143 wxEVT_COMMAND_RIGHT_CLICK,
144 wxEVT_COMMAND_RIGHT_DCLICK,
145 wxEVT_COMMAND_SET_FOCUS,
146 wxEVT_COMMAND_KILL_FOCUS,
147 wxEVT_COMMAND_ENTER,
148
149 /* Tree control event types */
150 wxEVT_COMMAND_TREE_BEGIN_DRAG,
151 wxEVT_COMMAND_TREE_BEGIN_RDRAG,
152 wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT,
153 wxEVT_COMMAND_TREE_END_LABEL_EDIT,
154 wxEVT_COMMAND_TREE_DELETE_ITEM,
155 wxEVT_COMMAND_TREE_GET_INFO,
156 wxEVT_COMMAND_TREE_SET_INFO,
157 wxEVT_COMMAND_TREE_ITEM_EXPANDED,
158 wxEVT_COMMAND_TREE_ITEM_EXPANDING,
159 wxEVT_COMMAND_TREE_SEL_CHANGED,
160 wxEVT_COMMAND_TREE_SEL_CHANGING,
161 wxEVT_COMMAND_TREE_KEY_DOWN,
162
163 /* List control event types */
164 wxEVT_COMMAND_LIST_BEGIN_DRAG,
165 wxEVT_COMMAND_LIST_BEGIN_RDRAG,
166 wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT,
167 wxEVT_COMMAND_LIST_END_LABEL_EDIT,
168 wxEVT_COMMAND_LIST_DELETE_ITEM,
169 wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS,
170 wxEVT_COMMAND_LIST_GET_INFO,
171 wxEVT_COMMAND_LIST_SET_INFO,
172 wxEVT_COMMAND_LIST_ITEM_SELECTED,
173 wxEVT_COMMAND_LIST_ITEM_DESELECTED,
174 wxEVT_COMMAND_LIST_KEY_DOWN,
175 wxEVT_COMMAND_LIST_INSERT_ITEM,
176 wxEVT_COMMAND_LIST_COL_CLICK,
177
28bfeb73 178 /* Tab and notebook control event types */
c801d85f 179 wxEVT_COMMAND_TAB_SEL_CHANGED,
28bfeb73
VZ
180 wxEVT_COMMAND_TAB_SEL_CHANGING,
181 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED,
cf447356
GL
182 wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING,
183
184 /* System misc. */
185 wxEVT_END_PROCESS = wxEVT_FIRST + 300
c801d85f
KB
186};
187
188// Compatibility
189
190#if WXWIN_COMPATIBILITY
191
192#define wxEVENT_TYPE_BUTTON_COMMAND wxEVT_COMMAND_BUTTON_CLICKED
193#define wxEVENT_TYPE_CHECKBOX_COMMAND wxEVT_COMMAND_CHECKBOX_CLICKED
194#define wxEVENT_TYPE_CHOICE_COMMAND wxEVT_COMMAND_CHOICE_SELECTED
195#define wxEVENT_TYPE_LISTBOX_COMMAND wxEVT_COMMAND_LISTBOX_SELECTED
196#define wxEVENT_TYPE_LISTBOX_DCLICK_COMMAND wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
197#define wxEVENT_TYPE_TEXT_COMMAND wxEVT_COMMAND_TEXT_UPDATED
198#define wxEVENT_TYPE_MULTITEXT_COMMAND wxEVT_COMMAND_TEXT_UPDATED
199#define wxEVENT_TYPE_MENU_COMMAND wxEVT_COMMAND_MENU_SELECTED
200#define wxEVENT_TYPE_SLIDER_COMMAND wxEVT_COMMAND_SLIDER_UPDATED
201#define wxEVENT_TYPE_RADIOBOX_COMMAND wxEVT_COMMAND_RADIOBOX_SELECTED
202#define wxEVENT_TYPE_RADIOBUTTON_COMMAND wxEVT_COMMAND_RADIOBUTTON_SELECTED
203#define wxEVENT_TYPE_TEXT_ENTER_COMMAND wxEVT_COMMAND_TEXT_ENTER
204#define wxEVENT_TYPE_SET_FOCUS wxEVT_SET_FOCUS
205#define wxEVENT_TYPE_KILL_FOCUS wxEVT_KILL_FOCUS
206#define wxEVENT_TYPE_SCROLLBAR_COMMAND wxEVT_COMMAND_SCROLLBAR_UPDATED
207#define wxEVENT_TYPE_VIRT_LISTBOX_COMMAND wxEVT_COMMAND_VLBOX_SELECTED
208#define wxEVENT_TYPE_COMBOBOX_COMMAND wxEVT_COMMAND_COMBOBOX_SELECTED
209
210#define wxEVENT_TYPE_LEFT_DOWN wxEVT_LEFT_DOWN
211#define wxEVENT_TYPE_LEFT_UP wxEVT_LEFT_UP
212#define wxEVENT_TYPE_MIDDLE_DOWN wxEVT_MIDDLE_DOWN
213#define wxEVENT_TYPE_MIDDLE_UP wxEVT_MIDDLE_UP
214#define wxEVENT_TYPE_RIGHT_DOWN wxEVT_RIGHT_DOWN
215#define wxEVENT_TYPE_RIGHT_UP wxEVT_RIGHT_UP
216#define wxEVENT_TYPE_MOTION wxEVT_MOTION
217#define wxEVENT_TYPE_ENTER_WINDOW wxEVT_ENTER_WINDOW
218#define wxEVENT_TYPE_LEAVE_WINDOW wxEVT_LEAVE_WINDOW
219#define wxEVENT_TYPE_LEFT_DCLICK wxEVT_LEFT_DCLICK
220#define wxEVENT_TYPE_MIDDLE_DCLICK wxEVT_MIDDLE_DCLICK
221#define wxEVENT_TYPE_RIGHT_DCLICK wxEVT_RIGHT_DCLICK
222#define wxEVENT_TYPE_CHAR wxEVT_CHAR
223#define wxEVENT_TYPE_SCROLL_TOP wxEVT_SCROLL_TOP
224#define wxEVENT_TYPE_SCROLL_BOTTOM wxEVT_SCROLL_BOTTOM
225#define wxEVENT_TYPE_SCROLL_LINEUP wxEVT_SCROLL_LINEUP
226#define wxEVENT_TYPE_SCROLL_LINEDOWN wxEVT_SCROLL_LINEDOWN
227#define wxEVENT_TYPE_SCROLL_PAGEUP wxEVT_SCROLL_PAGEUP
228#define wxEVENT_TYPE_SCROLL_PAGEDOWN wxEVT_SCROLL_PAGEDOWN
229#define wxEVENT_TYPE_SCROLL_THUMBTRACK wxEVT_SCROLL_THUMBTRACK
230
231#endif
232
233/*
234 * wxWindows events, covering all interesting things that might happen
235 * (button clicking, resizing, setting text in widgets, etc.).
236 *
237 * For each completely new event type, derive a new event class.
238 * An event CLASS represents a C++ class defining a range of similar event TYPES;
239 * examples are canvas events, panel item command events.
240 * An event TYPE is a unique identifier for a particular system event,
241 * such as a button press or a listbox deselection.
242 *
243 */
244
245class WXDLLEXPORT wxEvent: public wxObject
246{
247 DECLARE_ABSTRACT_CLASS(wxEvent)
248
249public:
250 wxEvent(int id = 0);
251 inline ~wxEvent(void) {}
252
64693098
JS
253 inline void SetEventType(wxEventType typ) { m_eventType = typ; }
254 inline wxEventType GetEventType(void) const { return m_eventType; }
c801d85f
KB
255 inline wxObject *GetEventObject(void) const { return m_eventObject; }
256 inline void SetEventObject(wxObject *obj) { m_eventObject = obj; }
257 inline long GetTimestamp(void) const { return m_timeStamp; }
258 inline void SetTimestamp(long ts = 0) { m_timeStamp = ts; }
259 inline int GetId() const { return m_id; }
260 inline void SetId(int Id) { m_id = Id; }
261
262 // Can instruct event processor that we wish to ignore this event
263 // (treat as if the event table entry had not been found)
264 inline void Skip(const bool skip = TRUE) { m_skipped = skip; }
265 inline bool GetSkipped(void) const { return m_skipped; };
266
267public:
268 bool m_skipped;
269 wxObject* m_eventObject;
270 char* m_eventHandle; // Handle of an underlying windowing system event
64693098 271 wxEventType m_eventType;
c801d85f
KB
272 long m_timeStamp;
273 int m_id;
fe71f65c 274 wxObject* m_callbackUserData;
c801d85f
KB
275
276};
277
278// Item or menu event class
279/*
280 wxEVT_COMMAND_BUTTON_CLICKED
281 wxEVT_COMMAND_CHECKBOX_CLICKED
282 wxEVT_COMMAND_CHOICE_SELECTED
283 wxEVT_COMMAND_LISTBOX_SELECTED
284 wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
285 wxEVT_COMMAND_TEXT_UPDATED
286 wxEVT_COMMAND_TEXT_ENTER
287 wxEVT_COMMAND_MENU_SELECTED
288 wxEVT_COMMAND_SLIDER_UPDATED
289 wxEVT_COMMAND_RADIOBOX_SELECTED
290 wxEVT_COMMAND_RADIOBUTTON_SELECTED
291 wxEVT_COMMAND_SCROLLBAR_UPDATED
292 wxEVT_COMMAND_VLBOX_SELECTED
293 wxEVT_COMMAND_COMBOBOX_SELECTED
294*/
295
296class WXDLLEXPORT wxCommandEvent: public wxEvent
297{
298 DECLARE_DYNAMIC_CLASS(wxCommandEvent)
299
64693098 300 wxCommandEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
c801d85f
KB
301 inline ~wxCommandEvent(void) {}
302
303 /*
304 * Accessors dependent on context
305 *
306 */
307
308 // Set/Get listbox/choice client data
309 inline void SetClientData(char* clientData) { m_clientData = clientData; }
310 inline char *GetClientData() const { return m_clientData; }
311
312 // Get listbox selection if single-choice
313 inline int GetSelection() const { return m_commandInt; }
314
315 // Set/Get listbox/choice selection string
316 inline void SetString(char* s) { m_commandString = s; }
317 inline char *GetString() const { return m_commandString; }
318
319 // Get checkbox value
320 inline bool Checked() const { return (m_commandInt != 0); }
321
322 // TRUE if the listbox event was a selection.
323 inline bool IsSelection() const { return (m_extraLong != 0); }
324
325 inline void SetExtraLong(long extraLong) { m_extraLong = extraLong; }
326 inline long GetExtraLong(void) const { return m_extraLong ; }
327
328 inline void SetInt(int i) { m_commandInt = i; }
329 inline long GetInt(void) const { return m_commandInt ; }
330
331 public:
332 char* m_commandString; // String event argument
333 int m_commandInt;
334 long m_extraLong; // Additional information (e.g. select/deselect)
335 char* m_clientData; // Arbitrary client data
336};
337
338// Scroll event class
339/*
340 wxEVT_SCROLL_TOP
341 wxEVT_SCROLL_BOTTOM
342 wxEVT_SCROLL_LINEUP
343 wxEVT_SCROLL_LINEDOWN
344 wxEVT_SCROLL_PAGEUP
345 wxEVT_SCROLL_PAGEDOWN
346 wxEVT_SCROLL_THUMBTRACK
347*/
348
349class WXDLLEXPORT wxScrollEvent: public wxCommandEvent
350{
351 DECLARE_DYNAMIC_CLASS(wxScrollEvent)
352
353 public:
64693098 354 wxScrollEvent(wxEventType commandType = wxEVT_NULL, int id = 0, int pos = 0, int orient = 0);
c801d85f
KB
355 inline ~wxScrollEvent(void) {}
356
357 /*
358 * Accessors
359 *
360 */
361
362 inline int GetOrientation(void) const { return (int) m_extraLong ; }
363 inline int GetPosition(void) const { return m_commandInt ; }
364 inline void SetOrientation(int orient) { m_extraLong = (long) orient; }
365 inline void SetPosition(int pos) { m_commandInt = pos; }
366};
367
368// Mouse event class
369
370/*
371 wxEVT_LEFT_DOWN
372 wxEVT_LEFT_UP
373 wxEVT_MIDDLE_DOWN
374 wxEVT_MIDDLE_UP
375 wxEVT_RIGHT_DOWN
376 wxEVT_RIGHT_UP
377 wxEVT_MOTION
378 wxEVT_ENTER_WINDOW
379 wxEVT_LEAVE_WINDOW
380 wxEVT_LEFT_DCLICK
381 wxEVT_MIDDLE_DCLICK
382 wxEVT_RIGHT_DCLICK
383 wxEVT_NC_LEFT_DOWN
384 wxEVT_NC_LEFT_UP,
385 wxEVT_NC_MIDDLE_DOWN,
386 wxEVT_NC_MIDDLE_UP,
387 wxEVT_NC_RIGHT_DOWN,
388 wxEVT_NC_RIGHT_UP,
389 wxEVT_NC_MOTION,
390 wxEVT_NC_ENTER_WINDOW,
391 wxEVT_NC_LEAVE_WINDOW,
392 wxEVT_NC_LEFT_DCLICK,
393 wxEVT_NC_MIDDLE_DCLICK,
394 wxEVT_NC_RIGHT_DCLICK,
395*/
396
397class WXDLLEXPORT wxMouseEvent: public wxEvent
398{
399 DECLARE_DYNAMIC_CLASS(wxMouseEvent)
400
401 public:
64693098 402 wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
c801d85f
KB
403
404 // Was it a button event? (*doesn't* mean: is any button *down*?)
405 inline bool IsButton(void) const { return Button(-1); }
406
407 // Was it a down event from button 1, 2 or 3 or any?
408 bool ButtonDown(int but = -1) const;
409
410 // Was it a dclick event from button 1, 2 or 3 or any?
411 bool ButtonDClick(int but = -1) const;
412
413 // Was it a up event from button 1, 2 or 3 or any?
414 bool ButtonUp(int but = -1) const;
415
416 // Was the given button 1,2,3 or any changing state?
417 bool Button(int but) const;
418
419 // Was the given button 1,2,3 or any in Down state?
420 bool ButtonIsDown(int but) const;
421
422 // Find state of shift/control keys
423 inline bool ControlDown(void) const { return m_controlDown; }
424 inline bool MetaDown(void) const { return m_metaDown; }
425 inline bool AltDown(void) const { return m_altDown; }
426 inline bool ShiftDown(void) const { return m_shiftDown; }
427
428 // Find which event was just generated
429 inline bool LeftDown(void) const { return (m_eventType == wxEVT_LEFT_DOWN); }
430 inline bool MiddleDown(void) const { return (m_eventType == wxEVT_MIDDLE_DOWN); }
431 inline bool RightDown(void) const { return (m_eventType == wxEVT_RIGHT_DOWN); }
432
433 inline bool LeftUp(void) const { return (m_eventType == wxEVT_LEFT_UP); }
434 inline bool MiddleUp(void) const { return (m_eventType == wxEVT_MIDDLE_UP); }
435 inline bool RightUp(void) const { return (m_eventType == wxEVT_RIGHT_UP); }
436
437 inline bool LeftDClick(void) const { return (m_eventType == wxEVT_LEFT_DCLICK); }
438 inline bool MiddleDClick(void) const { return (m_eventType == wxEVT_MIDDLE_DCLICK); }
439 inline bool RightDClick(void) const { return (m_eventType == wxEVT_RIGHT_DCLICK); }
440
441 // Find the current state of the mouse buttons (regardless
442 // of current event type)
443 inline bool LeftIsDown(void) const { return m_leftDown; }
444 inline bool MiddleIsDown(void) const { return m_middleDown; }
445 inline bool RightIsDown(void) const { return m_rightDown; }
446
447 // True if a button is down and the mouse is moving
448 inline bool Dragging(void) const { return ((m_eventType == wxEVENT_TYPE_MOTION) && (LeftIsDown() || MiddleIsDown() || RightIsDown())); }
449
450 // True if the mouse is moving, and no button is down
451 inline bool Moving(void) const { return (m_eventType == wxEVT_MOTION); }
452
453 // True if the mouse is just entering the window
454 inline bool Entering(void) const { return (m_eventType == wxEVT_ENTER_WINDOW); }
455
456 // True if the mouse is just leaving the window
457 inline bool Leaving(void) const { return (m_eventType == wxEVT_LEAVE_WINDOW); }
458
459 // Find the position of the event
460 inline void Position(long *xpos, long *ypos) const { *xpos = m_x; *ypos = m_y; }
461
462 // Find the position of the event
463 inline wxPoint GetPosition() const { return wxPoint(m_x, m_y); }
464
465 // Find the logical position of the event given the DC
466 wxPoint GetLogicalPosition(const wxDC& dc) const ;
467
468 // Compatibility
469 inline void Position(float *xpos, float *ypos) const { *xpos = (float) m_x; *ypos = (float) m_y; }
470
471 // Get X position
472 inline long GetX(void) const { return m_x; }
473
474 // Get Y position
475 inline long GetY(void) const { return m_y; }
476
477public:
478 long m_x;
479 long m_y;
480 bool m_leftDown;
481 bool m_middleDown;
482 bool m_rightDown;
483
484 bool m_controlDown;
485 bool m_shiftDown;
486 bool m_altDown;
487 bool m_metaDown;
488
489};
490
491// Keyboard input event class
492
493/*
494 wxEVT_CHAR
495 wxEVT_CHAR_HOOK
496 wxEVT_KEY_UP
497 */
498
499class WXDLLEXPORT wxKeyEvent: public wxEvent
500{
501 DECLARE_DYNAMIC_CLASS(wxKeyEvent)
502
503public:
64693098 504 wxKeyEvent(wxEventType keyType = wxEVT_NULL);
c801d85f
KB
505
506 // Find state of shift/control keys
507 inline bool ControlDown(void) const { return m_controlDown; }
508 inline bool MetaDown(void) const { return m_metaDown; }
509 inline bool AltDown(void) const { return m_altDown; }
510 inline bool ShiftDown(void) const { return m_shiftDown; }
511 inline long KeyCode(void) const { return m_keyCode; }
512
513 // Find the position of the event
514 inline void Position(float *xpos, float *ypos) const { *xpos = m_x; *ypos = m_y; }
515
516 // Get X position
517 inline float GetX(void) const { return m_x; }
518
519 // Get Y position
520 inline float GetY(void) const { return m_y; }
521
522public:
523 float m_x ;
524 float m_y ;
525 long m_keyCode;
526 bool m_controlDown;
527 bool m_shiftDown;
528 bool m_altDown;
529 bool m_metaDown;
530
531};
532
533// Size event class
534/*
535 wxEVT_SIZE
536 */
537
538class WXDLLEXPORT wxSizeEvent: public wxEvent
539{
540 DECLARE_DYNAMIC_CLASS(wxSizeEvent)
541
542 public:
543 wxSize m_size;
544
545 inline wxSizeEvent(void) { m_eventType = wxEVT_SIZE; }
546 inline wxSizeEvent(const wxSize& sz, int id = 0)
547 { m_eventType = wxEVT_SIZE; m_size.x = sz.x; m_size.y = sz.y; m_id = id; }
548
549 inline wxSize GetSize(void) const { return m_size; }
550};
551
552// Move event class
553
554/*
555 wxEVT_MOVE
556 */
557
558class WXDLLEXPORT wxMoveEvent: public wxEvent
559{
560 DECLARE_DYNAMIC_CLASS(wxMoveEvent)
561
562 public:
563 wxPoint m_pos;
564
565 inline wxMoveEvent(void) { m_eventType = wxEVT_MOVE; }
566 inline wxMoveEvent(const wxPoint& pos, int id = 0)
567 { m_eventType = wxEVT_MOVE; m_pos.x = pos.x; m_pos.y = pos.y; m_id = id; }
568
569 inline wxPoint GetPosition(void) const { return m_pos; }
570};
571
572// Paint event class
573/*
574 wxEVT_PAINT
575 wxEVT_NC_PAINT
576 wxEVT_PAINT_ICON
577 */
578
579class WXDLLEXPORT wxPaintEvent: public wxEvent
580{
581 DECLARE_DYNAMIC_CLASS(wxPaintEvent)
582
583 public:
584 inline wxPaintEvent(int Id = 0) { m_eventType = wxEVT_PAINT; m_id = Id; }
585};
586
587// Erase background event class
588/*
589 wxEVT_ERASE_BACKGROUND
590 */
591
592class WXDLLEXPORT wxDC;
593class WXDLLEXPORT wxEraseEvent: public wxEvent
594{
595 DECLARE_DYNAMIC_CLASS(wxEraseEvent)
596 public:
597 wxDC *m_dc ;
598 inline wxEraseEvent(int Id = 0, wxDC *dc = NULL) { m_eventType = wxEVT_ERASE_BACKGROUND; m_id = Id; m_dc = dc; }
599 inline wxDC *GetDC() const { return m_dc; }
600};
601
602// Focus event class
603/*
604 wxEVT_SET_FOCUS
605 wxEVT_KILL_FOCUS
606 */
607
608class WXDLLEXPORT wxFocusEvent: public wxEvent
609{
610 DECLARE_DYNAMIC_CLASS(wxFocusEvent)
611
612 public:
64693098 613 inline wxFocusEvent(wxEventType type = wxEVT_NULL, int Id = 0) { m_eventType = type; m_id = Id; }
c801d85f
KB
614};
615
616// Activate event class
617/*
618 wxEVT_ACTIVATE
619 wxEVT_ACTIVATE_APP
620 */
621
622class WXDLLEXPORT wxActivateEvent: public wxEvent
623{
624 DECLARE_DYNAMIC_CLASS(wxActivateEvent)
625
626 public:
627 bool m_active;
64693098 628 inline wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = TRUE, int Id = 0) { m_eventType = type; m_active = active; m_id = Id; }
c801d85f
KB
629 inline bool GetActive(void) const { return m_active; }
630};
631
632// InitDialog event class
633/*
634 wxEVT_INIT_DIALOG
635 */
636
637class WXDLLEXPORT wxInitDialogEvent: public wxEvent
638{
639 DECLARE_DYNAMIC_CLASS(wxInitDialogEvent)
640
641 public:
642 inline wxInitDialogEvent(int Id = 0) { m_eventType = wxEVT_INIT_DIALOG; m_id = Id; }
643};
644
645// Miscellaneous menu event class
646/*
647 wxEVT_MENU_CHAR,
648 wxEVT_MENU_INIT,
649 wxEVT_MENU_HIGHLIGHT,
650 wxEVT_POPUP_MENU_INIT,
651 wxEVT_CONTEXT_MENU,
652*/
653
654class WXDLLEXPORT wxMenuEvent: public wxEvent
655{
656 DECLARE_DYNAMIC_CLASS(wxMenuEvent)
657
658public:
659 int m_menuId;
660
64693098 661 inline wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0) { m_eventType = type; m_menuId = id; }
c801d85f
KB
662
663 inline int GetMenuId(void) const { return m_menuId; }
664};
665
666// Window close or session close event class
667/*
668 wxEVT_CLOSE_WINDOW,
669 wxEVT_END_SESSION,
670 wxEVT_QUERY_END_SESSION
671 */
672
673class WXDLLEXPORT wxCloseEvent: public wxEvent
674{
675 DECLARE_DYNAMIC_CLASS(wxCloseEvent)
676public:
677
64693098 678 inline wxCloseEvent(wxEventType type = wxEVT_NULL, int id = 0)
c801d85f
KB
679 { m_eventType = type; m_sessionEnding = TRUE; m_loggingOff = TRUE; m_veto = FALSE;
680 m_id = id; m_force = FALSE; }
681
682 inline bool GetSessionEnding(void) const { return m_sessionEnding; }
683 inline bool GetLoggingOff(void) const { return m_loggingOff; }
684 inline void Veto(bool veto = TRUE) { m_veto = veto; }
685 inline bool GetVeto(void) const { return m_veto; }
686 inline void SetForce(bool force) { m_force = force; }
687 inline bool GetForce(void) const { return m_force; }
688
689 protected:
690 bool m_sessionEnding;
691 bool m_loggingOff;
692 bool m_veto;
693 bool m_force;
694
695};
696
697/*
698 wxEVT_SHOW
699 */
700
701class WXDLLEXPORT wxShowEvent: public wxEvent
702{
703 DECLARE_DYNAMIC_CLASS(wxShowEvent)
704public:
705
706 inline wxShowEvent(int id = 0, bool show = FALSE)
707 { m_eventType = wxEVT_SHOW; m_id = id; m_show = show; }
708
709 inline void SetShow(bool show) { m_show = show; }
710 inline bool GetShow(void) const { return m_show; }
711
712protected:
713 bool m_show;
714};
715
716/*
717 wxEVT_ICONIZE
718 */
719
720class WXDLLEXPORT wxIconizeEvent: public wxEvent
721{
722 DECLARE_DYNAMIC_CLASS(wxIconizeEvent)
723public:
724
725 inline wxIconizeEvent(int id = 0)
726 { m_eventType = wxEVT_ICONIZE; m_id = id; }
727};
728
729/*
730 wxEVT_MAXIMIZE
731 */
732
733class WXDLLEXPORT wxMaximizeEvent: public wxEvent
734{
735 DECLARE_DYNAMIC_CLASS(wxMaximizeEvent)
736public:
737
738 inline wxMaximizeEvent(int id = 0)
739 { m_eventType = wxEVT_MAXIMIZE; m_id = id; }
740};
741
742// Joystick event class
743/*
744 wxEVT_JOY_BUTTON_DOWN,
745 wxEVT_JOY_BUTTON_UP,
746 wxEVT_JOY_MOVE,
747 wxEVT_JOY_ZMOVE
748*/
749
750// Which joystick? Same as Windows ids so no conversion necessary.
751#define wxJOYSTICK1 0
752#define wxJOYSTICK2 1
753
754// Which button is down?
755#define wxJOY_BUTTON1 1
756#define wxJOY_BUTTON2 2
757#define wxJOY_BUTTON3 4
758#define wxJOY_BUTTON4 8
759#define wxJOY_BUTTON_ANY -1
760
761class WXDLLEXPORT wxJoystickEvent: public wxEvent
762{
763 DECLARE_DYNAMIC_CLASS(wxJoystickEvent)
764
765 public:
766 wxPoint m_pos;
767 int m_zPosition;
768 int m_buttonChange; // Which button changed?
769 int m_buttonState; // Which buttons are down?
770 int m_joyStick; // Which joystick?
771
64693098 772 inline wxJoystickEvent(wxEventType type = wxEVT_NULL, int state = 0, int joystick = wxJOYSTICK1, int change = 0)
c801d85f
KB
773 { m_eventType = type; m_buttonState = state; m_pos = wxPoint(0,0); m_zPosition = 0;
774 m_joyStick = joystick; m_buttonChange = change; }
775
776 inline wxPoint GetPosition(void) const { return m_pos; }
777 inline int GetZPosition(void) const { return m_zPosition; }
778 inline int GetButtonState(void) const { return m_buttonState; }
779 inline int GetButtonChange(void) const { return m_buttonChange; }
780 inline int GetJoystick(void) const { return m_joyStick; }
781
782 inline void SetJoystick(int stick) { m_joyStick = stick; }
783 inline void SetButtonState(int state) { m_buttonState = state; }
784 inline void SetButtonChange(int change) { m_buttonChange = change; }
785 inline void SetPosition(const wxPoint& pos) { m_pos = pos; }
786 inline void SetZPosition(int zPos) { m_zPosition = zPos; }
787
788 // Was it a button event? (*doesn't* mean: is any button *down*?)
789 inline bool IsButton(void) const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) ||
790 (GetEventType() == wxEVT_JOY_BUTTON_DOWN)); }
791
792 // Was it a move event?
793 inline bool IsMove(void) const { return (GetEventType() == wxEVT_JOY_MOVE) ; }
794
795 // Was it a zmove event?
796 inline bool IsZMove(void) const { return (GetEventType() == wxEVT_JOY_ZMOVE) ; }
797
798 // Was it a down event from button 1, 2, 3, 4 or any?
799 inline bool ButtonDown(int but = wxJOY_BUTTON_ANY) const
800 { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) &&
801 ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
802
803 // Was it a up event from button 1, 2, 3 or any?
804 inline bool ButtonUp(int but = wxJOY_BUTTON_ANY) const
805 { return ((GetEventType() == wxEVT_JOY_BUTTON_UP) &&
806 ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); }
807
808 // Was the given button 1,2,3,4 or any in Down state?
809 inline bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const
810 { return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) ||
811 ((m_buttonState & but) == but)); }
812};
813
814// Drop files event class
815/*
816 wxEVT_DROP_FILES
817 */
818
819class WXDLLEXPORT wxDropFilesEvent: public wxEvent
820{
821 DECLARE_DYNAMIC_CLASS(wxDropFilesEvent)
822
823 public:
824 int m_noFiles;
825 wxPoint m_pos;
826 wxString* m_files; // Memory (de)allocated by code calling ProcessEvent
827
64693098 828 inline wxDropFilesEvent(wxEventType type = wxEVT_NULL, int noFiles = 0, wxString *files = NULL)
c801d85f
KB
829 { m_eventType = type; m_noFiles = noFiles; m_files = files; }
830
831 inline wxPoint GetPosition(void) const { return m_pos; }
832 inline int GetNumberOfFiles(void) const { return m_noFiles; }
833 inline wxString *GetFiles(void) const { return m_files; }
834};
835
836// Idle event
837/*
838 wxEVT_IDLE
839 */
840
841class WXDLLEXPORT wxIdleEvent: public wxEvent
842{
843 DECLARE_DYNAMIC_CLASS(wxIdleEvent)
844
845public:
846 inline wxIdleEvent(void)
847 { m_eventType = wxEVT_IDLE; m_requestMore = FALSE; }
848
849 inline void RequestMore(bool needMore = TRUE) { m_requestMore = needMore; }
850 inline bool MoreRequested(void) const { return m_requestMore; }
851
852protected:
853 bool m_requestMore;
854};
855
856// Update UI event
857/*
858 wxEVT_UPDATE_UI
859 */
860
861class WXDLLEXPORT wxMenu;
862class WXDLLEXPORT wxWindow;
863
864class WXDLLEXPORT wxUpdateUIEvent: public wxEvent
865{
866 DECLARE_DYNAMIC_CLASS(wxUpdateUIEvent)
867
868 inline wxUpdateUIEvent(wxWindowID commandId = 0)
869 { m_eventType = wxEVT_UPDATE_UI; m_id = commandId;
870 m_checked = FALSE; m_setChecked = FALSE; m_enabled = FALSE; m_setEnabled = FALSE;
871 m_setText = FALSE; m_text = ""; }
872
873 inline bool GetChecked(void) const { return m_checked; }
874 inline bool GetEnabled(void) const { return m_enabled; }
875 inline wxString GetText(void) const { return m_text; }
876 inline bool GetSetText(void) const { return m_setText; }
877 inline bool GetSetChecked(void) const { return m_setChecked; }
878 inline bool GetSetEnabled(void) const { return m_setEnabled; }
879
880 inline void Check(bool check) { m_checked = check; m_setChecked = TRUE; }
881 inline void Enable(bool enable) { m_enabled = enable; m_setEnabled = TRUE; }
882 inline void SetText(const wxString& text) { m_text = text; m_setText = TRUE; }
883
884 protected:
885
886 bool m_checked;
887 bool m_enabled;
888 bool m_setEnabled;
889 bool m_setText;
890 bool m_setChecked;
891 wxString m_text;
892
893};
894
895/*
896 wxEVT_SYS_COLOUR_CHANGED
897 */
898
899// TODO: shouldn't all events record the window ID?
900class WXDLLEXPORT wxSysColourChangedEvent: public wxEvent
901{
902 DECLARE_DYNAMIC_CLASS(wxSysColourChangedEvent)
903
904 public:
905 inline wxSysColourChangedEvent(void)
906 { m_eventType = wxEVT_SYS_COLOUR_CHANGED; }
907};
908
e5fb7191 909/* TODO
c801d85f
KB
910 wxEVT_POWER,
911 wxEVT_CREATE,
912 wxEVT_DESTROY,
c801d85f
KB
913 wxEVT_MOUSE_CAPTURE_CHANGED,
914 wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95)
915 wxEVT_QUERY_NEW_PALETTE,
916 wxEVT_PALETTE_CHANGED,
917// wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate
918 // wxEVT_FONT_CHANGED to all other windows (maybe).
919 wxEVT_DRAW_ITEM, // Leave these three as virtual functions in wxControl?? Platform-specific.
920 wxEVT_MEASURE_ITEM,
921 wxEVT_COMPARE_ITEM
922*/
923
924class WXDLLEXPORT wxWindow;
925class WXDLLEXPORT wxControl;
926
927// struct WXDLLEXPORT wxEventTableEntry;
928
929typedef void (wxObject::*wxObjectEventFunction)(wxEvent&);
930
931struct WXDLLEXPORT wxEventTableEntry
932{
003a43dc
JS
933 // For some reason, this can't be wxEventType, or VC++ complains.
934 int m_eventType; // main event type
935 int m_id; // control/menu/toolbar id
936 int m_lastId; // used for ranges of ids
c801d85f
KB
937 wxObjectEventFunction m_fn; // function to call: not wxEventFunction, because
938 // of dependency problems
fe71f65c 939 wxObject* m_callbackUserData;
c801d85f
KB
940};
941
942struct WXDLLEXPORT wxEventTable
943{
944 const wxEventTable *baseTable; // Points to base event table (next in chain)
945 const wxEventTableEntry *entries; // Points to bottom of entry array
946};
947
948class WXDLLEXPORT wxEvtHandler: public wxObject
949{
950 DECLARE_DYNAMIC_CLASS(wxEvtHandler)
951 public:
952 wxEvtHandler(void);
953 ~wxEvtHandler(void);
954
955 inline wxEvtHandler *GetNextHandler(void) const { return m_nextHandler; }
956 inline wxEvtHandler *GetPreviousHandler(void) const { return m_previousHandler; }
957 inline void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; }
958 inline void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; }
959
960 inline void SetEvtHandlerEnabled(bool en) { m_enabled = en; }
961 inline bool GetEvtHandlerEnabled(void) const { return m_enabled; }
962
963 inline virtual void OnCommand(wxWindow& WXUNUSED(win), wxCommandEvent& WXUNUSED(event)) {};
964 // Called if child control has no
965 // callback function
966 // Default behaviour
967 virtual long Default(void) { if (GetNextHandler()) return GetNextHandler()->Default(); else return 0; };
968#if WXWIN_COMPATIBILITY
969 virtual void OldOnMenuCommand(int WXUNUSED(cmd));
970 virtual void OldOnMenuSelect(int WXUNUSED(cmd));
971 virtual void OldOnInitMenuPopup(int WXUNUSED(pos));
972 virtual void OldOnScroll(wxCommandEvent& WXUNUSED(event));
973 virtual void OldOnPaint(void);
974 virtual void OldOnSize(int WXUNUSED(width), int WXUNUSED(height));
975 virtual void OldOnMove(int WXUNUSED(x), int WXUNUSED(y));
976 virtual void OldOnMouseEvent(wxMouseEvent& WXUNUSED(event));
977 virtual void OldOnChar(wxKeyEvent& WXUNUSED(event));
978 // Under Windows, we can intercept character input per dialog or frame
979 virtual bool OldOnCharHook(wxKeyEvent& WXUNUSED(event));
980 virtual void OldOnActivate(bool WXUNUSED(active));
981 virtual void OldOnSetFocus(void);
982 virtual void OldOnKillFocus(void);
983 virtual bool OldOnSysColourChange(void);
984 virtual void OldOnDropFiles(int n, char *files[], int x, int y);
985#endif
986
987 virtual bool OnClose(void);
988 virtual void OnDefaultAction(wxControl *WXUNUSED(initiatingItem)) {};
989 virtual void OnChangeFocus(wxControl *WXUNUSED(from), wxControl *WXUNUSED(to)) {};
990 virtual bool OnFunctionKey(wxKeyEvent &WXUNUSED(event)) { return FALSE; };
991
992 inline char *GetClientData(void) const { return m_clientData; }
993 inline void SetClientData(char *clientData) { m_clientData = clientData; }
994
995 virtual bool ProcessEvent(wxEvent& event);
996 virtual bool SearchEventTable(wxEventTable& table, wxEvent& event);
fe71f65c
RR
997
998 void Connect( const int id, const int lastId,
999 const int eventType,
1000 wxObjectEventFunction func,
1001 wxObject *userData = NULL );
1002
1003 bool SearchDynamicEventTable( wxEvent& event );
c801d85f
KB
1004
1005private:
1006 static const wxEventTableEntry sm_eventTableEntries[];
1007protected:
1008 static const wxEventTable sm_eventTable;
1009 virtual const wxEventTable* GetEventTable() const;
1010protected:
1011 wxEvtHandler* m_nextHandler;
1012 wxEvtHandler* m_previousHandler;
1013 char* m_clientData; // Any user client data
1014 bool m_enabled; // Is event handler enabled?
fe71f65c 1015 wxList* m_dynamicEvents;
c801d85f
KB
1016
1017};
1018
1019typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&);
1020typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&);
1021typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&);
1022typedef void (wxEvtHandler::*wxSizeEventFunction)(wxSizeEvent&);
1023typedef void (wxEvtHandler::*wxMoveEventFunction)(wxMoveEvent&);
1024typedef void (wxEvtHandler::*wxPaintEventFunction)(wxPaintEvent&);
1025typedef void (wxEvtHandler::*wxEraseEventFunction)(wxEraseEvent&);
1026typedef void (wxEvtHandler::*wxMouseEventFunction)(wxMouseEvent&);
1027typedef void (wxEvtHandler::*wxCharEventFunction)(wxKeyEvent&);
1028typedef void (wxEvtHandler::*wxFocusEventFunction)(wxFocusEvent&);
1029typedef void (wxEvtHandler::*wxActivateEventFunction)(wxActivateEvent&);
1030typedef void (wxEvtHandler::*wxMenuEventFunction)(wxMenuEvent&);
1031typedef void (wxEvtHandler::*wxJoystickEventFunction)(wxJoystickEvent&);
1032typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&);
1033typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&);
1034typedef void (wxEvtHandler::*wxSysColourChangedFunction)(wxSysColourChangedEvent&);
1035typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&);
1036typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&);
1037typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&);
1038typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&);
1039typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxShowEvent&);
1040typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxShowEvent&);
1041
1042// N.B. In GNU-WIN32, you *have* to take the address of a member function
1043// (use &) or the compiler crashes...
1044
1045#define DECLARE_EVENT_TABLE() \
1046private:\
1047 static const wxEventTableEntry sm_eventTableEntries[];\
1048protected:\
1049 static const wxEventTable sm_eventTable;\
1050 virtual const wxEventTable* GetEventTable() const;
1051
1052#define BEGIN_EVENT_TABLE(theClass, baseClass) \
1053const wxEventTable *theClass::GetEventTable() const { return &theClass::sm_eventTable; }\
1054const wxEventTable theClass::sm_eventTable =\
1055 { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] };\
1056const wxEventTableEntry theClass::sm_eventTableEntries[] = { \
1057
1058#define END_EVENT_TABLE() \
1059 { 0, 0, 0, 0 } };
1060
1061/*
1062 * Event table macros
1063 */
1064
1065// Generic events
fe71f65c
RR
1066#define EVT_CUSTOM(event, id, func) { event, id, -1, (wxObjectEventFunction) (wxEventFunction) & func, NULL },
1067#define EVT_CUSTOM_RANGE(event, id1, id2, func) { event, id1, id2, (wxObjectEventFunction) (wxEventFunction) & func, NULL },
c801d85f
KB
1068
1069// Miscellaneous
fe71f65c
RR
1070#define EVT_SIZE(func) { wxEVT_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxSizeEventFunction) & func, NULL },
1071#define EVT_MOVE(func) { wxEVT_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMoveEventFunction) & func, NULL },
1072#define EVT_CLOSE(func) { wxEVT_CLOSE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, NULL },
1073#define EVT_PAINT(func) { wxEVT_PAINT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaintEventFunction) & func, NULL },
1074#define EVT_ERASE_BACKGROUND(func) { wxEVT_ERASE_BACKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxEraseEventFunction) & func, NULL },
1075#define EVT_CHAR(func) { wxEVT_CHAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, NULL },
1076#define EVT_CHAR_HOOK(func) { wxEVT_CHAR_HOOK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, NULL },
1077#define EVT_MENU_HIGHLIGHT(id, func) { wxEVT_MENU_HIGHLIGHT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMenuEventFunction) & func, NULL },
1078#define EVT_MENU_HIGHLIGHT_ALL(func) { wxEVT_MENU_HIGHLIGHT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMenuEventFunction) & func, NULL },
1079#define EVT_SET_FOCUS(func) { wxEVT_SET_FOCUS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxFocusEventFunction) & func, NULL },
1080#define EVT_KILL_FOCUS(func) { wxEVT_KILL_FOCUS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxFocusEventFunction) & func, NULL },
1081#define EVT_ACTIVATE(func) { wxEVT_ACTIVATE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxActivateEventFunction) & func, NULL },
1082#define EVT_ACTIVATE_APP(func) { wxEVT_ACTIVATE_APP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxActivateEventFunction) & func, NULL },
1083#define EVT_END_SESSION(func) { wxEVT_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, NULL },
1084#define EVT_QUERY_END_SESSION(func) { wxEVT_QUERY_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, NULL },
1085#define EVT_DROP_FILES(func) { wxEVT_DROP_FILES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxDropFilesEventFunction) & func, NULL },
1086#define EVT_INIT_DIALOG(func) { wxEVT_INIT_DIALOG, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxInitDialogEventFunction) & func, NULL },
1087#define EVT_SYS_COLOUR_CHANGED(func) { wxEVT_SYS_COLOUR_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxSysColourChangedFunction) & func, NULL },
1088#define EVT_SHOW(func) { wxEVT_SHOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxShowEventFunction) & func, NULL },
1089#define EVT_MAXIMIZE(func) { wxEVT_MAXIMIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMaximizeEventFunction) & func, NULL },
1090#define EVT_ICONIZE(func) { wxEVT_ICONIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxIconizeEventFunction) & func, NULL },
c801d85f
KB
1091
1092// Mouse events
fe71f65c
RR
1093#define EVT_LEFT_DOWN(func) { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
1094#define EVT_LEFT_UP(func) { wxEVT_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
1095#define EVT_MIDDLE_DOWN(func) { wxEVT_MIDDLE_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
1096#define EVT_MIDDLE_UP(func) { wxEVT_MIDDLE_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
1097#define EVT_RIGHT_DOWN(func) { wxEVT_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
1098#define EVT_RIGHT_UP(func) { wxEVT_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
1099#define EVT_MOTION(func) { wxEVT_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
1100#define EVT_LEFT_DCLICK(func) { wxEVT_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
1101#define EVT_MIDDLE_DCLICK(func) { wxEVT_MIDDLE_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
1102#define EVT_RIGHT_DCLICK(func) { wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
1103#define EVT_LEAVE_WINDOW(func) { wxEVT_LEAVE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
1104#define EVT_ENTER_WINDOW(func) { wxEVT_ENTER_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
c801d85f
KB
1105
1106// All mouse events
1107#define EVT_MOUSE_EVENTS(func) \
fe71f65c
RR
1108 { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
1109 { wxEVT_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
1110 { wxEVT_MIDDLE_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
1111 { wxEVT_MIDDLE_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
1112 { wxEVT_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
1113 { wxEVT_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
1114 { wxEVT_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
1115 { wxEVT_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
1116 { wxEVT_MIDDLE_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
43d811ea
JS
1117 { wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
1118 { wxEVT_ENTER_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },\
1119 { wxEVT_LEAVE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, NULL },
c801d85f
KB
1120
1121// EVT_COMMAND
fe71f65c
RR
1122#define EVT_COMMAND(id, cmd, fn) { cmd, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1123#define EVT_COMMAND_RANGE(id1, id2, cmd, fn) { cmd, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
c801d85f
KB
1124
1125// Scrolling
1126#define EVT_SCROLL(func) \
fe71f65c
RR
1127 { wxEVT_SCROLL_TOP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },\
1128 { wxEVT_SCROLL_BOTTOM, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },\
1129 { wxEVT_SCROLL_LINEUP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },\
1130 { wxEVT_SCROLL_LINEDOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },\
1131 { wxEVT_SCROLL_PAGEUP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },\
1132 { wxEVT_SCROLL_PAGEDOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },\
1133 { wxEVT_SCROLL_THUMBTRACK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1134
1135#define EVT_SCROLL_TOP(func) { wxEVT_SCROLL_TOP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1136#define EVT_SCROLL_BOTTOM(func) { wxEVT_SCROLL_BOTTOM, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1137#define EVT_SCROLL_LINEUP(func) { wxEVT_SCROLL_LINEUP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1138#define EVT_SCROLL_LINEDOWN(func) { wxEVT_SCROLL_LINEDOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1139#define EVT_SCROLL_PAGEUP(func) { wxEVT_SCROLL_PAGEUP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1140#define EVT_SCROLL_PAGEDOWN(func) { wxEVT_SCROLL_PAGEDOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1141#define EVT_SCROLL_THUMBTRACK(func) { wxEVT_SCROLL_THUMBTRACK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
c801d85f
KB
1142
1143// Scrolling, with an id
1144#define EVT_COMMAND_SCROLL(id, func) \
fe71f65c
RR
1145 { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },\
1146 { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },\
1147 { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },\
1148 { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },\
1149 { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },\
1150 { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },\
1151 { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1152
1153#define EVT_COMMAND_SCROLL_TOP(id, func) { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1154#define EVT_COMMAND_SCROLL_BOTTOM(id, func) { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1155#define EVT_COMMAND_SCROLL_LINEUP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1156#define EVT_COMMAND_SCROLL_LINEDOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1157#define EVT_COMMAND_SCROLL_PAGEUP(id, func) { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1158#define EVT_COMMAND_SCROLL_PAGEDOWN(id, func) { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
1159#define EVT_COMMAND_SCROLL_THUMBTRACK(id, func) { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, NULL },
c801d85f
KB
1160
1161// Convenience macros for commonly-used commands
fe71f65c
RR
1162#define EVT_BUTTON(id, fn) { wxEVT_COMMAND_BUTTON_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1163#define EVT_CHECKBOX(id, fn) { wxEVT_COMMAND_CHECKBOX_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1164#define EVT_CHOICE(id, fn) { wxEVT_COMMAND_CHOICE_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1165#define EVT_LISTBOX(id, fn) { wxEVT_COMMAND_LISTBOX_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1166#define EVT_TEXT(id, fn) { wxEVT_COMMAND_TEXT_UPDATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1167#define EVT_TEXT_ENTER(id, fn) { wxEVT_COMMAND_TEXT_ENTER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1168#define EVT_MENU(id, fn) { wxEVT_COMMAND_MENU_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1169#define EVT_MENU_RANGE(id1, id2, fn) { wxEVT_COMMAND_MENU_SELECTED, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1170#define EVT_SLIDER(id, fn) { wxEVT_COMMAND_SLIDER_UPDATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1171#define EVT_RADIOBOX(id, fn) { wxEVT_COMMAND_RADIOBOX_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1172#define EVT_RADIOBUTTON(id, fn) { wxEVT_COMMAND_RADIOBUTTON_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
c801d85f 1173// EVT_SCROLLBAR is now obsolete since we use EVT_COMMAND_SCROLL... events
fe71f65c
RR
1174#define EVT_SCROLLBAR(id, fn) { wxEVT_COMMAND_SCROLLBAR_UPDATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1175#define EVT_VLBOX(id, fn) { wxEVT_COMMAND_VLBOX_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1176#define EVT_COMBOBOX(id, fn) { wxEVT_COMMAND_COMBOBOX_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1177#define EVT_TOOL(id, fn) { wxEVT_COMMAND_TOOL_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1178#define EVT_TOOL_RCLICKED(id, fn) { wxEVT_COMMAND_TOOL_RCLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1179#define EVT_TOOL_ENTER(id, fn) { wxEVT_COMMAND_TOOL_ENTER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1180#define EVT_CHECKLISTBOX(id, fn) { wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
c801d85f
KB
1181
1182// Generic command events
fe71f65c
RR
1183#define EVT_COMMAND_LEFT_CLICK(id, fn) { wxEVT_COMMAND_LEFT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1184#define EVT_COMMAND_LEFT_DCLICK(id, fn) { wxEVT_COMMAND_LEFT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1185#define EVT_COMMAND_RIGHT_CLICK(id, fn) { wxEVT_COMMAND_RIGHT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1186#define EVT_COMMAND_RIGHT_DCLICK(id, fn) { wxEVT_COMMAND_RIGHT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1187#define EVT_COMMAND_SET_FOCUS(id, fn) { wxEVT_COMMAND_SET_FOCUS, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1188#define EVT_COMMAND_KILL_FOCUS(id, fn) { wxEVT_COMMAND_KILL_FOCUS, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
1189#define EVT_COMMAND_ENTER(id, fn) { wxEVT_COMMAND_ENTER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, NULL },
c801d85f
KB
1190
1191// Joystick events
1192#define EVT_JOY_DOWN(func) \
fe71f65c 1193 { wxEVT_JOY_BUTTON_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, NULL },
c801d85f 1194#define EVT_JOY_UP(func) \
fe71f65c 1195 { wxEVT_JOY_BUTTON_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, NULL },
c801d85f 1196#define EVT_JOY_MOVE(func) \
fe71f65c 1197 { wxEVT_JOY_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, NULL },
c801d85f 1198#define EVT_JOY_ZMOVE(func) \
fe71f65c 1199 { wxEVT_JOY_ZMOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, NULL },
c801d85f
KB
1200
1201// All joystick events
1202#define EVT_JOYSTICK_EVENTS(func) \
fe71f65c
RR
1203 { wxEVT_JOY_BUTTON_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, NULL },\
1204 { wxEVT_JOY_BUTTON_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, NULL },\
1205 { wxEVT_JOY_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, NULL },\
1206 { wxEVT_JOY_ZMOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, NULL },\
c801d85f
KB
1207
1208// Idle event
1209#define EVT_IDLE(func) \
fe71f65c 1210 { wxEVT_IDLE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) & func, NULL },\
c801d85f
KB
1211
1212// Update UI event
1213#define EVT_UPDATE_UI(id, func) \
fe71f65c 1214 { wxEVT_UPDATE_UI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxUpdateUIEventFunction) & func, NULL },\
c801d85f
KB
1215
1216#endif
1217 // __EVENTH__