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