]>
Commit | Line | Data |
---|---|---|
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) | |
2b854a32 | 9 | // Licence: wxWindows licence |
c801d85f KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
34138703 JS |
12 | #ifndef _WX_EVENTH__ |
13 | #define _WX_EVENTH__ | |
c801d85f KB |
14 | |
15 | #ifdef __GNUG__ | |
2b854a32 | 16 | #pragma interface "event.h" |
c801d85f KB |
17 | #endif |
18 | ||
19 | #include "wx/defs.h" | |
20 | #include "wx/object.h" | |
e90c1d2a VZ |
21 | |
22 | #if wxUSE_GUI | |
23 | #include "wx/gdicmn.h" | |
24 | #endif | |
42e69d6b | 25 | |
72cdf4c9 | 26 | #include "wx/thread.h" |
c801d85f | 27 | |
e90c1d2a VZ |
28 | // ---------------------------------------------------------------------------- |
29 | // forward declarations | |
30 | // ---------------------------------------------------------------------------- | |
31 | ||
32 | class WXDLLEXPORT wxList; | |
33 | ||
34 | #if wxUSE_GUI | |
35 | class WXDLLEXPORT wxClientData; | |
36 | class WXDLLEXPORT wxDC; | |
37 | class WXDLLEXPORT wxMenu; | |
73974df1 | 38 | class WXDLLEXPORT wxWindow; |
e90c1d2a VZ |
39 | #endif // wxUSE_GUI |
40 | ||
41 | // ---------------------------------------------------------------------------- | |
42 | // Event types | |
43 | // ---------------------------------------------------------------------------- | |
64693098 | 44 | |
0757d27c JS |
45 | typedef int wxEventType; |
46 | ||
66b6b045 | 47 | #if defined(__VISAGECPP__) && __IBMCPP__ >= 400 |
67b81440 | 48 | // must define these static for VA or else you get multiply defined symbols everywhere |
5d33ed2c DW |
49 | extern const wxEventType wxEVT_NULL; |
50 | extern const wxEventType wxEVT_FIRST; | |
51 | ||
52 | extern const wxEventType wxEVT_COMMAND_BUTTON_CLICKED; | |
53 | extern const wxEventType wxEVT_COMMAND_CHECKBOX_CLICKED; | |
54 | extern const wxEventType wxEVT_COMMAND_CHOICE_SELECTED; | |
55 | extern const wxEventType wxEVT_COMMAND_LISTBOX_SELECTED; | |
56 | extern const wxEventType wxEVT_COMMAND_LISTBOX_DOUBLECLICKED; | |
57 | extern const wxEventType wxEVT_COMMAND_CHECKLISTBOX_TOGGLED; | |
58 | extern const wxEventType wxEVT_COMMAND_TEXT_UPDATED; | |
59 | extern const wxEventType wxEVT_COMMAND_TEXT_ENTER; | |
60 | extern const wxEventType wxEVT_COMMAND_MENU_SELECTED; | |
61 | extern const wxEventType wxEVT_COMMAND_TOOL_CLICKED; | |
62 | extern const wxEventType wxEVT_COMMAND_SLIDER_UPDATED; | |
63 | extern const wxEventType wxEVT_COMMAND_RADIOBOX_SELECTED; | |
64 | extern const wxEventType wxEVT_COMMAND_RADIOBUTTON_SELECTED; | |
65 | extern const wxEventType wxEVT_COMMAND_SCROLLBAR_UPDATED; | |
66 | extern const wxEventType wxEVT_COMMAND_VLBOX_SELECTED; | |
67 | extern const wxEventType wxEVT_COMMAND_COMBOBOX_SELECTED; | |
68 | extern const wxEventType wxEVT_COMMAND_TOOL_RCLICKED; | |
69 | extern const wxEventType wxEVT_COMMAND_TOOL_ENTER; | |
70 | extern const wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED; | |
66b6b045 DW |
71 | |
72 | /* Sockets send events, too */ | |
5d33ed2c | 73 | extern const wxEventType wxEVT_SOCKET; |
66b6b045 DW |
74 | |
75 | /* Mouse event types */ | |
5d33ed2c DW |
76 | extern const wxEventType wxEVT_LEFT_DOWN; |
77 | extern const wxEventType wxEVT_LEFT_UP; | |
78 | extern const wxEventType wxEVT_MIDDLE_DOWN; | |
79 | extern const wxEventType wxEVT_MIDDLE_UP; | |
80 | extern const wxEventType wxEVT_RIGHT_DOWN; | |
81 | extern const wxEventType wxEVT_RIGHT_UP; | |
82 | extern const wxEventType wxEVT_MOTION; | |
83 | extern const wxEventType wxEVT_ENTER_WINDOW; | |
84 | extern const wxEventType wxEVT_LEAVE_WINDOW; | |
85 | extern const wxEventType wxEVT_LEFT_DCLICK; | |
86 | extern const wxEventType wxEVT_MIDDLE_DCLICK; | |
87 | extern const wxEventType wxEVT_RIGHT_DCLICK; | |
88 | extern const wxEventType wxEVT_SET_FOCUS; | |
89 | extern const wxEventType wxEVT_KILL_FOCUS; | |
66b6b045 DW |
90 | |
91 | /* Non-client mouse events */ | |
5d33ed2c DW |
92 | extern const wxEventType wxEVT_NC_LEFT_DOWN; |
93 | extern const wxEventType wxEVT_NC_LEFT_UP; | |
94 | extern const wxEventType wxEVT_NC_MIDDLE_DOWN; | |
95 | extern const wxEventType wxEVT_NC_MIDDLE_UP; | |
96 | extern const wxEventType wxEVT_NC_RIGHT_DOWN; | |
97 | extern const wxEventType wxEVT_NC_RIGHT_UP; | |
98 | extern const wxEventType wxEVT_NC_MOTION; | |
99 | extern const wxEventType wxEVT_NC_ENTER_WINDOW; | |
100 | extern const wxEventType wxEVT_NC_LEAVE_WINDOW; | |
101 | extern const wxEventType wxEVT_NC_LEFT_DCLICK; | |
102 | extern const wxEventType wxEVT_NC_MIDDLE_DCLICK; | |
103 | extern const wxEventType wxEVT_NC_RIGHT_DCLICK; | |
66b6b045 DW |
104 | |
105 | /* Character input event type */ | |
5d33ed2c DW |
106 | extern const wxEventType wxEVT_CHAR; |
107 | extern const wxEventType wxEVT_CHAR_HOOK; | |
108 | extern const wxEventType wxEVT_NAVIGATION_KEY; | |
109 | extern const wxEventType wxEVT_KEY_DOWN; | |
110 | extern const wxEventType wxEVT_KEY_UP; | |
66b6b045 DW |
111 | |
112 | /* | |
113 | * wxScrollbar and wxSlider event identifiers | |
114 | */ | |
5d33ed2c DW |
115 | extern const wxEventType wxEVT_SCROLL_TOP; |
116 | extern const wxEventType wxEVT_SCROLL_BOTTOM; | |
117 | extern const wxEventType wxEVT_SCROLL_LINEUP; | |
118 | extern const wxEventType wxEVT_SCROLL_LINEDOWN; | |
119 | extern const wxEventType wxEVT_SCROLL_PAGEUP; | |
120 | extern const wxEventType wxEVT_SCROLL_PAGEDOWN; | |
121 | extern const wxEventType wxEVT_SCROLL_THUMBTRACK; | |
66b6b045 DW |
122 | |
123 | /* | |
124 | * Scroll events from wxWindow | |
125 | */ | |
5d33ed2c DW |
126 | extern const wxEventType wxEVT_SCROLLWIN_TOP; |
127 | extern const wxEventType wxEVT_SCROLLWIN_BOTTOM; | |
128 | extern const wxEventType wxEVT_SCROLLWIN_LINEUP; | |
129 | extern const wxEventType wxEVT_SCROLLWIN_LINEDOWN; | |
130 | extern const wxEventType wxEVT_SCROLLWIN_PAGEUP; | |
131 | extern const wxEventType wxEVT_SCROLLWIN_PAGEDOWN; | |
132 | extern const wxEventType wxEVT_SCROLLWIN_THUMBTRACK; | |
66b6b045 DW |
133 | |
134 | /* | |
135 | * System events | |
136 | */ | |
5d33ed2c DW |
137 | extern const wxEventType wxEVT_SIZE; |
138 | extern const wxEventType wxEVT_MOVE; | |
139 | extern const wxEventType wxEVT_CLOSE_WINDOW; | |
140 | extern const wxEventType wxEVT_END_SESSION; | |
141 | extern const wxEventType wxEVT_QUERY_END_SESSION; | |
142 | extern const wxEventType wxEVT_ACTIVATE_APP; | |
143 | extern const wxEventType wxEVT_POWER; | |
144 | extern const wxEventType wxEVT_ACTIVATE; | |
145 | extern const wxEventType wxEVT_CREATE; | |
146 | extern const wxEventType wxEVT_DESTROY; | |
147 | extern const wxEventType wxEVT_SHOW; | |
148 | extern const wxEventType wxEVT_ICONIZE; | |
149 | extern const wxEventType wxEVT_MAXIMIZE; | |
150 | extern const wxEventType wxEVT_MOUSE_CAPTURE_CHANGED; | |
151 | extern const wxEventType wxEVT_PAINT; | |
152 | extern const wxEventType wxEVT_ERASE_BACKGROUND; | |
153 | extern const wxEventType wxEVT_NC_PAINT; | |
154 | extern const wxEventType wxEVT_PAINT_ICON; | |
155 | extern const wxEventType wxEVT_MENU_CHAR; | |
156 | extern const wxEventType wxEVT_MENU_INIT; | |
157 | extern const wxEventType wxEVT_MENU_HIGHLIGHT; | |
158 | extern const wxEventType wxEVT_POPUP_MENU_INIT; | |
159 | extern const wxEventType wxEVT_CONTEXT_MENU; | |
160 | extern const wxEventType wxEVT_SYS_COLOUR_CHANGED; | |
161 | extern const wxEventType wxEVT_SETTING_CHANGED; | |
162 | extern const wxEventType wxEVT_QUERY_NEW_PALETTE; | |
163 | extern const wxEventType wxEVT_PALETTE_CHANGED; | |
164 | extern const wxEventType wxEVT_JOY_BUTTON_DOWN; | |
165 | extern const wxEventType wxEVT_JOY_BUTTON_UP; | |
166 | extern const wxEventType wxEVT_JOY_MOVE; | |
167 | extern const wxEventType wxEVT_JOY_ZMOVE; | |
168 | extern const wxEventType wxEVT_DROP_FILES; | |
169 | extern const wxEventType wxEVT_DRAW_ITEM; | |
170 | extern const wxEventType wxEVT_MEASURE_ITEM; | |
171 | extern const wxEventType wxEVT_COMPARE_ITEM; | |
172 | extern const wxEventType wxEVT_INIT_DIALOG; | |
173 | extern const wxEventType wxEVT_IDLE; | |
174 | extern const wxEventType wxEVT_UPDATE_UI; | |
66b6b045 DW |
175 | |
176 | /* System misc. */ | |
5d33ed2c | 177 | extern const wxEventType wxEVT_END_PROCESS; |
66b6b045 DW |
178 | |
179 | /* Dial up events */ | |
5d33ed2c DW |
180 | extern const wxEventType wxEVT_DIALUP_CONNECTED; |
181 | extern const wxEventType wxEVT_DIALUP_DISCONNECTED; | |
66b6b045 DW |
182 | |
183 | /* Generic command events */ | |
184 | /* Note: a click is a higher-level event than button down/up */ | |
5d33ed2c DW |
185 | extern const wxEventType wxEVT_COMMAND_LEFT_CLICK; |
186 | extern const wxEventType wxEVT_COMMAND_LEFT_DCLICK; | |
187 | extern const wxEventType wxEVT_COMMAND_RIGHT_CLICK; | |
188 | extern const wxEventType wxEVT_COMMAND_RIGHT_DCLICK; | |
189 | extern const wxEventType wxEVT_COMMAND_SET_FOCUS; | |
190 | extern const wxEventType wxEVT_COMMAND_KILL_FOCUS; | |
191 | extern const wxEventType wxEVT_COMMAND_ENTER; | |
66b6b045 DW |
192 | |
193 | /* Tree control event types */ | |
5d33ed2c DW |
194 | extern const wxEventType wxEVT_COMMAND_TREE_BEGIN_DRAG; |
195 | extern const wxEventType wxEVT_COMMAND_TREE_BEGIN_RDRAG; | |
196 | extern const wxEventType wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT; | |
197 | extern const wxEventType wxEVT_COMMAND_TREE_END_LABEL_EDIT; | |
198 | extern const wxEventType wxEVT_COMMAND_TREE_DELETE_ITEM; | |
199 | extern const wxEventType wxEVT_COMMAND_TREE_GET_INFO; | |
200 | extern const wxEventType wxEVT_COMMAND_TREE_SET_INFO; | |
201 | extern const wxEventType wxEVT_COMMAND_TREE_ITEM_EXPANDED; | |
202 | extern const wxEventType wxEVT_COMMAND_TREE_ITEM_EXPANDING; | |
203 | extern const wxEventType wxEVT_COMMAND_TREE_ITEM_COLLAPSED; | |
204 | extern const wxEventType wxEVT_COMMAND_TREE_ITEM_COLLAPSING; | |
205 | extern const wxEventType wxEVT_COMMAND_TREE_SEL_CHANGED; | |
206 | extern const wxEventType wxEVT_COMMAND_TREE_SEL_CHANGING; | |
207 | extern const wxEventType wxEVT_COMMAND_TREE_KEY_DOWN; | |
208 | extern const wxEventType wxEVT_COMMAND_TREE_ITEM_ACTIVATED; | |
209 | extern const wxEventType wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK; | |
210 | extern const wxEventType wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK; | |
66b6b045 DW |
211 | |
212 | /* List control event types */ | |
5d33ed2c DW |
213 | extern const wxEventType wxEVT_COMMAND_LIST_BEGIN_DRAG; |
214 | extern const wxEventType wxEVT_COMMAND_LIST_BEGIN_RDRAG; | |
215 | extern const wxEventType wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT; | |
216 | extern const wxEventType wxEVT_COMMAND_LIST_END_LABEL_EDIT; | |
217 | extern const wxEventType wxEVT_COMMAND_LIST_DELETE_ITEM; | |
218 | extern const wxEventType wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS; | |
219 | extern const wxEventType wxEVT_COMMAND_LIST_GET_INFO; | |
220 | extern const wxEventType wxEVT_COMMAND_LIST_SET_INFO; | |
221 | extern const wxEventType wxEVT_COMMAND_LIST_ITEM_SELECTED; | |
222 | extern const wxEventType wxEVT_COMMAND_LIST_ITEM_DESELECTED; | |
223 | extern const wxEventType wxEVT_COMMAND_LIST_KEY_DOWN; | |
224 | extern const wxEventType wxEVT_COMMAND_LIST_INSERT_ITEM; | |
225 | extern const wxEventType wxEVT_COMMAND_LIST_COL_CLICK; | |
226 | extern const wxEventType wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK; | |
227 | extern const wxEventType wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK; | |
228 | extern const wxEventType wxEVT_COMMAND_LIST_ITEM_ACTIVATED; | |
66b6b045 DW |
229 | |
230 | /* Tab and notebook control event types */ | |
5d33ed2c DW |
231 | extern const wxEventType wxEVT_COMMAND_TAB_SEL_CHANGED; |
232 | extern const wxEventType wxEVT_COMMAND_TAB_SEL_CHANGING; | |
233 | extern const wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED; | |
234 | extern const wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING; | |
66b6b045 DW |
235 | |
236 | /* Splitter events */ | |
5d33ed2c DW |
237 | extern const wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED; |
238 | extern const wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING; | |
239 | extern const wxEventType wxEVT_COMMAND_SPLITTER_DOUBLECLICKED; | |
240 | extern const wxEventType wxEVT_COMMAND_SPLITTER_UNSPLIT; | |
66b6b045 DW |
241 | |
242 | /* Wizard events */ | |
5d33ed2c DW |
243 | extern const wxEventType wxEVT_WIZARD_PAGE_CHANGED; |
244 | extern const wxEventType wxEVT_WIZARD_PAGE_CHANGING; | |
245 | extern const wxEventType wxEVT_WIZARD_CANCEL; | |
66b6b045 DW |
246 | |
247 | /* Calendar events */ | |
5d33ed2c DW |
248 | extern const wxEventType wxEVT_CALENDAR_SEL_CHANGED; |
249 | extern const wxEventType wxEVT_CALENDAR_DAY_CHANGED; | |
250 | extern const wxEventType wxEVT_CALENDAR_MONTH_CHANGED; | |
251 | extern const wxEventType wxEVT_CALENDAR_YEAR_CHANGED; | |
252 | extern const wxEventType wxEVT_CALENDAR_DOUBLECLICKED; | |
253 | extern const wxEventType wxEVT_CALENDAR_WEEKDAY_CLICKED; | |
254 | ||
255 | extern const wxEventType wxEVT_USER_FIRST; | |
66b6b045 DW |
256 | |
257 | #else // everybody else | |
258 | ||
0757d27c JS |
259 | const wxEventType wxEVT_NULL = 0; |
260 | const wxEventType wxEVT_FIRST = 10000; | |
261 | ||
262 | const wxEventType wxEVT_COMMAND_BUTTON_CLICKED = wxEVT_FIRST + 1; | |
263 | const wxEventType wxEVT_COMMAND_CHECKBOX_CLICKED = wxEVT_FIRST + 2; | |
264 | const wxEventType wxEVT_COMMAND_CHOICE_SELECTED = wxEVT_FIRST + 3; | |
265 | const wxEventType wxEVT_COMMAND_LISTBOX_SELECTED = wxEVT_FIRST + 4; | |
266 | const wxEventType wxEVT_COMMAND_LISTBOX_DOUBLECLICKED = wxEVT_FIRST + 5; | |
267 | const wxEventType wxEVT_COMMAND_CHECKLISTBOX_TOGGLED = wxEVT_FIRST + 6; | |
268 | const wxEventType wxEVT_COMMAND_TEXT_UPDATED = wxEVT_FIRST + 7; | |
269 | const wxEventType wxEVT_COMMAND_TEXT_ENTER = wxEVT_FIRST + 8; | |
270 | const wxEventType wxEVT_COMMAND_MENU_SELECTED = wxEVT_FIRST + 9; | |
271 | const wxEventType wxEVT_COMMAND_TOOL_CLICKED = wxEVT_COMMAND_MENU_SELECTED; | |
272 | const wxEventType wxEVT_COMMAND_SLIDER_UPDATED = wxEVT_FIRST + 10; | |
273 | const wxEventType wxEVT_COMMAND_RADIOBOX_SELECTED = wxEVT_FIRST + 11; | |
274 | const wxEventType wxEVT_COMMAND_RADIOBUTTON_SELECTED = wxEVT_FIRST + 12; | |
275 | //const wxEventType wxEVT_COMMAND_SCROLLBAR_UPDATED is now obsolete since we use wxEVT_SCROLL... events | |
276 | const wxEventType wxEVT_COMMAND_SCROLLBAR_UPDATED = wxEVT_FIRST + 13; | |
277 | const wxEventType wxEVT_COMMAND_VLBOX_SELECTED = wxEVT_FIRST + 14; | |
278 | const wxEventType wxEVT_COMMAND_COMBOBOX_SELECTED = wxEVT_FIRST + 15; | |
279 | const wxEventType wxEVT_COMMAND_TOOL_RCLICKED = wxEVT_FIRST + 16; | |
280 | const wxEventType wxEVT_COMMAND_TOOL_ENTER = wxEVT_FIRST + 17; | |
58c837a4 | 281 | const wxEventType wxEVT_COMMAND_SPINCTRL_UPDATED = wxEVT_FIRST + 18; |
c801d85f | 282 | |
db131261 RR |
283 | /* Sockets send events, too */ |
284 | const wxEventType wxEVT_SOCKET = wxEVT_FIRST + 50; | |
285 | ||
c801d85f | 286 | /* Mouse event types */ |
0757d27c JS |
287 | const wxEventType wxEVT_LEFT_DOWN = wxEVT_FIRST + 100; |
288 | const wxEventType wxEVT_LEFT_UP = wxEVT_FIRST + 101; | |
289 | const wxEventType wxEVT_MIDDLE_DOWN = wxEVT_FIRST + 102; | |
290 | const wxEventType wxEVT_MIDDLE_UP = wxEVT_FIRST + 103; | |
291 | const wxEventType wxEVT_RIGHT_DOWN = wxEVT_FIRST + 104; | |
292 | const wxEventType wxEVT_RIGHT_UP = wxEVT_FIRST + 105; | |
293 | const wxEventType wxEVT_MOTION = wxEVT_FIRST + 106; | |
294 | const wxEventType wxEVT_ENTER_WINDOW = wxEVT_FIRST + 107; | |
295 | const wxEventType wxEVT_LEAVE_WINDOW = wxEVT_FIRST + 108; | |
296 | const wxEventType wxEVT_LEFT_DCLICK = wxEVT_FIRST + 109; | |
297 | const wxEventType wxEVT_MIDDLE_DCLICK = wxEVT_FIRST + 110; | |
298 | const wxEventType wxEVT_RIGHT_DCLICK = wxEVT_FIRST + 111; | |
299 | const wxEventType wxEVT_SET_FOCUS = wxEVT_FIRST + 112; | |
300 | const wxEventType wxEVT_KILL_FOCUS = wxEVT_FIRST + 113; | |
c801d85f | 301 | |
db131261 | 302 | /* Non-client mouse events */ |
0757d27c JS |
303 | const wxEventType wxEVT_NC_LEFT_DOWN = wxEVT_FIRST + 200; |
304 | const wxEventType wxEVT_NC_LEFT_UP = wxEVT_FIRST + 201; | |
305 | const wxEventType wxEVT_NC_MIDDLE_DOWN = wxEVT_FIRST + 202; | |
306 | const wxEventType wxEVT_NC_MIDDLE_UP = wxEVT_FIRST + 203; | |
307 | const wxEventType wxEVT_NC_RIGHT_DOWN = wxEVT_FIRST + 204; | |
308 | const wxEventType wxEVT_NC_RIGHT_UP = wxEVT_FIRST + 205; | |
309 | const wxEventType wxEVT_NC_MOTION = wxEVT_FIRST + 206; | |
310 | const wxEventType wxEVT_NC_ENTER_WINDOW = wxEVT_FIRST + 207; | |
311 | const wxEventType wxEVT_NC_LEAVE_WINDOW = wxEVT_FIRST + 208; | |
312 | const wxEventType wxEVT_NC_LEFT_DCLICK = wxEVT_FIRST + 209; | |
313 | const wxEventType wxEVT_NC_MIDDLE_DCLICK = wxEVT_FIRST + 210; | |
314 | const wxEventType wxEVT_NC_RIGHT_DCLICK = wxEVT_FIRST + 211; | |
c801d85f KB |
315 | |
316 | /* Character input event type */ | |
0757d27c | 317 | const wxEventType wxEVT_CHAR = wxEVT_FIRST + 212; |
4ce81a75 JS |
318 | const wxEventType wxEVT_CHAR_HOOK = wxEVT_FIRST + 213; |
319 | const wxEventType wxEVT_NAVIGATION_KEY = wxEVT_FIRST + 214; | |
320 | const wxEventType wxEVT_KEY_DOWN = wxEVT_FIRST + 215; | |
321 | const wxEventType wxEVT_KEY_UP = wxEVT_FIRST + 216; | |
c801d85f KB |
322 | |
323 | /* | |
d1367c3d | 324 | * wxScrollbar and wxSlider event identifiers |
c801d85f | 325 | */ |
0757d27c JS |
326 | const wxEventType wxEVT_SCROLL_TOP = wxEVT_FIRST + 300; |
327 | const wxEventType wxEVT_SCROLL_BOTTOM = wxEVT_FIRST + 301; | |
328 | const wxEventType wxEVT_SCROLL_LINEUP = wxEVT_FIRST + 302; | |
329 | const wxEventType wxEVT_SCROLL_LINEDOWN = wxEVT_FIRST + 303; | |
330 | const wxEventType wxEVT_SCROLL_PAGEUP = wxEVT_FIRST + 304; | |
331 | const wxEventType wxEVT_SCROLL_PAGEDOWN = wxEVT_FIRST + 305; | |
332 | const wxEventType wxEVT_SCROLL_THUMBTRACK = wxEVT_FIRST + 306; | |
333 | ||
d1367c3d RR |
334 | /* |
335 | * Scroll events from wxWindow | |
336 | */ | |
337 | const wxEventType wxEVT_SCROLLWIN_TOP = wxEVT_FIRST + 320; | |
338 | const wxEventType wxEVT_SCROLLWIN_BOTTOM = wxEVT_FIRST + 321; | |
339 | const wxEventType wxEVT_SCROLLWIN_LINEUP = wxEVT_FIRST + 322; | |
340 | const wxEventType wxEVT_SCROLLWIN_LINEDOWN = wxEVT_FIRST + 323; | |
341 | const wxEventType wxEVT_SCROLLWIN_PAGEUP = wxEVT_FIRST + 324; | |
342 | const wxEventType wxEVT_SCROLLWIN_PAGEDOWN = wxEVT_FIRST + 325; | |
343 | const wxEventType wxEVT_SCROLLWIN_THUMBTRACK = wxEVT_FIRST + 326; | |
344 | ||
345 | /* | |
346 | * System events | |
347 | */ | |
0757d27c JS |
348 | const wxEventType wxEVT_SIZE = wxEVT_FIRST + 400; |
349 | const wxEventType wxEVT_MOVE = wxEVT_FIRST + 401; | |
350 | const wxEventType wxEVT_CLOSE_WINDOW = wxEVT_FIRST + 402; | |
351 | const wxEventType wxEVT_END_SESSION = wxEVT_FIRST + 403; | |
352 | const wxEventType wxEVT_QUERY_END_SESSION = wxEVT_FIRST + 404; | |
353 | const wxEventType wxEVT_ACTIVATE_APP = wxEVT_FIRST + 405; | |
354 | const wxEventType wxEVT_POWER = wxEVT_FIRST + 406; | |
0757d27c JS |
355 | const wxEventType wxEVT_ACTIVATE = wxEVT_FIRST + 409; |
356 | const wxEventType wxEVT_CREATE = wxEVT_FIRST + 410; | |
357 | const wxEventType wxEVT_DESTROY = wxEVT_FIRST + 411; | |
358 | const wxEventType wxEVT_SHOW = wxEVT_FIRST + 412; | |
359 | const wxEventType wxEVT_ICONIZE = wxEVT_FIRST + 413; | |
360 | const wxEventType wxEVT_MAXIMIZE = wxEVT_FIRST + 414; | |
361 | const wxEventType wxEVT_MOUSE_CAPTURE_CHANGED = wxEVT_FIRST + 415; | |
362 | const wxEventType wxEVT_PAINT = wxEVT_FIRST + 416; | |
363 | const wxEventType wxEVT_ERASE_BACKGROUND = wxEVT_FIRST + 417; | |
364 | const wxEventType wxEVT_NC_PAINT = wxEVT_FIRST + 418; | |
365 | const wxEventType wxEVT_PAINT_ICON = wxEVT_FIRST + 419; | |
366 | const wxEventType wxEVT_MENU_CHAR = wxEVT_FIRST + 420; | |
367 | const wxEventType wxEVT_MENU_INIT = wxEVT_FIRST + 421; | |
368 | const wxEventType wxEVT_MENU_HIGHLIGHT = wxEVT_FIRST + 422; | |
369 | const wxEventType wxEVT_POPUP_MENU_INIT = wxEVT_FIRST + 423; | |
370 | const wxEventType wxEVT_CONTEXT_MENU = wxEVT_FIRST + 424; | |
371 | const wxEventType wxEVT_SYS_COLOUR_CHANGED = wxEVT_FIRST + 425; | |
372 | const wxEventType wxEVT_SETTING_CHANGED = wxEVT_FIRST + 426; | |
373 | const wxEventType wxEVT_QUERY_NEW_PALETTE = wxEVT_FIRST + 427; | |
374 | const wxEventType wxEVT_PALETTE_CHANGED = wxEVT_FIRST + 428; | |
375 | const wxEventType wxEVT_JOY_BUTTON_DOWN = wxEVT_FIRST + 429; | |
376 | const wxEventType wxEVT_JOY_BUTTON_UP = wxEVT_FIRST + 430; | |
377 | const wxEventType wxEVT_JOY_MOVE = wxEVT_FIRST + 431; | |
378 | const wxEventType wxEVT_JOY_ZMOVE = wxEVT_FIRST + 432; | |
379 | const wxEventType wxEVT_DROP_FILES = wxEVT_FIRST + 433; | |
380 | const wxEventType wxEVT_DRAW_ITEM = wxEVT_FIRST + 434; | |
381 | const wxEventType wxEVT_MEASURE_ITEM = wxEVT_FIRST + 435; | |
382 | const wxEventType wxEVT_COMPARE_ITEM = wxEVT_FIRST + 436; | |
383 | const wxEventType wxEVT_INIT_DIALOG = wxEVT_FIRST + 437; | |
384 | const wxEventType wxEVT_IDLE = wxEVT_FIRST + 438; | |
385 | const wxEventType wxEVT_UPDATE_UI = wxEVT_FIRST + 439; | |
7cc98b3e | 386 | |
0757d27c JS |
387 | /* System misc. */ |
388 | const wxEventType wxEVT_END_PROCESS = wxEVT_FIRST + 440; | |
c801d85f | 389 | |
7cc98b3e VZ |
390 | /* Dial up events */ |
391 | const wxEventType wxEVT_DIALUP_CONNECTED = wxEVT_FIRST + 450; | |
392 | const wxEventType wxEVT_DIALUP_DISCONNECTED = wxEVT_FIRST + 451; | |
393 | ||
c801d85f | 394 | /* Generic command events */ |
db131261 | 395 | /* Note: a click is a higher-level event than button down/up */ |
0757d27c JS |
396 | const wxEventType wxEVT_COMMAND_LEFT_CLICK = wxEVT_FIRST + 500; |
397 | const wxEventType wxEVT_COMMAND_LEFT_DCLICK = wxEVT_FIRST + 501; | |
398 | const wxEventType wxEVT_COMMAND_RIGHT_CLICK = wxEVT_FIRST + 502; | |
399 | const wxEventType wxEVT_COMMAND_RIGHT_DCLICK = wxEVT_FIRST + 503; | |
400 | const wxEventType wxEVT_COMMAND_SET_FOCUS = wxEVT_FIRST + 504; | |
401 | const wxEventType wxEVT_COMMAND_KILL_FOCUS = wxEVT_FIRST + 505; | |
402 | const wxEventType wxEVT_COMMAND_ENTER = wxEVT_FIRST + 506; | |
c801d85f KB |
403 | |
404 | /* Tree control event types */ | |
0757d27c JS |
405 | const wxEventType wxEVT_COMMAND_TREE_BEGIN_DRAG = wxEVT_FIRST + 600; |
406 | const wxEventType wxEVT_COMMAND_TREE_BEGIN_RDRAG = wxEVT_FIRST + 601; | |
407 | const wxEventType wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT = wxEVT_FIRST + 602; | |
408 | const wxEventType wxEVT_COMMAND_TREE_END_LABEL_EDIT = wxEVT_FIRST + 603; | |
409 | const wxEventType wxEVT_COMMAND_TREE_DELETE_ITEM = wxEVT_FIRST + 604; | |
410 | const wxEventType wxEVT_COMMAND_TREE_GET_INFO = wxEVT_FIRST + 605; | |
411 | const wxEventType wxEVT_COMMAND_TREE_SET_INFO = wxEVT_FIRST + 606; | |
412 | const wxEventType wxEVT_COMMAND_TREE_ITEM_EXPANDED = wxEVT_FIRST + 607; | |
413 | const wxEventType wxEVT_COMMAND_TREE_ITEM_EXPANDING = wxEVT_FIRST + 608; | |
414 | const wxEventType wxEVT_COMMAND_TREE_ITEM_COLLAPSED = wxEVT_FIRST + 609; | |
415 | const wxEventType wxEVT_COMMAND_TREE_ITEM_COLLAPSING = wxEVT_FIRST + 610; | |
416 | const wxEventType wxEVT_COMMAND_TREE_SEL_CHANGED = wxEVT_FIRST + 611; | |
417 | const wxEventType wxEVT_COMMAND_TREE_SEL_CHANGING = wxEVT_FIRST + 612; | |
418 | const wxEventType wxEVT_COMMAND_TREE_KEY_DOWN = wxEVT_FIRST + 613; | |
435fe83e | 419 | const wxEventType wxEVT_COMMAND_TREE_ITEM_ACTIVATED = wxEVT_FIRST + 614; |
5d53c76b UC |
420 | const wxEventType wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK = wxEVT_FIRST + 615; |
421 | const wxEventType wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK = wxEVT_FIRST + 616; | |
c801d85f KB |
422 | |
423 | /* List control event types */ | |
0757d27c JS |
424 | const wxEventType wxEVT_COMMAND_LIST_BEGIN_DRAG = wxEVT_FIRST + 700; |
425 | const wxEventType wxEVT_COMMAND_LIST_BEGIN_RDRAG = wxEVT_FIRST + 701; | |
426 | const wxEventType wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT = wxEVT_FIRST + 702; | |
427 | const wxEventType wxEVT_COMMAND_LIST_END_LABEL_EDIT = wxEVT_FIRST + 703; | |
428 | const wxEventType wxEVT_COMMAND_LIST_DELETE_ITEM = wxEVT_FIRST + 704; | |
429 | const wxEventType wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS = wxEVT_FIRST + 705; | |
430 | const wxEventType wxEVT_COMMAND_LIST_GET_INFO = wxEVT_FIRST + 706; | |
431 | const wxEventType wxEVT_COMMAND_LIST_SET_INFO = wxEVT_FIRST + 707; | |
432 | const wxEventType wxEVT_COMMAND_LIST_ITEM_SELECTED = wxEVT_FIRST + 708; | |
433 | const wxEventType wxEVT_COMMAND_LIST_ITEM_DESELECTED = wxEVT_FIRST + 709; | |
434 | const wxEventType wxEVT_COMMAND_LIST_KEY_DOWN = wxEVT_FIRST + 710; | |
435 | const wxEventType wxEVT_COMMAND_LIST_INSERT_ITEM = wxEVT_FIRST + 711; | |
436 | const wxEventType wxEVT_COMMAND_LIST_COL_CLICK = wxEVT_FIRST + 712; | |
92976ab6 RR |
437 | const wxEventType wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK = wxEVT_FIRST + 713; |
438 | const wxEventType wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK = wxEVT_FIRST + 714; | |
435fe83e | 439 | const wxEventType wxEVT_COMMAND_LIST_ITEM_ACTIVATED = wxEVT_FIRST + 715; |
c801d85f | 440 | |
28bfeb73 | 441 | /* Tab and notebook control event types */ |
0757d27c JS |
442 | const wxEventType wxEVT_COMMAND_TAB_SEL_CHANGED = wxEVT_FIRST + 800; |
443 | const wxEventType wxEVT_COMMAND_TAB_SEL_CHANGING = wxEVT_FIRST + 801; | |
62448488 JS |
444 | |
445 | #if defined(__BORLANDC__) && defined(__WIN16__) | |
db131261 | 446 | /* For 16-bit BC++, these 2 are identical (truncated) */ |
62448488 JS |
447 | const wxEventType wxEVT_COMMAND_NB_PAGE_CHANGED = wxEVT_FIRST + 802; |
448 | const wxEventType wxEVT_COMMAND_NB_PAGE_CHANGING = wxEVT_FIRST + 803; | |
449 | #else | |
0757d27c JS |
450 | const wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED = wxEVT_FIRST + 802; |
451 | const wxEventType wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING = wxEVT_FIRST + 803; | |
62448488 | 452 | #endif |
c801d85f | 453 | |
42e69d6b VZ |
454 | /* Splitter events */ |
455 | const wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED = wxEVT_FIRST + 850; | |
86434d71 UB |
456 | const wxEventType wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING = wxEVT_FIRST + 851; |
457 | const wxEventType wxEVT_COMMAND_SPLITTER_DOUBLECLICKED = wxEVT_FIRST + 852; | |
458 | const wxEventType wxEVT_COMMAND_SPLITTER_UNSPLIT = wxEVT_FIRST + 853; | |
42e69d6b | 459 | |
b87654f3 VZ |
460 | /* Wizard events */ |
461 | const wxEventType wxEVT_WIZARD_PAGE_CHANGED = wxEVT_FIRST + 900; | |
462 | const wxEventType wxEVT_WIZARD_PAGE_CHANGING = wxEVT_FIRST + 901; | |
463 | const wxEventType wxEVT_WIZARD_CANCEL = wxEVT_FIRST + 902; | |
464 | ||
9d9b7755 VZ |
465 | /* Calendar events */ |
466 | const wxEventType wxEVT_CALENDAR_SEL_CHANGED = wxEVT_FIRST + 950; | |
467 | const wxEventType wxEVT_CALENDAR_DAY_CHANGED = wxEVT_FIRST + 951; | |
468 | const wxEventType wxEVT_CALENDAR_MONTH_CHANGED = wxEVT_FIRST + 952; | |
469 | const wxEventType wxEVT_CALENDAR_YEAR_CHANGED = wxEVT_FIRST + 953; | |
0185cd09 VZ |
470 | const wxEventType wxEVT_CALENDAR_DOUBLECLICKED = wxEVT_FIRST + 954; |
471 | const wxEventType wxEVT_CALENDAR_WEEKDAY_CLICKED = wxEVT_FIRST + 955; | |
9d9b7755 | 472 | |
0185cd09 | 473 | const wxEventType wxEVT_USER_FIRST = wxEVT_FIRST + 2000; |
fbc535ff | 474 | |
66b6b045 DW |
475 | #endif // for VisualAge C++ V4.0 |
476 | ||
db131261 | 477 | /* Compatibility */ |
c801d85f KB |
478 | |
479 | #if WXWIN_COMPATIBILITY | |
480 | ||
481 | #define wxEVENT_TYPE_BUTTON_COMMAND wxEVT_COMMAND_BUTTON_CLICKED | |
482 | #define wxEVENT_TYPE_CHECKBOX_COMMAND wxEVT_COMMAND_CHECKBOX_CLICKED | |
483 | #define wxEVENT_TYPE_CHOICE_COMMAND wxEVT_COMMAND_CHOICE_SELECTED | |
484 | #define wxEVENT_TYPE_LISTBOX_COMMAND wxEVT_COMMAND_LISTBOX_SELECTED | |
485 | #define wxEVENT_TYPE_LISTBOX_DCLICK_COMMAND wxEVT_COMMAND_LISTBOX_DOUBLECLICKED | |
486 | #define wxEVENT_TYPE_TEXT_COMMAND wxEVT_COMMAND_TEXT_UPDATED | |
487 | #define wxEVENT_TYPE_MULTITEXT_COMMAND wxEVT_COMMAND_TEXT_UPDATED | |
488 | #define wxEVENT_TYPE_MENU_COMMAND wxEVT_COMMAND_MENU_SELECTED | |
489 | #define wxEVENT_TYPE_SLIDER_COMMAND wxEVT_COMMAND_SLIDER_UPDATED | |
490 | #define wxEVENT_TYPE_RADIOBOX_COMMAND wxEVT_COMMAND_RADIOBOX_SELECTED | |
491 | #define wxEVENT_TYPE_RADIOBUTTON_COMMAND wxEVT_COMMAND_RADIOBUTTON_SELECTED | |
492 | #define wxEVENT_TYPE_TEXT_ENTER_COMMAND wxEVT_COMMAND_TEXT_ENTER | |
493 | #define wxEVENT_TYPE_SET_FOCUS wxEVT_SET_FOCUS | |
494 | #define wxEVENT_TYPE_KILL_FOCUS wxEVT_KILL_FOCUS | |
495 | #define wxEVENT_TYPE_SCROLLBAR_COMMAND wxEVT_COMMAND_SCROLLBAR_UPDATED | |
496 | #define wxEVENT_TYPE_VIRT_LISTBOX_COMMAND wxEVT_COMMAND_VLBOX_SELECTED | |
497 | #define wxEVENT_TYPE_COMBOBOX_COMMAND wxEVT_COMMAND_COMBOBOX_SELECTED | |
498 | ||
499 | #define wxEVENT_TYPE_LEFT_DOWN wxEVT_LEFT_DOWN | |
500 | #define wxEVENT_TYPE_LEFT_UP wxEVT_LEFT_UP | |
501 | #define wxEVENT_TYPE_MIDDLE_DOWN wxEVT_MIDDLE_DOWN | |
502 | #define wxEVENT_TYPE_MIDDLE_UP wxEVT_MIDDLE_UP | |
503 | #define wxEVENT_TYPE_RIGHT_DOWN wxEVT_RIGHT_DOWN | |
504 | #define wxEVENT_TYPE_RIGHT_UP wxEVT_RIGHT_UP | |
505 | #define wxEVENT_TYPE_MOTION wxEVT_MOTION | |
506 | #define wxEVENT_TYPE_ENTER_WINDOW wxEVT_ENTER_WINDOW | |
507 | #define wxEVENT_TYPE_LEAVE_WINDOW wxEVT_LEAVE_WINDOW | |
508 | #define wxEVENT_TYPE_LEFT_DCLICK wxEVT_LEFT_DCLICK | |
509 | #define wxEVENT_TYPE_MIDDLE_DCLICK wxEVT_MIDDLE_DCLICK | |
510 | #define wxEVENT_TYPE_RIGHT_DCLICK wxEVT_RIGHT_DCLICK | |
511 | #define wxEVENT_TYPE_CHAR wxEVT_CHAR | |
512 | #define wxEVENT_TYPE_SCROLL_TOP wxEVT_SCROLL_TOP | |
513 | #define wxEVENT_TYPE_SCROLL_BOTTOM wxEVT_SCROLL_BOTTOM | |
514 | #define wxEVENT_TYPE_SCROLL_LINEUP wxEVT_SCROLL_LINEUP | |
515 | #define wxEVENT_TYPE_SCROLL_LINEDOWN wxEVT_SCROLL_LINEDOWN | |
516 | #define wxEVENT_TYPE_SCROLL_PAGEUP wxEVT_SCROLL_PAGEUP | |
517 | #define wxEVENT_TYPE_SCROLL_PAGEDOWN wxEVT_SCROLL_PAGEDOWN | |
518 | #define wxEVENT_TYPE_SCROLL_THUMBTRACK wxEVT_SCROLL_THUMBTRACK | |
519 | ||
2b854a32 | 520 | #endif // WXWIN_COMPATIBILITY |
c801d85f KB |
521 | |
522 | /* | |
523 | * wxWindows events, covering all interesting things that might happen | |
524 | * (button clicking, resizing, setting text in widgets, etc.). | |
525 | * | |
526 | * For each completely new event type, derive a new event class. | |
527 | * An event CLASS represents a C++ class defining a range of similar event TYPES; | |
528 | * examples are canvas events, panel item command events. | |
529 | * An event TYPE is a unique identifier for a particular system event, | |
530 | * such as a button press or a listbox deselection. | |
531 | * | |
532 | */ | |
533 | ||
2b854a32 | 534 | class WXDLLEXPORT wxEvent : public wxObject |
c801d85f | 535 | { |
2b854a32 | 536 | DECLARE_ABSTRACT_CLASS(wxEvent) |
c801d85f KB |
537 | |
538 | public: | |
2b854a32 VZ |
539 | wxEvent(int id = 0); |
540 | ~wxEvent() {} | |
541 | ||
542 | void SetEventType(wxEventType typ) { m_eventType = typ; } | |
543 | wxEventType GetEventType() const { return m_eventType; } | |
544 | wxObject *GetEventObject() const { return m_eventObject; } | |
545 | void SetEventObject(wxObject *obj) { m_eventObject = obj; } | |
546 | long GetTimestamp() const { return m_timeStamp; } | |
547 | void SetTimestamp(long ts = 0) { m_timeStamp = ts; } | |
548 | int GetId() const { return m_id; } | |
549 | void SetId(int Id) { m_id = Id; } | |
550 | ||
551 | // Can instruct event processor that we wish to ignore this event | |
552 | // (treat as if the event table entry had not been found): this must be done | |
553 | // to allow the event processing by the base classes (calling event.Skip() | |
554 | // is the analog of calling the base class verstion of a virtual function) | |
555 | void Skip(bool skip = TRUE) { m_skipped = skip; } | |
556 | bool GetSkipped() const { return m_skipped; }; | |
c801d85f | 557 | |
193bf013 VZ |
558 | // implementation only: this test is explicitlty anti OO and this functions |
559 | // exists only for optimization purposes | |
560 | bool IsCommandEvent() const { return m_isCommandEvent; } | |
561 | ||
aadbdf11 | 562 | void CopyObject(wxObject& object_dest) const; |
a737331d | 563 | |
c801d85f | 564 | public: |
2b854a32 | 565 | wxObject* m_eventObject; |
2b854a32 VZ |
566 | wxEventType m_eventType; |
567 | long m_timeStamp; | |
568 | int m_id; | |
569 | wxObject* m_callbackUserData; | |
42e69d6b | 570 | bool m_skipped; |
193bf013 VZ |
571 | |
572 | // optimization: instead of using costly IsKindOf() we keep a flag telling | |
573 | // whether we're a command event (by far the most common case) | |
574 | bool m_isCommandEvent; | |
c801d85f KB |
575 | }; |
576 | ||
e90c1d2a VZ |
577 | #if wxUSE_GUI |
578 | ||
c801d85f KB |
579 | // Item or menu event class |
580 | /* | |
581 | wxEVT_COMMAND_BUTTON_CLICKED | |
582 | wxEVT_COMMAND_CHECKBOX_CLICKED | |
583 | wxEVT_COMMAND_CHOICE_SELECTED | |
584 | wxEVT_COMMAND_LISTBOX_SELECTED | |
585 | wxEVT_COMMAND_LISTBOX_DOUBLECLICKED | |
586 | wxEVT_COMMAND_TEXT_UPDATED | |
587 | wxEVT_COMMAND_TEXT_ENTER | |
588 | wxEVT_COMMAND_MENU_SELECTED | |
589 | wxEVT_COMMAND_SLIDER_UPDATED | |
590 | wxEVT_COMMAND_RADIOBOX_SELECTED | |
591 | wxEVT_COMMAND_RADIOBUTTON_SELECTED | |
592 | wxEVT_COMMAND_SCROLLBAR_UPDATED | |
593 | wxEVT_COMMAND_VLBOX_SELECTED | |
594 | wxEVT_COMMAND_COMBOBOX_SELECTED | |
595 | */ | |
596 | ||
2b854a32 | 597 | class WXDLLEXPORT wxCommandEvent : public wxEvent |
c801d85f | 598 | { |
2b854a32 | 599 | DECLARE_DYNAMIC_CLASS(wxCommandEvent) |
c801d85f | 600 | |
2b854a32 VZ |
601 | public: |
602 | wxCommandEvent(wxEventType commandType = wxEVT_NULL, int id = 0); | |
603 | ~wxCommandEvent() {} | |
c801d85f | 604 | |
2b854a32 VZ |
605 | /* |
606 | * Accessors dependent on context | |
607 | * | |
608 | */ | |
c801d85f | 609 | |
2b854a32 VZ |
610 | // Set/Get client data from controls |
611 | void SetClientData(void* clientData) { m_clientData = clientData; } | |
612 | void *GetClientData() const { return m_clientData; } | |
c801d85f | 613 | |
2b854a32 VZ |
614 | // Set/Get client object from controls |
615 | void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; } | |
616 | void *GetClientObject() const { return m_clientObject; } | |
f5e27805 | 617 | |
2b854a32 VZ |
618 | // Get listbox selection if single-choice |
619 | int GetSelection() const { return m_commandInt; } | |
c801d85f | 620 | |
2b854a32 | 621 | // Set/Get listbox/choice selection string |
29006414 | 622 | void SetString(const wxString& s) { m_commandString = s; } |
7214297d | 623 | wxString GetString() const { return m_commandString; } |
c801d85f | 624 | |
2b854a32 VZ |
625 | // Get checkbox value |
626 | bool Checked() const { return (m_commandInt != 0); } | |
c801d85f | 627 | |
2b854a32 VZ |
628 | // TRUE if the listbox event was a selection. |
629 | bool IsSelection() const { return (m_extraLong != 0); } | |
c801d85f | 630 | |
2b854a32 VZ |
631 | void SetExtraLong(long extraLong) { m_extraLong = extraLong; } |
632 | long GetExtraLong() const { return m_extraLong ; } | |
c801d85f | 633 | |
2b854a32 VZ |
634 | void SetInt(int i) { m_commandInt = i; } |
635 | long GetInt() const { return m_commandInt ; } | |
c801d85f | 636 | |
aadbdf11 GL |
637 | void CopyObject(wxObject& obj) const; |
638 | ||
2b854a32 | 639 | public: |
29006414 | 640 | wxString m_commandString; // String event argument |
2b854a32 VZ |
641 | int m_commandInt; |
642 | long m_extraLong; // Additional information (e.g. select/deselect) | |
643 | void* m_clientData; // Arbitrary client data | |
644 | wxClientData* m_clientObject; // Arbitrary client object | |
c801d85f KB |
645 | }; |
646 | ||
fd3f686c VZ |
647 | // this class adds a possibility to react (from the user) code to a control |
648 | // notification: allow or veto the operation being reported. | |
2b854a32 | 649 | class WXDLLEXPORT wxNotifyEvent : public wxCommandEvent |
fd3f686c VZ |
650 | { |
651 | public: | |
652 | wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int id = 0) | |
653 | : wxCommandEvent(commandType, id) { m_bAllow = TRUE; } | |
654 | ||
655 | // veto the operation (by default it's allowed) | |
656 | void Veto() { m_bAllow = FALSE; } | |
657 | ||
658 | // for implementation code only: is the operation allowed? | |
659 | bool IsAllowed() const { return m_bAllow; } | |
660 | ||
924ef850 RR |
661 | // probably useless: CopyObject() is used for deferred event |
662 | // handling but wxNotifyEvent must be processed immediately | |
663 | void CopyObject(wxObject& obj) const; | |
664 | ||
fd3f686c VZ |
665 | private: |
666 | bool m_bAllow; | |
667 | ||
92976ab6 | 668 | DECLARE_DYNAMIC_CLASS(wxNotifyEvent) |
fd3f686c VZ |
669 | }; |
670 | ||
d1367c3d RR |
671 | // Scroll event class, derived form wxCommandEvent. wxScrollEvents are |
672 | // sent by wxSlider and wxScrollbar. | |
c801d85f KB |
673 | /* |
674 | wxEVT_SCROLL_TOP | |
675 | wxEVT_SCROLL_BOTTOM | |
676 | wxEVT_SCROLL_LINEUP | |
677 | wxEVT_SCROLL_LINEDOWN | |
678 | wxEVT_SCROLL_PAGEUP | |
679 | wxEVT_SCROLL_PAGEDOWN | |
680 | wxEVT_SCROLL_THUMBTRACK | |
681 | */ | |
682 | ||
2b854a32 | 683 | class WXDLLEXPORT wxScrollEvent : public wxCommandEvent |
c801d85f | 684 | { |
2b854a32 | 685 | DECLARE_DYNAMIC_CLASS(wxScrollEvent) |
c801d85f | 686 | |
2b854a32 VZ |
687 | public: |
688 | wxScrollEvent(wxEventType commandType = wxEVT_NULL, | |
689 | int id = 0, int pos = 0, int orient = 0); | |
690 | ~wxScrollEvent() {} | |
691 | ||
692 | /* | |
693 | * Accessors | |
694 | * | |
695 | */ | |
696 | ||
697 | int GetOrientation() const { return (int) m_extraLong ; } | |
698 | int GetPosition() const { return m_commandInt ; } | |
298d19f9 | 699 | bool IsScrolling() const { return m_isScrolling; } |
2b854a32 VZ |
700 | void SetOrientation(int orient) { m_extraLong = (long) orient; } |
701 | void SetPosition(int pos) { m_commandInt = pos; } | |
298d19f9 GRG |
702 | void SetScrolling(bool isScrolling) { m_isScrolling = isScrolling; } |
703 | ||
704 | void CopyObject(wxObject& obj) const; | |
705 | public: | |
706 | bool m_isScrolling; | |
c801d85f KB |
707 | }; |
708 | ||
d1367c3d RR |
709 | // ScrollWin event class, derived fom wxEvent. wxScrollWinEvents |
710 | // are sent by wxWindow. | |
711 | /* | |
712 | wxEVT_SCROLLWIN_TOP | |
713 | wxEVT_SCROLLWIN_BOTTOM | |
714 | wxEVT_SCROLLWIN_LINEUP | |
715 | wxEVT_SCROLLWIN_LINEDOWN | |
716 | wxEVT_SCROLLWIN_PAGEUP | |
717 | wxEVT_SCROLLWIN_PAGEDOWN | |
718 | wxEVT_SCROLLWIN_THUMBTRACK | |
719 | */ | |
720 | ||
721 | class WXDLLEXPORT wxScrollWinEvent : public wxEvent | |
722 | { | |
723 | DECLARE_DYNAMIC_CLASS(wxScrollWinEvent) | |
724 | ||
725 | public: | |
726 | wxScrollWinEvent(wxEventType commandType = wxEVT_NULL, | |
727 | int pos = 0, int orient = 0); | |
728 | ~wxScrollWinEvent() {} | |
729 | ||
730 | /* | |
731 | * Accessors | |
732 | */ | |
733 | ||
734 | int GetOrientation() const { return (int) m_extraLong ; } | |
735 | int GetPosition() const { return m_commandInt ; } | |
298d19f9 | 736 | bool IsScrolling() const { return m_isScrolling; } |
d1367c3d RR |
737 | void SetOrientation(int orient) { m_extraLong = (long) orient; } |
738 | void SetPosition(int pos) { m_commandInt = pos; } | |
298d19f9 | 739 | void SetScrolling(bool isScrolling) { m_isScrolling = isScrolling; } |
d1367c3d | 740 | |
3c679789 | 741 | void CopyObject(wxObject& object_dest) const; |
d1367c3d RR |
742 | public: |
743 | int m_commandInt; // Additional information | |
20947e08 | 744 | long m_extraLong; |
298d19f9 | 745 | bool m_isScrolling; |
d1367c3d RR |
746 | }; |
747 | ||
c801d85f KB |
748 | // Mouse event class |
749 | ||
750 | /* | |
751 | wxEVT_LEFT_DOWN | |
752 | wxEVT_LEFT_UP | |
753 | wxEVT_MIDDLE_DOWN | |
754 | wxEVT_MIDDLE_UP | |
755 | wxEVT_RIGHT_DOWN | |
756 | wxEVT_RIGHT_UP | |
757 | wxEVT_MOTION | |
758 | wxEVT_ENTER_WINDOW | |
759 | wxEVT_LEAVE_WINDOW | |
760 | wxEVT_LEFT_DCLICK | |
761 | wxEVT_MIDDLE_DCLICK | |
762 | wxEVT_RIGHT_DCLICK | |
763 | wxEVT_NC_LEFT_DOWN | |
764 | wxEVT_NC_LEFT_UP, | |
765 | wxEVT_NC_MIDDLE_DOWN, | |
766 | wxEVT_NC_MIDDLE_UP, | |
767 | wxEVT_NC_RIGHT_DOWN, | |
768 | wxEVT_NC_RIGHT_UP, | |
769 | wxEVT_NC_MOTION, | |
770 | wxEVT_NC_ENTER_WINDOW, | |
771 | wxEVT_NC_LEAVE_WINDOW, | |
772 | wxEVT_NC_LEFT_DCLICK, | |
773 | wxEVT_NC_MIDDLE_DCLICK, | |
774 | wxEVT_NC_RIGHT_DCLICK, | |
775 | */ | |
776 | ||
2b854a32 | 777 | class WXDLLEXPORT wxMouseEvent : public wxEvent |
c801d85f | 778 | { |
2b854a32 | 779 | DECLARE_DYNAMIC_CLASS(wxMouseEvent) |
c801d85f | 780 | |
2b854a32 VZ |
781 | public: |
782 | wxMouseEvent(wxEventType mouseType = wxEVT_NULL); | |
c801d85f | 783 | |
2b854a32 VZ |
784 | // Was it a button event? (*doesn't* mean: is any button *down*?) |
785 | bool IsButton() const { return Button(-1); } | |
c801d85f | 786 | |
2b854a32 VZ |
787 | // Was it a down event from button 1, 2 or 3 or any? |
788 | bool ButtonDown(int but = -1) const; | |
c801d85f | 789 | |
2b854a32 VZ |
790 | // Was it a dclick event from button 1, 2 or 3 or any? |
791 | bool ButtonDClick(int but = -1) const; | |
c801d85f | 792 | |
2b854a32 VZ |
793 | // Was it a up event from button 1, 2 or 3 or any? |
794 | bool ButtonUp(int but = -1) const; | |
c801d85f | 795 | |
2b854a32 VZ |
796 | // Was the given button 1,2,3 or any changing state? |
797 | bool Button(int but) const; | |
c801d85f | 798 | |
2b854a32 VZ |
799 | // Was the given button 1,2,3 or any in Down state? |
800 | bool ButtonIsDown(int but) const; | |
c801d85f | 801 | |
2b854a32 VZ |
802 | // Find state of shift/control keys |
803 | bool ControlDown() const { return m_controlDown; } | |
804 | bool MetaDown() const { return m_metaDown; } | |
805 | bool AltDown() const { return m_altDown; } | |
806 | bool ShiftDown() const { return m_shiftDown; } | |
c801d85f | 807 | |
2b854a32 VZ |
808 | // Find which event was just generated |
809 | bool LeftDown() const { return (m_eventType == wxEVT_LEFT_DOWN); } | |
810 | bool MiddleDown() const { return (m_eventType == wxEVT_MIDDLE_DOWN); } | |
811 | bool RightDown() const { return (m_eventType == wxEVT_RIGHT_DOWN); } | |
c801d85f | 812 | |
2b854a32 VZ |
813 | bool LeftUp() const { return (m_eventType == wxEVT_LEFT_UP); } |
814 | bool MiddleUp() const { return (m_eventType == wxEVT_MIDDLE_UP); } | |
815 | bool RightUp() const { return (m_eventType == wxEVT_RIGHT_UP); } | |
c801d85f | 816 | |
2b854a32 VZ |
817 | bool LeftDClick() const { return (m_eventType == wxEVT_LEFT_DCLICK); } |
818 | bool MiddleDClick() const { return (m_eventType == wxEVT_MIDDLE_DCLICK); } | |
819 | bool RightDClick() const { return (m_eventType == wxEVT_RIGHT_DCLICK); } | |
c801d85f | 820 | |
2b854a32 VZ |
821 | // Find the current state of the mouse buttons (regardless |
822 | // of current event type) | |
823 | bool LeftIsDown() const { return m_leftDown; } | |
824 | bool MiddleIsDown() const { return m_middleDown; } | |
825 | bool RightIsDown() const { return m_rightDown; } | |
c801d85f | 826 | |
2b854a32 VZ |
827 | // True if a button is down and the mouse is moving |
828 | bool Dragging() const | |
829 | { | |
830 | return ((m_eventType == wxEVT_MOTION) && | |
831 | (LeftIsDown() || MiddleIsDown() || RightIsDown())); | |
832 | } | |
c801d85f | 833 | |
2b854a32 VZ |
834 | // True if the mouse is moving, and no button is down |
835 | bool Moving() const { return (m_eventType == wxEVT_MOTION); } | |
c801d85f | 836 | |
2b854a32 VZ |
837 | // True if the mouse is just entering the window |
838 | bool Entering() const { return (m_eventType == wxEVT_ENTER_WINDOW); } | |
c801d85f | 839 | |
2b854a32 VZ |
840 | // True if the mouse is just leaving the window |
841 | bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); } | |
c801d85f | 842 | |
2b854a32 | 843 | // Find the position of the event |
20947e08 | 844 | void GetPosition(wxCoord *xpos, wxCoord *ypos) const |
b02da6b1 VZ |
845 | { |
846 | if (xpos) | |
20947e08 | 847 | *xpos = m_x; |
b02da6b1 VZ |
848 | if (ypos) |
849 | *ypos = m_y; | |
850 | } | |
851 | ||
0e528b99 | 852 | #ifndef __WIN16__ |
bf57d1ad | 853 | void GetPosition(long *xpos, long *ypos) const |
b02da6b1 VZ |
854 | { |
855 | if (xpos) | |
20947e08 | 856 | *xpos = (long)m_x; |
b02da6b1 | 857 | if (ypos) |
bf57d1ad | 858 | *ypos = (long)m_y; |
b02da6b1 | 859 | } |
0e528b99 | 860 | #endif |
c801d85f | 861 | |
2b854a32 VZ |
862 | // Find the position of the event |
863 | wxPoint GetPosition() const { return wxPoint(m_x, m_y); } | |
c801d85f | 864 | |
2b854a32 VZ |
865 | // Find the logical position of the event given the DC |
866 | wxPoint GetLogicalPosition(const wxDC& dc) const ; | |
c801d85f | 867 | |
2b854a32 VZ |
868 | // Compatibility |
869 | #if WXWIN_COMPATIBILITY | |
20947e08 | 870 | void Position(long *xpos, long *ypos) const |
b02da6b1 VZ |
871 | { |
872 | if (xpos) | |
20947e08 | 873 | *xpos = (long)m_x; |
b02da6b1 VZ |
874 | if (ypos) |
875 | *ypos = (long)m_y; | |
876 | } | |
877 | ||
2b854a32 VZ |
878 | void Position(float *xpos, float *ypos) const |
879 | { | |
880 | *xpos = (float) m_x; *ypos = (float) m_y; | |
881 | } | |
882 | #endif // WXWIN_COMPATIBILITY | |
c801d85f | 883 | |
2b854a32 VZ |
884 | // Get X position |
885 | long GetX() const { return m_x; } | |
c801d85f | 886 | |
2b854a32 VZ |
887 | // Get Y position |
888 | long GetY() const { return m_y; } | |
c801d85f | 889 | |
aadbdf11 GL |
890 | void CopyObject(wxObject& obj) const; |
891 | ||
c801d85f | 892 | public: |
b02da6b1 VZ |
893 | wxCoord m_x, m_y; |
894 | ||
2b854a32 VZ |
895 | bool m_leftDown; |
896 | bool m_middleDown; | |
897 | bool m_rightDown; | |
898 | ||
899 | bool m_controlDown; | |
900 | bool m_shiftDown; | |
901 | bool m_altDown; | |
902 | bool m_metaDown; | |
c801d85f KB |
903 | }; |
904 | ||
905 | // Keyboard input event class | |
906 | ||
907 | /* | |
908 | wxEVT_CHAR | |
909 | wxEVT_CHAR_HOOK | |
4ce81a75 | 910 | wxEVT_KEY_DOWN |
c801d85f KB |
911 | wxEVT_KEY_UP |
912 | */ | |
913 | ||
2b854a32 | 914 | class WXDLLEXPORT wxKeyEvent : public wxEvent |
c801d85f | 915 | { |
2b854a32 | 916 | DECLARE_DYNAMIC_CLASS(wxKeyEvent) |
c801d85f KB |
917 | |
918 | public: | |
2b854a32 | 919 | wxKeyEvent(wxEventType keyType = wxEVT_NULL); |
c801d85f | 920 | |
2b854a32 VZ |
921 | // Find state of shift/control keys |
922 | bool ControlDown() const { return m_controlDown; } | |
923 | bool MetaDown() const { return m_metaDown; } | |
924 | bool AltDown() const { return m_altDown; } | |
925 | bool ShiftDown() const { return m_shiftDown; } | |
926 | long KeyCode() const { return m_keyCode; } | |
c801d85f | 927 | |
2b854a32 | 928 | // Find the position of the event |
b02da6b1 VZ |
929 | void GetPosition(wxCoord *xpos, wxCoord *ypos) const |
930 | { | |
20947e08 | 931 | if (xpos) *xpos = m_x; |
b02da6b1 VZ |
932 | if (ypos) *ypos = m_y; |
933 | } | |
934 | ||
0e528b99 | 935 | #ifndef __WIN16__ |
bf57d1ad | 936 | void GetPosition(long *xpos, long *ypos) const |
b02da6b1 | 937 | { |
20947e08 | 938 | if (xpos) *xpos = (long)m_x; |
bf57d1ad | 939 | if (ypos) *ypos = (long)m_y; |
b02da6b1 | 940 | } |
0e528b99 | 941 | #endif |
803ef874 JS |
942 | |
943 | wxPoint GetPosition() const | |
944 | { return wxPoint(m_x, m_y); } | |
c801d85f | 945 | |
2b854a32 | 946 | // Get X position |
b02da6b1 | 947 | wxCoord GetX() const { return m_x; } |
c801d85f | 948 | |
2b854a32 | 949 | // Get Y position |
b02da6b1 | 950 | wxCoord GetY() const { return m_y; } |
c801d85f | 951 | |
aadbdf11 GL |
952 | void CopyObject(wxObject& obj) const; |
953 | ||
2b854a32 | 954 | public: |
b02da6b1 VZ |
955 | wxCoord m_x, m_y; |
956 | ||
2b854a32 | 957 | long m_keyCode; |
b02da6b1 | 958 | |
2b854a32 VZ |
959 | bool m_controlDown; |
960 | bool m_shiftDown; | |
961 | bool m_altDown; | |
962 | bool m_metaDown; | |
b0e813a0 | 963 | bool m_scanCode; |
c801d85f KB |
964 | }; |
965 | ||
966 | // Size event class | |
967 | /* | |
968 | wxEVT_SIZE | |
969 | */ | |
970 | ||
2b854a32 | 971 | class WXDLLEXPORT wxSizeEvent : public wxEvent |
c801d85f | 972 | { |
2b854a32 | 973 | DECLARE_DYNAMIC_CLASS(wxSizeEvent) |
c801d85f | 974 | |
2b854a32 VZ |
975 | public: |
976 | wxSize m_size; | |
c801d85f | 977 | |
2b854a32 VZ |
978 | wxSizeEvent() { m_eventType = wxEVT_SIZE; } |
979 | wxSizeEvent(const wxSize& sz, int id = 0) | |
980 | : m_size(sz) | |
981 | { m_eventType = wxEVT_SIZE; m_id = id; } | |
c801d85f | 982 | |
2b854a32 | 983 | wxSize GetSize() const { return m_size; } |
aadbdf11 GL |
984 | |
985 | void CopyObject(wxObject& obj) const; | |
c801d85f KB |
986 | }; |
987 | ||
988 | // Move event class | |
989 | ||
990 | /* | |
991 | wxEVT_MOVE | |
992 | */ | |
993 | ||
2b854a32 | 994 | class WXDLLEXPORT wxMoveEvent : public wxEvent |
c801d85f | 995 | { |
2b854a32 | 996 | DECLARE_DYNAMIC_CLASS(wxMoveEvent) |
c801d85f | 997 | |
2b854a32 VZ |
998 | public: |
999 | wxPoint m_pos; | |
c801d85f | 1000 | |
2b854a32 VZ |
1001 | wxMoveEvent() { m_eventType = wxEVT_MOVE; } |
1002 | wxMoveEvent(const wxPoint& pos, int id = 0) | |
1003 | : m_pos(pos) | |
1004 | { m_eventType = wxEVT_MOVE; m_id = id; } | |
c801d85f | 1005 | |
2b854a32 | 1006 | wxPoint GetPosition() const { return m_pos; } |
aadbdf11 GL |
1007 | |
1008 | void CopyObject(wxObject& obj) const; | |
c801d85f KB |
1009 | }; |
1010 | ||
1011 | // Paint event class | |
1012 | /* | |
1013 | wxEVT_PAINT | |
1014 | wxEVT_NC_PAINT | |
1015 | wxEVT_PAINT_ICON | |
1016 | */ | |
1017 | ||
edccf428 VZ |
1018 | #if defined(__WXDEBUG__) && defined(__WXMSW__) |
1019 | // see comments in src/msw/dcclient.cpp where g_isPainting is defined | |
1020 | extern int g_isPainting; | |
1021 | #endif // debug | |
1022 | ||
2b854a32 | 1023 | class WXDLLEXPORT wxPaintEvent : public wxEvent |
c801d85f | 1024 | { |
2b854a32 | 1025 | DECLARE_DYNAMIC_CLASS(wxPaintEvent) |
c801d85f | 1026 | |
2b854a32 | 1027 | public: |
edccf428 VZ |
1028 | wxPaintEvent(int Id = 0) |
1029 | { | |
1030 | m_eventType = wxEVT_PAINT; | |
1031 | m_id = Id; | |
1032 | ||
1033 | #if defined(__WXDEBUG__) && defined(__WXMSW__) | |
1034 | // set the internal flag for the duration of processing of WM_PAINT | |
1035 | g_isPainting++; | |
1036 | #endif // debug | |
1037 | } | |
1038 | ||
1039 | #if defined(__WXDEBUG__) && defined(__WXMSW__) | |
1040 | ~wxPaintEvent() | |
1041 | { | |
1042 | g_isPainting--; | |
1043 | } | |
1044 | #endif // debug | |
c801d85f KB |
1045 | }; |
1046 | ||
1047 | // Erase background event class | |
1048 | /* | |
1049 | wxEVT_ERASE_BACKGROUND | |
1050 | */ | |
1051 | ||
2b854a32 | 1052 | class WXDLLEXPORT wxEraseEvent : public wxEvent |
c801d85f | 1053 | { |
2b854a32 VZ |
1054 | DECLARE_DYNAMIC_CLASS(wxEraseEvent) |
1055 | ||
1056 | public: | |
1057 | wxDC *m_dc; | |
1058 | ||
1059 | wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL) | |
1060 | { m_eventType = wxEVT_ERASE_BACKGROUND; m_id = Id; m_dc = dc; } | |
1061 | wxDC *GetDC() const { return m_dc; } | |
aadbdf11 GL |
1062 | |
1063 | void CopyObject(wxObject& obj) const; | |
c801d85f KB |
1064 | }; |
1065 | ||
1066 | // Focus event class | |
1067 | /* | |
1068 | wxEVT_SET_FOCUS | |
1069 | wxEVT_KILL_FOCUS | |
1070 | */ | |
1071 | ||
2b854a32 | 1072 | class WXDLLEXPORT wxFocusEvent : public wxEvent |
c801d85f | 1073 | { |
2b854a32 | 1074 | DECLARE_DYNAMIC_CLASS(wxFocusEvent) |
c801d85f | 1075 | |
2b854a32 VZ |
1076 | public: |
1077 | wxFocusEvent(wxEventType type = wxEVT_NULL, int Id = 0) | |
1078 | { m_eventType = type; m_id = Id; } | |
c801d85f KB |
1079 | }; |
1080 | ||
1081 | // Activate event class | |
1082 | /* | |
1083 | wxEVT_ACTIVATE | |
1084 | wxEVT_ACTIVATE_APP | |
1085 | */ | |
1086 | ||
2b854a32 | 1087 | class WXDLLEXPORT wxActivateEvent : public wxEvent |
c801d85f | 1088 | { |
2b854a32 VZ |
1089 | DECLARE_DYNAMIC_CLASS(wxActivateEvent) |
1090 | ||
1091 | public: | |
1092 | wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = TRUE, int Id = 0) | |
1093 | { m_eventType = type; m_active = active; m_id = Id; } | |
1094 | bool GetActive() const { return m_active; } | |
c801d85f | 1095 | |
aadbdf11 GL |
1096 | void CopyObject(wxObject& obj) const; |
1097 | ||
2b854a32 VZ |
1098 | private: |
1099 | bool m_active; | |
c801d85f KB |
1100 | }; |
1101 | ||
1102 | // InitDialog event class | |
1103 | /* | |
1104 | wxEVT_INIT_DIALOG | |
1105 | */ | |
1106 | ||
2b854a32 | 1107 | class WXDLLEXPORT wxInitDialogEvent : public wxEvent |
c801d85f | 1108 | { |
2b854a32 | 1109 | DECLARE_DYNAMIC_CLASS(wxInitDialogEvent) |
c801d85f | 1110 | |
2b854a32 VZ |
1111 | public: |
1112 | wxInitDialogEvent(int Id = 0) | |
1113 | { m_eventType = wxEVT_INIT_DIALOG; m_id = Id; } | |
c801d85f KB |
1114 | }; |
1115 | ||
1116 | // Miscellaneous menu event class | |
1117 | /* | |
1118 | wxEVT_MENU_CHAR, | |
1119 | wxEVT_MENU_INIT, | |
1120 | wxEVT_MENU_HIGHLIGHT, | |
1121 | wxEVT_POPUP_MENU_INIT, | |
1122 | wxEVT_CONTEXT_MENU, | |
1123 | */ | |
1124 | ||
2b854a32 | 1125 | class WXDLLEXPORT wxMenuEvent : public wxEvent |
c801d85f | 1126 | { |
2b854a32 | 1127 | DECLARE_DYNAMIC_CLASS(wxMenuEvent) |
c801d85f KB |
1128 | |
1129 | public: | |
aadbdf11 GL |
1130 | wxMenuEvent(wxEventType type = wxEVT_NULL, int id = 0) |
1131 | { m_eventType = type; m_menuId = id; } | |
c801d85f | 1132 | |
aadbdf11 | 1133 | int GetMenuId() const { return m_menuId; } |
c801d85f | 1134 | |
aadbdf11 | 1135 | void CopyObject(wxObject& obj) const; |
2b854a32 | 1136 | private: |
aadbdf11 | 1137 | int m_menuId; |
c801d85f KB |
1138 | }; |
1139 | ||
1140 | // Window close or session close event class | |
1141 | /* | |
1142 | wxEVT_CLOSE_WINDOW, | |
1143 | wxEVT_END_SESSION, | |
1144 | wxEVT_QUERY_END_SESSION | |
1145 | */ | |
1146 | ||
2b854a32 | 1147 | class WXDLLEXPORT wxCloseEvent : public wxEvent |
c801d85f | 1148 | { |
2b854a32 VZ |
1149 | DECLARE_DYNAMIC_CLASS(wxCloseEvent) |
1150 | ||
c801d85f | 1151 | public: |
2b854a32 VZ |
1152 | wxCloseEvent(wxEventType type = wxEVT_NULL, int id = 0) |
1153 | { | |
1154 | m_eventType = type; | |
1155 | m_loggingOff = TRUE; | |
1156 | m_veto = FALSE; // should be FALSE by default | |
1157 | m_id = id; | |
1158 | #if WXWIN_COMPATIBILITY | |
1159 | m_force = FALSE; | |
1160 | #endif // WXWIN_COMPATIBILITY | |
1161 | m_canVeto = TRUE; | |
1162 | } | |
1163 | ||
1164 | void SetLoggingOff(bool logOff) { m_loggingOff = logOff; } | |
1165 | bool GetLoggingOff() const { return m_loggingOff; } | |
1166 | ||
fe4e9e6c VZ |
1167 | void Veto(bool veto = TRUE) |
1168 | { | |
1169 | // GetVeto() will return FALSE anyhow... | |
1170 | wxCHECK_RET( m_canVeto, | |
223d09f6 | 1171 | wxT("call to Veto() ignored (can't veto this event)") ); |
fe4e9e6c VZ |
1172 | |
1173 | m_veto = veto; | |
1174 | } | |
2b854a32 | 1175 | void SetCanVeto(bool canVeto) { m_canVeto = canVeto; } |
e3065973 | 1176 | // No more asserts here please, the one you put here was wrong. |
2b854a32 | 1177 | bool CanVeto() const { return m_canVeto; } |
fe4e9e6c | 1178 | bool GetVeto() const { return m_canVeto && m_veto; } |
c801d85f | 1179 | |
2b854a32 VZ |
1180 | #if WXWIN_COMPATIBILITY |
1181 | // This is probably obsolete now, since we use CanVeto instead, in | |
1182 | // both OnCloseWindow and OnQueryEndSession. | |
1183 | // m_force == ! m_canVeto i.e., can't veto means we must force it to close. | |
1184 | void SetForce(bool force) { m_force = force; } | |
1185 | bool GetForce() const { return m_force; } | |
1186 | #endif | |
1187 | ||
aadbdf11 GL |
1188 | void CopyObject(wxObject& obj) const; |
1189 | ||
2b854a32 VZ |
1190 | protected: |
1191 | bool m_loggingOff; | |
1192 | bool m_veto, m_canVeto; | |
1193 | ||
1194 | #if WXWIN_COMPATIBILITY | |
1195 | bool m_force; | |
1196 | #endif | |
c801d85f KB |
1197 | }; |
1198 | ||
1199 | /* | |
1200 | wxEVT_SHOW | |
1201 | */ | |
1202 | ||
2b854a32 | 1203 | class WXDLLEXPORT wxShowEvent : public wxEvent |
c801d85f | 1204 | { |
2b854a32 VZ |
1205 | DECLARE_DYNAMIC_CLASS(wxShowEvent) |
1206 | ||
c801d85f KB |
1207 | public: |
1208 | ||
2b854a32 VZ |
1209 | wxShowEvent(int id = 0, bool show = FALSE) |
1210 | { m_eventType = wxEVT_SHOW; m_id = id; m_show = show; } | |
c801d85f | 1211 | |
2b854a32 VZ |
1212 | void SetShow(bool show) { m_show = show; } |
1213 | bool GetShow() const { return m_show; } | |
c801d85f | 1214 | |
aadbdf11 GL |
1215 | void CopyObject(wxObject& obj) const; |
1216 | ||
c801d85f | 1217 | protected: |
2b854a32 | 1218 | bool m_show; |
c801d85f KB |
1219 | }; |
1220 | ||
1221 | /* | |
1222 | wxEVT_ICONIZE | |
1223 | */ | |
1224 | ||
2b854a32 | 1225 | class WXDLLEXPORT wxIconizeEvent : public wxEvent |
c801d85f | 1226 | { |
2b854a32 | 1227 | DECLARE_DYNAMIC_CLASS(wxIconizeEvent) |
c801d85f | 1228 | |
2b854a32 VZ |
1229 | public: |
1230 | wxIconizeEvent(int id = 0) | |
1231 | { m_eventType = wxEVT_ICONIZE; m_id = id; } | |
c801d85f KB |
1232 | }; |
1233 | ||
1234 | /* | |
1235 | wxEVT_MAXIMIZE | |
1236 | */ | |
1237 | ||
2b854a32 | 1238 | class WXDLLEXPORT wxMaximizeEvent : public wxEvent |
c801d85f | 1239 | { |
2b854a32 | 1240 | DECLARE_DYNAMIC_CLASS(wxMaximizeEvent) |
c801d85f | 1241 | |
2b854a32 VZ |
1242 | public: |
1243 | wxMaximizeEvent(int id = 0) | |
1244 | { m_eventType = wxEVT_MAXIMIZE; m_id = id; } | |
c801d85f KB |
1245 | }; |
1246 | ||
1247 | // Joystick event class | |
1248 | /* | |
1249 | wxEVT_JOY_BUTTON_DOWN, | |
1250 | wxEVT_JOY_BUTTON_UP, | |
1251 | wxEVT_JOY_MOVE, | |
1252 | wxEVT_JOY_ZMOVE | |
1253 | */ | |
1254 | ||
1255 | // Which joystick? Same as Windows ids so no conversion necessary. | |
1256 | #define wxJOYSTICK1 0 | |
1257 | #define wxJOYSTICK2 1 | |
1258 | ||
1259 | // Which button is down? | |
1260 | #define wxJOY_BUTTON1 1 | |
1261 | #define wxJOY_BUTTON2 2 | |
1262 | #define wxJOY_BUTTON3 4 | |
1263 | #define wxJOY_BUTTON4 8 | |
1264 | #define wxJOY_BUTTON_ANY -1 | |
1265 | ||
2b854a32 | 1266 | class WXDLLEXPORT wxJoystickEvent : public wxEvent |
c801d85f | 1267 | { |
2b854a32 VZ |
1268 | DECLARE_DYNAMIC_CLASS(wxJoystickEvent) |
1269 | ||
1270 | public: | |
1271 | wxPoint m_pos; | |
1272 | int m_zPosition; | |
1273 | int m_buttonChange; // Which button changed? | |
1274 | int m_buttonState; // Which buttons are down? | |
1275 | int m_joyStick; // Which joystick? | |
1276 | ||
1277 | wxJoystickEvent(wxEventType type = wxEVT_NULL, | |
1278 | int state = 0, | |
1279 | int joystick = wxJOYSTICK1, | |
1280 | int change = 0) | |
1281 | { | |
1282 | m_eventType = type; | |
1283 | m_buttonState = state; | |
1284 | m_pos = wxPoint(0,0); | |
1285 | m_zPosition = 0; | |
1286 | m_joyStick = joystick; | |
1287 | m_buttonChange = change; | |
1288 | } | |
1289 | ||
1290 | wxPoint GetPosition() const { return m_pos; } | |
1291 | int GetZPosition() const { return m_zPosition; } | |
1292 | int GetButtonState() const { return m_buttonState; } | |
1293 | int GetButtonChange() const { return m_buttonChange; } | |
1294 | int GetJoystick() const { return m_joyStick; } | |
1295 | ||
1296 | void SetJoystick(int stick) { m_joyStick = stick; } | |
1297 | void SetButtonState(int state) { m_buttonState = state; } | |
1298 | void SetButtonChange(int change) { m_buttonChange = change; } | |
1299 | void SetPosition(const wxPoint& pos) { m_pos = pos; } | |
1300 | void SetZPosition(int zPos) { m_zPosition = zPos; } | |
1301 | ||
1302 | // Was it a button event? (*doesn't* mean: is any button *down*?) | |
1303 | bool IsButton() const { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) || | |
b70ababc | 1304 | (GetEventType() == wxEVT_JOY_BUTTON_UP)); } |
2b854a32 VZ |
1305 | |
1306 | // Was it a move event? | |
1307 | bool IsMove() const { return (GetEventType() == wxEVT_JOY_MOVE) ; } | |
1308 | ||
1309 | // Was it a zmove event? | |
1310 | bool IsZMove() const { return (GetEventType() == wxEVT_JOY_ZMOVE) ; } | |
1311 | ||
1312 | // Was it a down event from button 1, 2, 3, 4 or any? | |
1313 | bool ButtonDown(int but = wxJOY_BUTTON_ANY) const | |
c801d85f | 1314 | { return ((GetEventType() == wxEVT_JOY_BUTTON_DOWN) && |
2b854a32 | 1315 | ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); } |
c801d85f | 1316 | |
2b854a32 VZ |
1317 | // Was it a up event from button 1, 2, 3 or any? |
1318 | bool ButtonUp(int but = wxJOY_BUTTON_ANY) const | |
c801d85f | 1319 | { return ((GetEventType() == wxEVT_JOY_BUTTON_UP) && |
2b854a32 | 1320 | ((but == wxJOY_BUTTON_ANY) || (but == m_buttonChange))); } |
c801d85f | 1321 | |
2b854a32 VZ |
1322 | // Was the given button 1,2,3,4 or any in Down state? |
1323 | bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const | |
c801d85f | 1324 | { return (((but == wxJOY_BUTTON_ANY) && (m_buttonState != 0)) || |
2b854a32 | 1325 | ((m_buttonState & but) == but)); } |
f305c661 GL |
1326 | |
1327 | void CopyObject(wxObject& obj) const; | |
c801d85f KB |
1328 | }; |
1329 | ||
1330 | // Drop files event class | |
1331 | /* | |
1332 | wxEVT_DROP_FILES | |
1333 | */ | |
1334 | ||
2b854a32 | 1335 | class WXDLLEXPORT wxDropFilesEvent : public wxEvent |
c801d85f | 1336 | { |
2b854a32 | 1337 | DECLARE_DYNAMIC_CLASS(wxDropFilesEvent) |
c801d85f | 1338 | |
2b854a32 VZ |
1339 | public: |
1340 | int m_noFiles; | |
1341 | wxPoint m_pos; | |
1342 | wxString* m_files; // Memory (de)allocated by code calling ProcessEvent | |
1343 | ||
1344 | wxDropFilesEvent(wxEventType type = wxEVT_NULL, | |
1345 | int noFiles = 0, | |
1346 | wxString *files = (wxString *) NULL) | |
1347 | { m_eventType = type; m_noFiles = noFiles; m_files = files; } | |
1348 | ||
1349 | wxPoint GetPosition() const { return m_pos; } | |
1350 | int GetNumberOfFiles() const { return m_noFiles; } | |
1351 | wxString *GetFiles() const { return m_files; } | |
f305c661 GL |
1352 | |
1353 | void CopyObject(wxObject& obj) const; | |
c801d85f KB |
1354 | }; |
1355 | ||
c801d85f KB |
1356 | // Update UI event |
1357 | /* | |
1358 | wxEVT_UPDATE_UI | |
1359 | */ | |
1360 | ||
2b854a32 | 1361 | class WXDLLEXPORT wxUpdateUIEvent : public wxCommandEvent |
c801d85f | 1362 | { |
2b854a32 | 1363 | DECLARE_DYNAMIC_CLASS(wxUpdateUIEvent) |
c801d85f | 1364 | |
2b854a32 VZ |
1365 | public: |
1366 | wxUpdateUIEvent(wxWindowID commandId = 0) | |
1367 | { | |
1368 | m_eventType = wxEVT_UPDATE_UI; | |
1369 | m_id = commandId; | |
1370 | m_checked = FALSE; | |
1371 | m_setChecked = FALSE; | |
1372 | m_enabled = FALSE; | |
1373 | m_setEnabled = FALSE; | |
1374 | m_setText = FALSE; | |
1375 | m_text = ""; | |
1376 | } | |
1377 | ||
1378 | bool GetChecked() const { return m_checked; } | |
1379 | bool GetEnabled() const { return m_enabled; } | |
1380 | wxString GetText() const { return m_text; } | |
1381 | bool GetSetText() const { return m_setText; } | |
1382 | bool GetSetChecked() const { return m_setChecked; } | |
1383 | bool GetSetEnabled() const { return m_setEnabled; } | |
1384 | ||
1385 | void Check(bool check) { m_checked = check; m_setChecked = TRUE; } | |
1386 | void Enable(bool enable) { m_enabled = enable; m_setEnabled = TRUE; } | |
1387 | void SetText(const wxString& text) { m_text = text; m_setText = TRUE; } | |
c801d85f | 1388 | |
f305c661 GL |
1389 | void CopyObject(wxObject& obj) const; |
1390 | ||
2b854a32 VZ |
1391 | protected: |
1392 | bool m_checked; | |
1393 | bool m_enabled; | |
1394 | bool m_setEnabled; | |
1395 | bool m_setText; | |
1396 | bool m_setChecked; | |
1397 | wxString m_text; | |
c801d85f KB |
1398 | }; |
1399 | ||
1400 | /* | |
1401 | wxEVT_SYS_COLOUR_CHANGED | |
1402 | */ | |
1403 | ||
1404 | // TODO: shouldn't all events record the window ID? | |
2b854a32 | 1405 | class WXDLLEXPORT wxSysColourChangedEvent : public wxEvent |
c801d85f | 1406 | { |
2b854a32 | 1407 | DECLARE_DYNAMIC_CLASS(wxSysColourChangedEvent) |
c801d85f | 1408 | |
2b854a32 VZ |
1409 | public: |
1410 | wxSysColourChangedEvent() | |
1411 | { m_eventType = wxEVT_SYS_COLOUR_CHANGED; } | |
c801d85f KB |
1412 | }; |
1413 | ||
f7bd2698 JS |
1414 | /* |
1415 | wxEVT_PALETTE_CHANGED | |
1416 | */ | |
1417 | ||
2b854a32 | 1418 | class WXDLLEXPORT wxPaletteChangedEvent : public wxEvent |
f7bd2698 | 1419 | { |
2b854a32 | 1420 | DECLARE_DYNAMIC_CLASS(wxPaletteChangedEvent) |
f7bd2698 JS |
1421 | |
1422 | public: | |
2b854a32 VZ |
1423 | wxPaletteChangedEvent(wxWindowID id = 0) : wxEvent(id) |
1424 | { | |
1425 | m_eventType = wxEVT_PALETTE_CHANGED; | |
1426 | m_changedWindow = (wxWindow *) NULL; | |
1427 | } | |
f7bd2698 | 1428 | |
2b854a32 VZ |
1429 | void SetChangedWindow(wxWindow* win) { m_changedWindow = win; } |
1430 | wxWindow* GetChangedWindow() const { return m_changedWindow; } | |
f7bd2698 | 1431 | |
f305c661 GL |
1432 | void CopyObject(wxObject& obj) const; |
1433 | ||
f7bd2698 | 1434 | protected: |
2b854a32 | 1435 | wxWindow* m_changedWindow; |
f7bd2698 JS |
1436 | }; |
1437 | ||
1438 | /* | |
1439 | wxEVT_QUERY_NEW_PALETTE | |
1440 | Indicates the window is getting keyboard focus and should re-do its palette. | |
1441 | */ | |
1442 | ||
2b854a32 | 1443 | class WXDLLEXPORT wxQueryNewPaletteEvent : public wxEvent |
f7bd2698 | 1444 | { |
2b854a32 | 1445 | DECLARE_DYNAMIC_CLASS(wxQueryNewPaletteEvent) |
f7bd2698 JS |
1446 | |
1447 | public: | |
2b854a32 VZ |
1448 | wxQueryNewPaletteEvent(wxWindowID id = 0): wxEvent(id) |
1449 | { m_eventType = wxEVT_QUERY_NEW_PALETTE; m_paletteRealized = FALSE; } | |
f7bd2698 | 1450 | |
2b854a32 VZ |
1451 | // App sets this if it changes the palette. |
1452 | void SetPaletteRealized(bool realized) { m_paletteRealized = realized; } | |
1453 | bool GetPaletteRealized() const { return m_paletteRealized; } | |
f7bd2698 | 1454 | |
f305c661 GL |
1455 | void CopyObject(wxObject& obj) const; |
1456 | ||
f7bd2698 | 1457 | protected: |
2b854a32 | 1458 | bool m_paletteRealized; |
f7bd2698 JS |
1459 | }; |
1460 | ||
7fdefd57 VZ |
1461 | /* |
1462 | Event generated by dialog navigation keys | |
1463 | wxEVT_NAVIGATION_KEY | |
1464 | */ | |
d9506e77 VZ |
1465 | // NB: don't derive from command event to avoid being propagated to the parent |
1466 | class WXDLLEXPORT wxNavigationKeyEvent : public wxEvent | |
7fdefd57 | 1467 | { |
7fdefd57 | 1468 | public: |
d9506e77 VZ |
1469 | wxNavigationKeyEvent() |
1470 | { | |
1471 | SetEventType(wxEVT_NAVIGATION_KEY); | |
1472 | ||
1473 | m_flags = IsForward | Propagate; // defaults are for TAB | |
1474 | m_focus = (wxWindow *)NULL; | |
1475 | } | |
7fdefd57 | 1476 | |
2b854a32 | 1477 | // direction: forward (true) or backward (false) |
d9506e77 VZ |
1478 | bool GetDirection() const |
1479 | { return (m_flags & IsForward) != 0; } | |
1480 | void SetDirection(bool bForward) | |
1481 | { if ( bForward ) m_flags |= IsForward; else m_flags &= ~IsForward; } | |
7fdefd57 | 1482 | |
2b854a32 VZ |
1483 | // it may be a window change event (MDI, notebook pages...) or a control |
1484 | // change event | |
d9506e77 VZ |
1485 | bool IsWindowChange() const |
1486 | { return (m_flags & WinChange) != 0; } | |
1487 | void SetWindowChange(bool bIs) | |
1488 | { if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; } | |
1489 | ||
1490 | // some navigation events are meant to be propagated upwards (Windows | |
1491 | // convention is to do this for TAB events) while others should always | |
1492 | // cycle inside the panel/radiobox/whatever we're current inside | |
1493 | bool ShouldPropagate() const | |
1494 | { return (m_flags & Propagate) != 0; } | |
1495 | void SetPropagate(bool bDoIt) | |
1496 | { if ( bDoIt ) m_flags |= Propagate; else m_flags &= ~Propagate; } | |
7fdefd57 | 1497 | |
2b854a32 VZ |
1498 | // the child which has the focus currently (may be NULL - use |
1499 | // wxWindow::FindFocus then) | |
d9506e77 VZ |
1500 | wxWindow* GetCurrentFocus() const { return m_focus; } |
1501 | void SetCurrentFocus(wxWindow *win) { m_focus = win; } | |
1502 | ||
1503 | private: | |
1504 | enum | |
1505 | { | |
1506 | IsForward = 0x0001, | |
1507 | WinChange = 0x0002, | |
1508 | Propagate = 0x0004 | |
1509 | }; | |
1510 | ||
1511 | long m_flags; | |
1512 | wxWindow *m_focus; | |
1513 | ||
1514 | DECLARE_DYNAMIC_CLASS(wxNavigationKeyEvent) | |
7fdefd57 VZ |
1515 | }; |
1516 | ||
42e69d6b VZ |
1517 | // Window creation/destruction events: the first is sent as soon as window is |
1518 | // created (i.e. the underlying GUI object exists), but when the C++ object is | |
1519 | // fully initialized (so virtual functions may be called). The second, | |
1520 | // wxEVT_DESTROY, is sent right before the window is destroyed - again, it's | |
1521 | // still safe to call virtual functions at this moment | |
1522 | /* | |
1523 | wxEVT_CREATE | |
1524 | wxEVT_DESTROY | |
1525 | */ | |
1526 | ||
1527 | class WXDLLEXPORT wxWindowCreateEvent : public wxEvent | |
1528 | { | |
1529 | DECLARE_DYNAMIC_CLASS(wxWindowCreateEvent) | |
1530 | ||
1531 | public: | |
1532 | wxWindowCreateEvent(wxWindow *win = NULL); | |
1533 | ||
1534 | wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } | |
1535 | }; | |
1536 | ||
1537 | class WXDLLEXPORT wxWindowDestroyEvent : public wxEvent | |
1538 | { | |
1539 | DECLARE_DYNAMIC_CLASS(wxWindowDestroyEvent) | |
1540 | ||
1541 | public: | |
1542 | wxWindowDestroyEvent(wxWindow *win = NULL); | |
1543 | ||
1544 | wxWindow *GetWindow() const { return (wxWindow *)GetEventObject(); } | |
1545 | }; | |
1546 | ||
e90c1d2a VZ |
1547 | #endif // wxUSE_GUI |
1548 | ||
1549 | // Idle event | |
1550 | /* | |
1551 | wxEVT_IDLE | |
1552 | */ | |
1553 | ||
1554 | class WXDLLEXPORT wxIdleEvent : public wxEvent | |
1555 | { | |
1556 | DECLARE_DYNAMIC_CLASS(wxIdleEvent) | |
1557 | ||
1558 | public: | |
1559 | wxIdleEvent() | |
1560 | { m_eventType = wxEVT_IDLE; m_requestMore = FALSE; } | |
1561 | ||
1562 | void RequestMore(bool needMore = TRUE) { m_requestMore = needMore; } | |
1563 | bool MoreRequested() const { return m_requestMore; } | |
1564 | ||
1565 | void CopyObject(wxObject& obj) const; | |
1566 | ||
1567 | protected: | |
1568 | bool m_requestMore; | |
1569 | }; | |
1570 | ||
e5fb7191 | 1571 | /* TODO |
c801d85f | 1572 | wxEVT_POWER, |
c801d85f KB |
1573 | wxEVT_MOUSE_CAPTURE_CHANGED, |
1574 | wxEVT_SETTING_CHANGED, // WM_WININICHANGE (NT) / WM_SETTINGCHANGE (Win95) | |
c801d85f KB |
1575 | // wxEVT_FONT_CHANGED, // WM_FONTCHANGE: roll into wxEVT_SETTING_CHANGED, but remember to propagate |
1576 | // wxEVT_FONT_CHANGED to all other windows (maybe). | |
1577 | wxEVT_DRAW_ITEM, // Leave these three as virtual functions in wxControl?? Platform-specific. | |
1578 | wxEVT_MEASURE_ITEM, | |
1579 | wxEVT_COMPARE_ITEM | |
1580 | */ | |
1581 | ||
8e193f38 VZ |
1582 | // ============================================================================ |
1583 | // event handler and related classes | |
1584 | // ============================================================================ | |
1585 | ||
c801d85f KB |
1586 | typedef void (wxObject::*wxObjectEventFunction)(wxEvent&); |
1587 | ||
1588 | struct WXDLLEXPORT wxEventTableEntry | |
1589 | { | |
003a43dc | 1590 | // For some reason, this can't be wxEventType, or VC++ complains. |
2b854a32 VZ |
1591 | int m_eventType; // main event type |
1592 | int m_id; // control/menu/toolbar id | |
1593 | int m_lastId; // used for ranges of ids | |
1594 | wxObjectEventFunction m_fn; // function to call: not wxEventFunction, | |
1595 | // because of dependency problems | |
1596 | ||
1597 | wxObject* m_callbackUserData; | |
c801d85f KB |
1598 | }; |
1599 | ||
1600 | struct WXDLLEXPORT wxEventTable | |
1601 | { | |
2b854a32 VZ |
1602 | const wxEventTable *baseTable; // Points to base event table (next in chain) |
1603 | const wxEventTableEntry *entries; // Points to bottom of entry array | |
c801d85f KB |
1604 | }; |
1605 | ||
2b854a32 | 1606 | class WXDLLEXPORT wxEvtHandler : public wxObject |
c801d85f | 1607 | { |
2b854a32 VZ |
1608 | DECLARE_DYNAMIC_CLASS(wxEvtHandler) |
1609 | ||
1610 | public: | |
1611 | wxEvtHandler(); | |
1612 | ~wxEvtHandler(); | |
1613 | ||
1614 | wxEvtHandler *GetNextHandler() const { return m_nextHandler; } | |
1615 | wxEvtHandler *GetPreviousHandler() const { return m_previousHandler; } | |
1616 | void SetNextHandler(wxEvtHandler *handler) { m_nextHandler = handler; } | |
1617 | void SetPreviousHandler(wxEvtHandler *handler) { m_previousHandler = handler; } | |
1618 | ||
8e193f38 | 1619 | void SetEvtHandlerEnabled(bool enabled) { m_enabled = enabled; } |
2b854a32 VZ |
1620 | bool GetEvtHandlerEnabled() const { return m_enabled; } |
1621 | ||
8e193f38 VZ |
1622 | // process an event right now |
1623 | virtual bool ProcessEvent(wxEvent& event); | |
2b854a32 | 1624 | |
8e193f38 VZ |
1625 | // add an event to be processed later |
1626 | void AddPendingEvent(wxEvent& event); | |
2b854a32 | 1627 | |
8e193f38 VZ |
1628 | // process all pending events |
1629 | void ProcessPendingEvents(); | |
2b854a32 | 1630 | |
20947e08 | 1631 | // add a |
7214297d GL |
1632 | #if wxUSE_THREADS |
1633 | bool ProcessThreadEvent(wxEvent& event); | |
7214297d | 1634 | #endif |
2b854a32 VZ |
1635 | |
1636 | // Dynamic association of a member function handler with the event handler, | |
1637 | // id and event type | |
1638 | void Connect( int id, int lastId, wxEventType eventType, | |
1639 | wxObjectEventFunction func, | |
1640 | wxObject *userData = (wxObject *) NULL ); | |
1641 | ||
1642 | // Convenience function: take just one id | |
1643 | void Connect( int id, wxEventType eventType, | |
1644 | wxObjectEventFunction func, | |
1645 | wxObject *userData = (wxObject *) NULL ) | |
1646 | { Connect(id, -1, eventType, func, userData); } | |
1647 | ||
97d7bfb8 RR |
1648 | bool Disconnect( int id, int lastId = -1, wxEventType eventType = wxEVT_NULL, |
1649 | wxObjectEventFunction func = NULL, | |
1650 | wxObject *userData = (wxObject *) NULL ); | |
1651 | ||
1652 | // Convenience function: take just one id | |
1653 | bool Disconnect( int id, wxEventType eventType = wxEVT_NULL, | |
1654 | wxObjectEventFunction func = NULL, | |
1655 | wxObject *userData = (wxObject *) NULL ) | |
1656 | { return Disconnect(id, -1, eventType, func, userData); } | |
1657 | ||
8e193f38 VZ |
1658 | // implementation from now on |
1659 | virtual bool SearchEventTable(wxEventTable& table, wxEvent& event); | |
2b854a32 | 1660 | bool SearchDynamicEventTable( wxEvent& event ); |
c801d85f | 1661 | |
63863e09 | 1662 | #if wxUSE_THREADS |
20947e08 DW |
1663 | void ClearEventLocker() |
1664 | { | |
1665 | # if !defined(__VISAGECPP__) | |
1666 | delete m_eventsLocker; | |
1667 | m_eventsLocker = NULL; | |
1668 | #endif | |
1669 | }; | |
63863e09 JS |
1670 | #endif |
1671 | ||
8e193f38 VZ |
1672 | // old stuff |
1673 | ||
1674 | #if WXWIN_COMPATIBILITY_2 | |
1675 | virtual void OnCommand(wxWindow& WXUNUSED(win), | |
1676 | wxCommandEvent& WXUNUSED(event)) | |
1677 | { | |
1678 | wxFAIL_MSG(wxT("shouldn't be called any more")); | |
1679 | } | |
1680 | ||
1681 | // Called if child control has no callback function | |
1682 | virtual long Default() | |
1683 | { return GetNextHandler() ? GetNextHandler()->Default() : 0; }; | |
1684 | #endif // WXWIN_COMPATIBILITY_2 | |
1685 | ||
1686 | #if WXWIN_COMPATIBILITY | |
1687 | virtual bool OnClose(); | |
1688 | #endif | |
1689 | ||
c801d85f | 1690 | private: |
8e193f38 | 1691 | static const wxEventTableEntry sm_eventTableEntries[]; |
2b854a32 | 1692 | |
c801d85f | 1693 | protected: |
193bf013 VZ |
1694 | static const wxEventTable sm_eventTable; |
1695 | ||
1696 | virtual const wxEventTable *GetEventTable() const; | |
1697 | ||
c801d85f | 1698 | protected: |
63863e09 JS |
1699 | wxEvtHandler* m_nextHandler; |
1700 | wxEvtHandler* m_previousHandler; | |
63863e09 | 1701 | wxList* m_dynamicEvents; |
42e69d6b | 1702 | wxList* m_pendingEvents; |
7214297d | 1703 | #if wxUSE_THREADS |
20947e08 DW |
1704 | #if defined (__VISAGECPP__) |
1705 | wxCriticalSection m_eventsLocker; | |
1706 | # else | |
63863e09 | 1707 | wxCriticalSection* m_eventsLocker; |
20947e08 | 1708 | # endif |
7214297d | 1709 | #endif |
193bf013 VZ |
1710 | |
1711 | // optimization: instead of using costly IsKindOf() to decide whether we're | |
1712 | // a window (which is true in 99% of cases), use this flag | |
63863e09 | 1713 | bool m_isWindow; |
8e193f38 VZ |
1714 | |
1715 | // Is event handler enabled? | |
1716 | bool m_enabled; | |
c801d85f KB |
1717 | }; |
1718 | ||
1719 | typedef void (wxEvtHandler::*wxEventFunction)(wxEvent&); | |
e90c1d2a | 1720 | #if wxUSE_GUI |
c801d85f KB |
1721 | typedef void (wxEvtHandler::*wxCommandEventFunction)(wxCommandEvent&); |
1722 | typedef void (wxEvtHandler::*wxScrollEventFunction)(wxScrollEvent&); | |
c5b42c87 | 1723 | typedef void (wxEvtHandler::*wxScrollWinEventFunction)(wxScrollWinEvent&); |
c801d85f KB |
1724 | typedef void (wxEvtHandler::*wxSizeEventFunction)(wxSizeEvent&); |
1725 | typedef void (wxEvtHandler::*wxMoveEventFunction)(wxMoveEvent&); | |
1726 | typedef void (wxEvtHandler::*wxPaintEventFunction)(wxPaintEvent&); | |
1727 | typedef void (wxEvtHandler::*wxEraseEventFunction)(wxEraseEvent&); | |
1728 | typedef void (wxEvtHandler::*wxMouseEventFunction)(wxMouseEvent&); | |
1729 | typedef void (wxEvtHandler::*wxCharEventFunction)(wxKeyEvent&); | |
1730 | typedef void (wxEvtHandler::*wxFocusEventFunction)(wxFocusEvent&); | |
1731 | typedef void (wxEvtHandler::*wxActivateEventFunction)(wxActivateEvent&); | |
1732 | typedef void (wxEvtHandler::*wxMenuEventFunction)(wxMenuEvent&); | |
1733 | typedef void (wxEvtHandler::*wxJoystickEventFunction)(wxJoystickEvent&); | |
1734 | typedef void (wxEvtHandler::*wxDropFilesEventFunction)(wxDropFilesEvent&); | |
1735 | typedef void (wxEvtHandler::*wxInitDialogEventFunction)(wxInitDialogEvent&); | |
1736 | typedef void (wxEvtHandler::*wxSysColourChangedFunction)(wxSysColourChangedEvent&); | |
1737 | typedef void (wxEvtHandler::*wxUpdateUIEventFunction)(wxUpdateUIEvent&); | |
1738 | typedef void (wxEvtHandler::*wxIdleEventFunction)(wxIdleEvent&); | |
1739 | typedef void (wxEvtHandler::*wxCloseEventFunction)(wxCloseEvent&); | |
1740 | typedef void (wxEvtHandler::*wxShowEventFunction)(wxShowEvent&); | |
1741 | typedef void (wxEvtHandler::*wxIconizeEventFunction)(wxShowEvent&); | |
1742 | typedef void (wxEvtHandler::*wxMaximizeEventFunction)(wxShowEvent&); | |
81d66cf3 | 1743 | typedef void (wxEvtHandler::*wxNavigationKeyEventFunction)(wxNavigationKeyEvent&); |
f7bd2698 JS |
1744 | typedef void (wxEvtHandler::*wxPaletteChangedEventFunction)(wxPaletteChangedEvent&); |
1745 | typedef void (wxEvtHandler::*wxQueryNewPaletteEventFunction)(wxQueryNewPaletteEvent&); | |
e90c1d2a | 1746 | #endif // wxUSE_GUI |
c801d85f KB |
1747 | |
1748 | // N.B. In GNU-WIN32, you *have* to take the address of a member function | |
1749 | // (use &) or the compiler crashes... | |
1750 | ||
1751 | #define DECLARE_EVENT_TABLE() \ | |
1752 | private:\ | |
2b854a32 | 1753 | static const wxEventTableEntry sm_eventTableEntries[];\ |
c801d85f | 1754 | protected:\ |
2b854a32 VZ |
1755 | static const wxEventTable sm_eventTable;\ |
1756 | virtual const wxEventTable* GetEventTable() const; | |
c801d85f KB |
1757 | |
1758 | #define BEGIN_EVENT_TABLE(theClass, baseClass) \ | |
1759 | const wxEventTable *theClass::GetEventTable() const { return &theClass::sm_eventTable; }\ | |
1760 | const wxEventTable theClass::sm_eventTable =\ | |
2b854a32 | 1761 | { &baseClass::sm_eventTable, &theClass::sm_eventTableEntries[0] };\ |
c801d85f KB |
1762 | const wxEventTableEntry theClass::sm_eventTableEntries[] = { \ |
1763 | ||
1764 | #define END_EVENT_TABLE() \ | |
74e34480 | 1765 | { 0, 0, 0, 0, 0 } }; |
2b854a32 | 1766 | |
c801d85f KB |
1767 | /* |
1768 | * Event table macros | |
1769 | */ | |
1770 | ||
1771 | // Generic events | |
c67daf87 UR |
1772 | #define EVT_CUSTOM(event, id, func) { event, id, -1, (wxObjectEventFunction) (wxEventFunction) & func, (wxObject *) NULL }, |
1773 | #define EVT_CUSTOM_RANGE(event, id1, id2, func) { event, id1, id2, (wxObjectEventFunction) (wxEventFunction) & func, (wxObject *) NULL }, | |
c801d85f KB |
1774 | |
1775 | // Miscellaneous | |
c67daf87 UR |
1776 | #define EVT_SIZE(func) { wxEVT_SIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxSizeEventFunction) & func, (wxObject *) NULL }, |
1777 | #define EVT_MOVE(func) { wxEVT_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMoveEventFunction) & func, (wxObject *) NULL }, | |
1778 | #define EVT_CLOSE(func) { wxEVT_CLOSE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL }, | |
387a3b02 JS |
1779 | #define EVT_END_SESSION(func) { wxEVT_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL }, |
1780 | #define EVT_QUERY_END_SESSION(func) { wxEVT_QUERY_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL }, | |
c67daf87 UR |
1781 | #define EVT_PAINT(func) { wxEVT_PAINT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaintEventFunction) & func, (wxObject *) NULL }, |
1782 | #define EVT_ERASE_BACKGROUND(func) { wxEVT_ERASE_BACKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxEraseEventFunction) & func, (wxObject *) NULL }, | |
1783 | #define EVT_CHAR(func) { wxEVT_CHAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL }, | |
4ce81a75 JS |
1784 | #define EVT_KEY_DOWN(func) { wxEVT_KEY_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL }, |
1785 | #define EVT_KEY_UP(func) { wxEVT_KEY_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, (wxObject *) NULL }, | |
fe71f65c | 1786 | #define EVT_CHAR_HOOK(func) { wxEVT_CHAR_HOOK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCharEventFunction) & func, NULL }, |
c67daf87 UR |
1787 | #define EVT_MENU_HIGHLIGHT(id, func) { wxEVT_MENU_HIGHLIGHT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxMenuEventFunction) & func, (wxObject *) NULL }, |
1788 | #define EVT_MENU_HIGHLIGHT_ALL(func) { wxEVT_MENU_HIGHLIGHT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMenuEventFunction) & func, (wxObject *) NULL }, | |
1789 | #define EVT_SET_FOCUS(func) { wxEVT_SET_FOCUS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxFocusEventFunction) & func, (wxObject *) NULL }, | |
1790 | #define EVT_KILL_FOCUS(func) { wxEVT_KILL_FOCUS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxFocusEventFunction) & func, (wxObject *) NULL }, | |
1791 | #define EVT_ACTIVATE(func) { wxEVT_ACTIVATE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxActivateEventFunction) & func, (wxObject *) NULL }, | |
1792 | #define EVT_ACTIVATE_APP(func) { wxEVT_ACTIVATE_APP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxActivateEventFunction) & func, (wxObject *) NULL }, | |
1793 | #define EVT_END_SESSION(func) { wxEVT_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL }, | |
1794 | #define EVT_QUERY_END_SESSION(func) { wxEVT_QUERY_END_SESSION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCloseEventFunction) & func, (wxObject *) NULL }, | |
1795 | #define EVT_DROP_FILES(func) { wxEVT_DROP_FILES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxDropFilesEventFunction) & func, (wxObject *) NULL }, | |
1796 | #define EVT_INIT_DIALOG(func) { wxEVT_INIT_DIALOG, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxInitDialogEventFunction) & func, (wxObject *) NULL }, | |
1797 | #define EVT_SYS_COLOUR_CHANGED(func) { wxEVT_SYS_COLOUR_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxSysColourChangedFunction) & func, (wxObject *) NULL }, | |
1798 | #define EVT_SHOW(func) { wxEVT_SHOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxShowEventFunction) & func, (wxObject *) NULL }, | |
1799 | #define EVT_MAXIMIZE(func) { wxEVT_MAXIMIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMaximizeEventFunction) & func, (wxObject *) NULL }, | |
1800 | #define EVT_ICONIZE(func) { wxEVT_ICONIZE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxIconizeEventFunction) & func, (wxObject *) NULL }, | |
1801 | #define EVT_NAVIGATION_KEY(func) { wxEVT_NAVIGATION_KEY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) (wxNavigationKeyEventFunction) & func, (wxObject *) NULL }, | |
1802 | #define EVT_PALETTE_CHANGED(func) { wxEVT_PALETTE_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxPaletteChangedEventFunction) & func, (wxObject *) NULL }, | |
1803 | #define EVT_QUERY_NEW_PALETTE(func) { wxEVT_QUERY_NEW_PALETTE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, (wxObject *) NULL }, | |
42e69d6b VZ |
1804 | #define EVT_WINDOW_CREATE(func) { wxEVT_CREATE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, (wxObject *) NULL }, |
1805 | #define EVT_WINDOW_DESTROY(func) { wxEVT_DESTROY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxQueryNewPaletteEventFunction) & func, (wxObject *) NULL }, | |
c801d85f KB |
1806 | |
1807 | // Mouse events | |
c67daf87 UR |
1808 | #define EVT_LEFT_DOWN(func) { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, |
1809 | #define EVT_LEFT_UP(func) { wxEVT_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, | |
1810 | #define EVT_MIDDLE_DOWN(func) { wxEVT_MIDDLE_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, | |
1811 | #define EVT_MIDDLE_UP(func) { wxEVT_MIDDLE_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, | |
1812 | #define EVT_RIGHT_DOWN(func) { wxEVT_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, | |
1813 | #define EVT_RIGHT_UP(func) { wxEVT_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, | |
1814 | #define EVT_MOTION(func) { wxEVT_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, | |
1815 | #define EVT_LEFT_DCLICK(func) { wxEVT_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, | |
1816 | #define EVT_MIDDLE_DCLICK(func) { wxEVT_MIDDLE_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, | |
1817 | #define EVT_RIGHT_DCLICK(func) { wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, | |
1818 | #define EVT_LEAVE_WINDOW(func) { wxEVT_LEAVE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, | |
1819 | #define EVT_ENTER_WINDOW(func) { wxEVT_ENTER_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, | |
c801d85f KB |
1820 | |
1821 | // All mouse events | |
1822 | #define EVT_MOUSE_EVENTS(func) \ | |
c67daf87 UR |
1823 | { wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },\ |
1824 | { wxEVT_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },\ | |
1825 | { wxEVT_MIDDLE_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },\ | |
1826 | { wxEVT_MIDDLE_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },\ | |
1827 | { wxEVT_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },\ | |
1828 | { wxEVT_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },\ | |
1829 | { wxEVT_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },\ | |
1830 | { wxEVT_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },\ | |
1831 | { wxEVT_MIDDLE_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },\ | |
1832 | { wxEVT_RIGHT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },\ | |
1833 | { wxEVT_ENTER_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL },\ | |
1834 | { wxEVT_LEAVE_WINDOW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL }, | |
c801d85f KB |
1835 | |
1836 | // EVT_COMMAND | |
1f112209 | 1837 | #define EVT_COMMAND(id, event, fn) { event, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, |
dbdb39b2 | 1838 | #define EVT_COMMAND_RANGE(id1, id2, event, fn) { event, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, |
c801d85f | 1839 | |
c5b42c87 RR |
1840 | // Scrolling from wxWindow (sent to wxScrolledWindow) |
1841 | #define EVT_SCROLLWIN(func) \ | |
1842 | { wxEVT_SCROLLWIN_TOP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL },\ | |
1843 | { wxEVT_SCROLLWIN_BOTTOM, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL },\ | |
1844 | { wxEVT_SCROLLWIN_LINEUP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL },\ | |
1845 | { wxEVT_SCROLLWIN_LINEDOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL },\ | |
1846 | { wxEVT_SCROLLWIN_PAGEUP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL },\ | |
1847 | { wxEVT_SCROLLWIN_PAGEDOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL },\ | |
1848 | { wxEVT_SCROLLWIN_THUMBTRACK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL }, | |
1849 | ||
1850 | #define EVT_SCROLLWIN_TOP(func) { wxEVT_SCROLLWIN_TOP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL }, | |
1851 | #define EVT_SCROLLWIN_BOTTOM(func) { wxEVT_SCROLLWIN_BOTTOM, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL }, | |
1852 | #define EVT_SCROLLWIN_LINEUP(func) { wxEVT_SCROLLWIN_LINEUP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL }, | |
1853 | #define EVT_SCROLLWIN_LINEDOWN(func) { wxEVT_SCROLLWIN_LINEDOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL }, | |
1854 | #define EVT_SCROLLWIN_PAGEUP(func) { wxEVT_SCROLLWIN_PAGEUP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL }, | |
1855 | #define EVT_SCROLLWIN_PAGEDOWN(func) { wxEVT_SCROLLWIN_PAGEDOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL }, | |
1856 | #define EVT_SCROLLWIN_THUMBTRACK(func) { wxEVT_SCROLLWIN_THUMBTRACK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollWinEventFunction) & func, (wxObject *) NULL }, | |
1857 | ||
1858 | // Scrolling from wxSlider and wxScrollBar | |
c801d85f | 1859 | #define EVT_SCROLL(func) \ |
c67daf87 UR |
1860 | { wxEVT_SCROLL_TOP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL },\ |
1861 | { wxEVT_SCROLL_BOTTOM, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL },\ | |
1862 | { wxEVT_SCROLL_LINEUP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL },\ | |
1863 | { wxEVT_SCROLL_LINEDOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL },\ | |
1864 | { wxEVT_SCROLL_PAGEUP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL },\ | |
1865 | { wxEVT_SCROLL_PAGEDOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL },\ | |
1866 | { wxEVT_SCROLL_THUMBTRACK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1867 | ||
1868 | #define EVT_SCROLL_TOP(func) { wxEVT_SCROLL_TOP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1869 | #define EVT_SCROLL_BOTTOM(func) { wxEVT_SCROLL_BOTTOM, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1870 | #define EVT_SCROLL_LINEUP(func) { wxEVT_SCROLL_LINEUP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1871 | #define EVT_SCROLL_LINEDOWN(func) { wxEVT_SCROLL_LINEDOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1872 | #define EVT_SCROLL_PAGEUP(func) { wxEVT_SCROLL_PAGEUP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1873 | #define EVT_SCROLL_PAGEDOWN(func) { wxEVT_SCROLL_PAGEDOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1874 | #define EVT_SCROLL_THUMBTRACK(func) { wxEVT_SCROLL_THUMBTRACK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
c801d85f | 1875 | |
c5b42c87 | 1876 | // Scrolling from wxSlider and wxScrollBar, with an id |
c801d85f | 1877 | #define EVT_COMMAND_SCROLL(id, func) \ |
c67daf87 UR |
1878 | { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL },\ |
1879 | { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL },\ | |
1880 | { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL },\ | |
1881 | { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL },\ | |
1882 | { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL },\ | |
1883 | { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL },\ | |
1884 | { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1885 | ||
1886 | #define EVT_COMMAND_SCROLL_TOP(id, func) { wxEVT_SCROLL_TOP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1887 | #define EVT_COMMAND_SCROLL_BOTTOM(id, func) { wxEVT_SCROLL_BOTTOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1888 | #define EVT_COMMAND_SCROLL_LINEUP(id, func) { wxEVT_SCROLL_LINEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1889 | #define EVT_COMMAND_SCROLL_LINEDOWN(id, func) { wxEVT_SCROLL_LINEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1890 | #define EVT_COMMAND_SCROLL_PAGEUP(id, func) { wxEVT_SCROLL_PAGEUP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1891 | #define EVT_COMMAND_SCROLL_PAGEDOWN(id, func) { wxEVT_SCROLL_PAGEDOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
1892 | #define EVT_COMMAND_SCROLL_THUMBTRACK(id, func) { wxEVT_SCROLL_THUMBTRACK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxScrollEventFunction) & func, (wxObject *) NULL }, | |
c801d85f KB |
1893 | |
1894 | // Convenience macros for commonly-used commands | |
c67daf87 UR |
1895 | #define EVT_BUTTON(id, fn) { wxEVT_COMMAND_BUTTON_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, |
1896 | #define EVT_CHECKBOX(id, fn) { wxEVT_COMMAND_CHECKBOX_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1897 | #define EVT_CHOICE(id, fn) { wxEVT_COMMAND_CHOICE_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1898 | #define EVT_LISTBOX(id, fn) { wxEVT_COMMAND_LISTBOX_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1899 | #define EVT_LISTBOX_DCLICK(id, fn) { wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1900 | #define EVT_TEXT(id, fn) { wxEVT_COMMAND_TEXT_UPDATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1901 | #define EVT_TEXT_ENTER(id, fn) { wxEVT_COMMAND_TEXT_ENTER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1902 | #define EVT_MENU(id, fn) { wxEVT_COMMAND_MENU_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1903 | #define EVT_MENU_RANGE(id1, id2, fn) { wxEVT_COMMAND_MENU_SELECTED, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1904 | #define EVT_SLIDER(id, fn) { wxEVT_COMMAND_SLIDER_UPDATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1905 | #define EVT_RADIOBOX(id, fn) { wxEVT_COMMAND_RADIOBOX_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1906 | #define EVT_RADIOBUTTON(id, fn) { wxEVT_COMMAND_RADIOBUTTON_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
c801d85f | 1907 | // EVT_SCROLLBAR is now obsolete since we use EVT_COMMAND_SCROLL... events |
c67daf87 UR |
1908 | #define EVT_SCROLLBAR(id, fn) { wxEVT_COMMAND_SCROLLBAR_UPDATED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, |
1909 | #define EVT_VLBOX(id, fn) { wxEVT_COMMAND_VLBOX_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1910 | #define EVT_COMBOBOX(id, fn) { wxEVT_COMMAND_COMBOBOX_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1911 | #define EVT_TOOL(id, fn) { wxEVT_COMMAND_TOOL_CLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1912 | #define EVT_TOOL_RANGE(id1, id2, fn) { wxEVT_COMMAND_TOOL_CLICKED, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1913 | #define EVT_TOOL_RCLICKED(id, fn) { wxEVT_COMMAND_TOOL_RCLICKED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1914 | #define EVT_TOOL_RCLICKED_RANGE(id1, id2, fn) { wxEVT_COMMAND_TOOL_RCLICKED, id1, id2, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1915 | #define EVT_TOOL_ENTER(id, fn) { wxEVT_COMMAND_TOOL_ENTER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1916 | #define EVT_CHECKLISTBOX(id, fn) { wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
c801d85f KB |
1917 | |
1918 | // Generic command events | |
c67daf87 UR |
1919 | #define EVT_COMMAND_LEFT_CLICK(id, fn) { wxEVT_COMMAND_LEFT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, |
1920 | #define EVT_COMMAND_LEFT_DCLICK(id, fn) { wxEVT_COMMAND_LEFT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1921 | #define EVT_COMMAND_RIGHT_CLICK(id, fn) { wxEVT_COMMAND_RIGHT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1922 | #define EVT_COMMAND_RIGHT_DCLICK(id, fn) { wxEVT_COMMAND_RIGHT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1923 | #define EVT_COMMAND_SET_FOCUS(id, fn) { wxEVT_COMMAND_SET_FOCUS, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1924 | #define EVT_COMMAND_KILL_FOCUS(id, fn) { wxEVT_COMMAND_KILL_FOCUS, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
1925 | #define EVT_COMMAND_ENTER(id, fn) { wxEVT_COMMAND_ENTER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) & fn, (wxObject *) NULL }, | |
c801d85f KB |
1926 | |
1927 | // Joystick events | |
1928 | #define EVT_JOY_DOWN(func) \ | |
c67daf87 | 1929 | { wxEVT_JOY_BUTTON_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL }, |
c801d85f | 1930 | #define EVT_JOY_UP(func) \ |
c67daf87 | 1931 | { wxEVT_JOY_BUTTON_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL }, |
c801d85f | 1932 | #define EVT_JOY_MOVE(func) \ |
c67daf87 | 1933 | { wxEVT_JOY_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL }, |
c801d85f | 1934 | #define EVT_JOY_ZMOVE(func) \ |
c67daf87 | 1935 | { wxEVT_JOY_ZMOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL }, |
c801d85f KB |
1936 | |
1937 | // All joystick events | |
1938 | #define EVT_JOYSTICK_EVENTS(func) \ | |
c67daf87 UR |
1939 | { wxEVT_JOY_BUTTON_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL },\ |
1940 | { wxEVT_JOY_BUTTON_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL },\ | |
1941 | { wxEVT_JOY_MOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL },\ | |
1942 | { wxEVT_JOY_ZMOVE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxJoystickEventFunction) & func, (wxObject *) NULL },\ | |
c801d85f KB |
1943 | |
1944 | // Idle event | |
1945 | #define EVT_IDLE(func) \ | |
c67daf87 | 1946 | { wxEVT_IDLE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxIdleEventFunction) & func, (wxObject *) NULL },\ |
c801d85f KB |
1947 | |
1948 | // Update UI event | |
1949 | #define EVT_UPDATE_UI(id, func) \ | |
c67daf87 | 1950 | { wxEVT_UPDATE_UI, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxUpdateUIEventFunction) & func, (wxObject *) NULL },\ |
c801d85f | 1951 | |
8e193f38 VZ |
1952 | // ---------------------------------------------------------------------------- |
1953 | // Global data | |
1954 | // ---------------------------------------------------------------------------- | |
1955 | ||
1956 | // for pending event processing - notice that there is intentionally no | |
1957 | // WXDLLEXPORT here | |
1958 | extern wxList *wxPendingEvents; | |
1959 | #if wxUSE_THREADS | |
1960 | extern wxCriticalSection *wxPendingEventsLocker; | |
1961 | #endif | |
1962 | ||
e90c1d2a VZ |
1963 | // ---------------------------------------------------------------------------- |
1964 | // Helper functions | |
1965 | // ---------------------------------------------------------------------------- | |
1966 | ||
1967 | #if wxUSE_GUI | |
e702ff0f JS |
1968 | |
1969 | // Find a window with the focus, that is also a descendant of the given window. | |
1970 | // This is used to determine the window to initially send commands to. | |
1971 | wxWindow* wxFindFocusDescendant(wxWindow* ancestor); | |
1972 | ||
e90c1d2a VZ |
1973 | #endif // wxUSE_GUI |
1974 | ||
c801d85f | 1975 | #endif |
2b854a32 | 1976 | // _WX_EVENTH__ |