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