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