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