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