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