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