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