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