]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _event.i | |
3 | // Purpose: SWIG interface for common event classes and event binders | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 24-May-1998 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2003 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
16 | //--------------------------------------------------------------------------- | |
17 | // Include some extra python code here | |
18 | %pythoncode "_event_ex.py" | |
19 | ||
20 | //--------------------------------------------------------------------------- | |
21 | %newgroup; | |
22 | ||
23 | // the predefined constants for the number of times we propagate event | |
24 | // upwards window child-parent chain | |
25 | enum Propagation_state | |
26 | { | |
27 | // don't propagate it at all | |
28 | wxEVENT_PROPAGATE_NONE = 0, | |
29 | ||
30 | // propagate it until it is processed | |
31 | wxEVENT_PROPAGATE_MAX = INT_MAX | |
32 | }; | |
33 | ||
34 | ||
35 | //--------------------------------------------------------------------------- | |
36 | // Event types | |
37 | ||
38 | wxEventType wxNewEventType(); | |
39 | ||
40 | ||
41 | %constant wxEventType wxEVT_NULL; | |
42 | %constant wxEventType wxEVT_FIRST; | |
43 | %constant wxEventType wxEVT_USER_FIRST; | |
44 | ||
45 | %constant wxEventType wxEVT_COMMAND_BUTTON_CLICKED; | |
46 | %constant wxEventType wxEVT_COMMAND_CHECKBOX_CLICKED; | |
47 | %constant wxEventType wxEVT_COMMAND_CHOICE_SELECTED; | |
48 | %constant wxEventType wxEVT_COMMAND_LISTBOX_SELECTED; | |
49 | %constant wxEventType wxEVT_COMMAND_LISTBOX_DOUBLECLICKED; | |
50 | %constant wxEventType wxEVT_COMMAND_CHECKLISTBOX_TOGGLED; | |
51 | ||
52 | %constant wxEventType wxEVT_COMMAND_MENU_SELECTED; | |
53 | %constant wxEventType wxEVT_COMMAND_TOOL_CLICKED; | |
54 | %constant wxEventType wxEVT_COMMAND_SLIDER_UPDATED; | |
55 | %constant wxEventType wxEVT_COMMAND_RADIOBOX_SELECTED; | |
56 | %constant wxEventType wxEVT_COMMAND_RADIOBUTTON_SELECTED; | |
57 | ||
58 | %constant wxEventType wxEVT_COMMAND_SCROLLBAR_UPDATED; | |
59 | %constant wxEventType wxEVT_COMMAND_VLBOX_SELECTED; | |
60 | %constant wxEventType wxEVT_COMMAND_COMBOBOX_SELECTED; | |
61 | %constant wxEventType wxEVT_COMMAND_TOOL_RCLICKED; | |
62 | %constant wxEventType wxEVT_COMMAND_TOOL_ENTER; | |
63 | ||
64 | // Mouse event types | |
65 | %constant wxEventType wxEVT_LEFT_DOWN; | |
66 | %constant wxEventType wxEVT_LEFT_UP; | |
67 | %constant wxEventType wxEVT_MIDDLE_DOWN; | |
68 | %constant wxEventType wxEVT_MIDDLE_UP; | |
69 | %constant wxEventType wxEVT_RIGHT_DOWN; | |
70 | %constant wxEventType wxEVT_RIGHT_UP; | |
71 | %constant wxEventType wxEVT_MOTION; | |
72 | %constant wxEventType wxEVT_ENTER_WINDOW; | |
73 | %constant wxEventType wxEVT_LEAVE_WINDOW; | |
74 | %constant wxEventType wxEVT_LEFT_DCLICK; | |
75 | %constant wxEventType wxEVT_MIDDLE_DCLICK; | |
76 | %constant wxEventType wxEVT_RIGHT_DCLICK; | |
77 | %constant wxEventType wxEVT_SET_FOCUS; | |
78 | %constant wxEventType wxEVT_KILL_FOCUS; | |
79 | %constant wxEventType wxEVT_CHILD_FOCUS; | |
80 | %constant wxEventType wxEVT_MOUSEWHEEL; | |
81 | ||
82 | // Non-client mouse events | |
83 | %constant wxEventType wxEVT_NC_LEFT_DOWN; | |
84 | %constant wxEventType wxEVT_NC_LEFT_UP; | |
85 | %constant wxEventType wxEVT_NC_MIDDLE_DOWN; | |
86 | %constant wxEventType wxEVT_NC_MIDDLE_UP; | |
87 | %constant wxEventType wxEVT_NC_RIGHT_DOWN; | |
88 | %constant wxEventType wxEVT_NC_RIGHT_UP; | |
89 | %constant wxEventType wxEVT_NC_MOTION; | |
90 | %constant wxEventType wxEVT_NC_ENTER_WINDOW; | |
91 | %constant wxEventType wxEVT_NC_LEAVE_WINDOW; | |
92 | %constant wxEventType wxEVT_NC_LEFT_DCLICK; | |
93 | %constant wxEventType wxEVT_NC_MIDDLE_DCLICK; | |
94 | %constant wxEventType wxEVT_NC_RIGHT_DCLICK; | |
95 | ||
96 | // Character input event type | |
97 | %constant wxEventType wxEVT_CHAR; | |
98 | %constant wxEventType wxEVT_CHAR_HOOK; | |
99 | %constant wxEventType wxEVT_NAVIGATION_KEY; | |
100 | %constant wxEventType wxEVT_KEY_DOWN; | |
101 | %constant wxEventType wxEVT_KEY_UP; | |
102 | %constant wxEventType wxEVT_HOTKEY; | |
103 | ||
104 | // Set cursor event | |
105 | %constant wxEventType wxEVT_SET_CURSOR; | |
106 | ||
107 | // wxScrollBar and wxSlider event identifiers | |
108 | %constant wxEventType wxEVT_SCROLL_TOP; | |
109 | %constant wxEventType wxEVT_SCROLL_BOTTOM; | |
110 | %constant wxEventType wxEVT_SCROLL_LINEUP; | |
111 | %constant wxEventType wxEVT_SCROLL_LINEDOWN; | |
112 | %constant wxEventType wxEVT_SCROLL_PAGEUP; | |
113 | %constant wxEventType wxEVT_SCROLL_PAGEDOWN; | |
114 | %constant wxEventType wxEVT_SCROLL_THUMBTRACK; | |
115 | %constant wxEventType wxEVT_SCROLL_THUMBRELEASE; | |
116 | %constant wxEventType wxEVT_SCROLL_ENDSCROLL; | |
117 | ||
118 | // Scroll events from wxWindow | |
119 | %constant wxEventType wxEVT_SCROLLWIN_TOP; | |
120 | %constant wxEventType wxEVT_SCROLLWIN_BOTTOM; | |
121 | %constant wxEventType wxEVT_SCROLLWIN_LINEUP; | |
122 | %constant wxEventType wxEVT_SCROLLWIN_LINEDOWN; | |
123 | %constant wxEventType wxEVT_SCROLLWIN_PAGEUP; | |
124 | %constant wxEventType wxEVT_SCROLLWIN_PAGEDOWN; | |
125 | %constant wxEventType wxEVT_SCROLLWIN_THUMBTRACK; | |
126 | %constant wxEventType wxEVT_SCROLLWIN_THUMBRELEASE; | |
127 | ||
128 | // System events | |
129 | %constant wxEventType wxEVT_SIZE; | |
130 | %constant wxEventType wxEVT_MOVE; | |
131 | %constant wxEventType wxEVT_CLOSE_WINDOW; | |
132 | %constant wxEventType wxEVT_END_SESSION; | |
133 | %constant wxEventType wxEVT_QUERY_END_SESSION; | |
134 | %constant wxEventType wxEVT_ACTIVATE_APP; | |
135 | %constant wxEventType wxEVT_POWER; | |
136 | %constant wxEventType wxEVT_ACTIVATE; | |
137 | %constant wxEventType wxEVT_CREATE; | |
138 | %constant wxEventType wxEVT_DESTROY; | |
139 | %constant wxEventType wxEVT_SHOW; | |
140 | %constant wxEventType wxEVT_ICONIZE; | |
141 | %constant wxEventType wxEVT_MAXIMIZE; | |
142 | %constant wxEventType wxEVT_MOUSE_CAPTURE_CHANGED; | |
143 | %constant wxEventType wxEVT_PAINT; | |
144 | %constant wxEventType wxEVT_ERASE_BACKGROUND; | |
145 | %constant wxEventType wxEVT_NC_PAINT; | |
146 | %constant wxEventType wxEVT_PAINT_ICON; | |
147 | %constant wxEventType wxEVT_MENU_OPEN; | |
148 | %constant wxEventType wxEVT_MENU_CLOSE; | |
149 | %constant wxEventType wxEVT_MENU_HIGHLIGHT; | |
150 | ||
151 | %constant wxEventType wxEVT_CONTEXT_MENU; | |
152 | %constant wxEventType wxEVT_SYS_COLOUR_CHANGED; | |
153 | %constant wxEventType wxEVT_DISPLAY_CHANGED; | |
154 | %constant wxEventType wxEVT_SETTING_CHANGED; | |
155 | %constant wxEventType wxEVT_QUERY_NEW_PALETTE; | |
156 | %constant wxEventType wxEVT_PALETTE_CHANGED; | |
157 | %constant wxEventType wxEVT_DROP_FILES; | |
158 | %constant wxEventType wxEVT_DRAW_ITEM; | |
159 | %constant wxEventType wxEVT_MEASURE_ITEM; | |
160 | %constant wxEventType wxEVT_COMPARE_ITEM; | |
161 | %constant wxEventType wxEVT_INIT_DIALOG; | |
162 | %constant wxEventType wxEVT_IDLE; | |
163 | %constant wxEventType wxEVT_UPDATE_UI; | |
164 | %constant wxEventType wxEVT_SIZING; | |
165 | %constant wxEventType wxEVT_MOVING; | |
166 | ||
167 | // Generic command events | |
168 | // Note: a click is a higher-level event than button down/up | |
169 | %constant wxEventType wxEVT_COMMAND_LEFT_CLICK; | |
170 | %constant wxEventType wxEVT_COMMAND_LEFT_DCLICK; | |
171 | %constant wxEventType wxEVT_COMMAND_RIGHT_CLICK; | |
172 | %constant wxEventType wxEVT_COMMAND_RIGHT_DCLICK; | |
173 | %constant wxEventType wxEVT_COMMAND_SET_FOCUS; | |
174 | %constant wxEventType wxEVT_COMMAND_KILL_FOCUS; | |
175 | %constant wxEventType wxEVT_COMMAND_ENTER; | |
176 | ||
177 | ||
178 | ||
179 | %pythoncode { | |
180 | %# | |
181 | %# Create some event binders | |
182 | EVT_SIZE = wx.PyEventBinder( wxEVT_SIZE ) | |
183 | EVT_SIZING = wx.PyEventBinder( wxEVT_SIZING ) | |
184 | EVT_MOVE = wx.PyEventBinder( wxEVT_MOVE ) | |
185 | EVT_MOVING = wx.PyEventBinder( wxEVT_MOVING ) | |
186 | EVT_CLOSE = wx.PyEventBinder( wxEVT_CLOSE_WINDOW ) | |
187 | EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION ) | |
188 | EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION ) | |
189 | EVT_PAINT = wx.PyEventBinder( wxEVT_PAINT ) | |
190 | EVT_NC_PAINT = wx.PyEventBinder( wxEVT_NC_PAINT ) | |
191 | EVT_ERASE_BACKGROUND = wx.PyEventBinder( wxEVT_ERASE_BACKGROUND ) | |
192 | EVT_CHAR = wx.PyEventBinder( wxEVT_CHAR ) | |
193 | EVT_KEY_DOWN = wx.PyEventBinder( wxEVT_KEY_DOWN ) | |
194 | EVT_KEY_UP = wx.PyEventBinder( wxEVT_KEY_UP ) | |
195 | EVT_HOTKEY = wx.PyEventBinder( wxEVT_HOTKEY, 1) | |
196 | EVT_CHAR_HOOK = wx.PyEventBinder( wxEVT_CHAR_HOOK ) | |
197 | EVT_MENU_OPEN = wx.PyEventBinder( wxEVT_MENU_OPEN ) | |
198 | EVT_MENU_CLOSE = wx.PyEventBinder( wxEVT_MENU_CLOSE ) | |
199 | EVT_MENU_HIGHLIGHT = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT, 1) | |
200 | EVT_MENU_HIGHLIGHT_ALL = wx.PyEventBinder( wxEVT_MENU_HIGHLIGHT ) | |
201 | EVT_SET_FOCUS = wx.PyEventBinder( wxEVT_SET_FOCUS ) | |
202 | EVT_KILL_FOCUS = wx.PyEventBinder( wxEVT_KILL_FOCUS ) | |
203 | EVT_CHILD_FOCUS = wx.PyEventBinder( wxEVT_CHILD_FOCUS ) | |
204 | EVT_ACTIVATE = wx.PyEventBinder( wxEVT_ACTIVATE ) | |
205 | EVT_ACTIVATE_APP = wx.PyEventBinder( wxEVT_ACTIVATE_APP ) | |
206 | EVT_END_SESSION = wx.PyEventBinder( wxEVT_END_SESSION ) | |
207 | EVT_QUERY_END_SESSION = wx.PyEventBinder( wxEVT_QUERY_END_SESSION ) | |
208 | EVT_DROP_FILES = wx.PyEventBinder( wxEVT_DROP_FILES ) | |
209 | EVT_INIT_DIALOG = wx.PyEventBinder( wxEVT_INIT_DIALOG ) | |
210 | EVT_SYS_COLOUR_CHANGED = wx.PyEventBinder( wxEVT_SYS_COLOUR_CHANGED ) | |
211 | EVT_DISPLAY_CHANGED = wx.PyEventBinder( wxEVT_DISPLAY_CHANGED ) | |
212 | EVT_SHOW = wx.PyEventBinder( wxEVT_SHOW ) | |
213 | EVT_MAXIMIZE = wx.PyEventBinder( wxEVT_MAXIMIZE ) | |
214 | EVT_ICONIZE = wx.PyEventBinder( wxEVT_ICONIZE ) | |
215 | EVT_NAVIGATION_KEY = wx.PyEventBinder( wxEVT_NAVIGATION_KEY ) | |
216 | EVT_PALETTE_CHANGED = wx.PyEventBinder( wxEVT_PALETTE_CHANGED ) | |
217 | EVT_QUERY_NEW_PALETTE = wx.PyEventBinder( wxEVT_QUERY_NEW_PALETTE ) | |
218 | EVT_WINDOW_CREATE = wx.PyEventBinder( wxEVT_CREATE ) | |
219 | EVT_WINDOW_DESTROY = wx.PyEventBinder( wxEVT_DESTROY ) | |
220 | EVT_SET_CURSOR = wx.PyEventBinder( wxEVT_SET_CURSOR ) | |
221 | EVT_MOUSE_CAPTURE_CHANGED = wx.PyEventBinder( wxEVT_MOUSE_CAPTURE_CHANGED ) | |
222 | ||
223 | EVT_LEFT_DOWN = wx.PyEventBinder( wxEVT_LEFT_DOWN ) | |
224 | EVT_LEFT_UP = wx.PyEventBinder( wxEVT_LEFT_UP ) | |
225 | EVT_MIDDLE_DOWN = wx.PyEventBinder( wxEVT_MIDDLE_DOWN ) | |
226 | EVT_MIDDLE_UP = wx.PyEventBinder( wxEVT_MIDDLE_UP ) | |
227 | EVT_RIGHT_DOWN = wx.PyEventBinder( wxEVT_RIGHT_DOWN ) | |
228 | EVT_RIGHT_UP = wx.PyEventBinder( wxEVT_RIGHT_UP ) | |
229 | EVT_MOTION = wx.PyEventBinder( wxEVT_MOTION ) | |
230 | EVT_LEFT_DCLICK = wx.PyEventBinder( wxEVT_LEFT_DCLICK ) | |
231 | EVT_MIDDLE_DCLICK = wx.PyEventBinder( wxEVT_MIDDLE_DCLICK ) | |
232 | EVT_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_RIGHT_DCLICK ) | |
233 | EVT_LEAVE_WINDOW = wx.PyEventBinder( wxEVT_LEAVE_WINDOW ) | |
234 | EVT_ENTER_WINDOW = wx.PyEventBinder( wxEVT_ENTER_WINDOW ) | |
235 | EVT_MOUSEWHEEL = wx.PyEventBinder( wxEVT_MOUSEWHEEL ) | |
236 | ||
237 | EVT_MOUSE_EVENTS = wx.PyEventBinder([ wxEVT_LEFT_DOWN, | |
238 | wxEVT_LEFT_UP, | |
239 | wxEVT_MIDDLE_DOWN, | |
240 | wxEVT_MIDDLE_UP, | |
241 | wxEVT_RIGHT_DOWN, | |
242 | wxEVT_RIGHT_UP, | |
243 | wxEVT_MOTION, | |
244 | wxEVT_LEFT_DCLICK, | |
245 | wxEVT_MIDDLE_DCLICK, | |
246 | wxEVT_RIGHT_DCLICK, | |
247 | wxEVT_ENTER_WINDOW, | |
248 | wxEVT_LEAVE_WINDOW, | |
249 | wxEVT_MOUSEWHEEL | |
250 | ]) | |
251 | ||
252 | ||
253 | %# Scrolling from wxWindow (sent to wxScrolledWindow) | |
254 | EVT_SCROLLWIN = wx.PyEventBinder([ wxEVT_SCROLLWIN_TOP, | |
255 | wxEVT_SCROLLWIN_BOTTOM, | |
256 | wxEVT_SCROLLWIN_LINEUP, | |
257 | wxEVT_SCROLLWIN_LINEDOWN, | |
258 | wxEVT_SCROLLWIN_PAGEUP, | |
259 | wxEVT_SCROLLWIN_PAGEDOWN, | |
260 | wxEVT_SCROLLWIN_THUMBTRACK, | |
261 | wxEVT_SCROLLWIN_THUMBRELEASE, | |
262 | ]) | |
263 | ||
264 | EVT_SCROLLWIN_TOP = wx.PyEventBinder( wxEVT_SCROLLWIN_TOP ) | |
265 | EVT_SCROLLWIN_BOTTOM = wx.PyEventBinder( wxEVT_SCROLLWIN_BOTTOM ) | |
266 | EVT_SCROLLWIN_LINEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEUP ) | |
267 | EVT_SCROLLWIN_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_LINEDOWN ) | |
268 | EVT_SCROLLWIN_PAGEUP = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEUP ) | |
269 | EVT_SCROLLWIN_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLLWIN_PAGEDOWN ) | |
270 | EVT_SCROLLWIN_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBTRACK ) | |
271 | EVT_SCROLLWIN_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLLWIN_THUMBRELEASE ) | |
272 | ||
273 | %# Scrolling from wxSlider and wxScrollBar | |
274 | EVT_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP, | |
275 | wxEVT_SCROLL_BOTTOM, | |
276 | wxEVT_SCROLL_LINEUP, | |
277 | wxEVT_SCROLL_LINEDOWN, | |
278 | wxEVT_SCROLL_PAGEUP, | |
279 | wxEVT_SCROLL_PAGEDOWN, | |
280 | wxEVT_SCROLL_THUMBTRACK, | |
281 | wxEVT_SCROLL_THUMBRELEASE, | |
282 | wxEVT_SCROLL_ENDSCROLL, | |
283 | ]) | |
284 | ||
285 | EVT_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP ) | |
286 | EVT_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM ) | |
287 | EVT_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP ) | |
288 | EVT_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN ) | |
289 | EVT_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP ) | |
290 | EVT_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN ) | |
291 | EVT_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK ) | |
292 | EVT_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE ) | |
293 | EVT_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL ) | |
294 | ||
295 | %# Scrolling from wxSlider and wxScrollBar, with an id | |
296 | EVT_COMMAND_SCROLL = wx.PyEventBinder([ wxEVT_SCROLL_TOP, | |
297 | wxEVT_SCROLL_BOTTOM, | |
298 | wxEVT_SCROLL_LINEUP, | |
299 | wxEVT_SCROLL_LINEDOWN, | |
300 | wxEVT_SCROLL_PAGEUP, | |
301 | wxEVT_SCROLL_PAGEDOWN, | |
302 | wxEVT_SCROLL_THUMBTRACK, | |
303 | wxEVT_SCROLL_THUMBRELEASE, | |
304 | wxEVT_SCROLL_ENDSCROLL, | |
305 | ], 1) | |
306 | ||
307 | EVT_COMMAND_SCROLL_TOP = wx.PyEventBinder( wxEVT_SCROLL_TOP, 1) | |
308 | EVT_COMMAND_SCROLL_BOTTOM = wx.PyEventBinder( wxEVT_SCROLL_BOTTOM, 1) | |
309 | EVT_COMMAND_SCROLL_LINEUP = wx.PyEventBinder( wxEVT_SCROLL_LINEUP, 1) | |
310 | EVT_COMMAND_SCROLL_LINEDOWN = wx.PyEventBinder( wxEVT_SCROLL_LINEDOWN, 1) | |
311 | EVT_COMMAND_SCROLL_PAGEUP = wx.PyEventBinder( wxEVT_SCROLL_PAGEUP, 1) | |
312 | EVT_COMMAND_SCROLL_PAGEDOWN = wx.PyEventBinder( wxEVT_SCROLL_PAGEDOWN, 1) | |
313 | EVT_COMMAND_SCROLL_THUMBTRACK = wx.PyEventBinder( wxEVT_SCROLL_THUMBTRACK, 1) | |
314 | EVT_COMMAND_SCROLL_THUMBRELEASE = wx.PyEventBinder( wxEVT_SCROLL_THUMBRELEASE, 1) | |
315 | EVT_COMMAND_SCROLL_ENDSCROLL = wx.PyEventBinder( wxEVT_SCROLL_ENDSCROLL, 1) | |
316 | ||
d14a1e28 RD |
317 | EVT_BUTTON = wx.PyEventBinder( wxEVT_COMMAND_BUTTON_CLICKED, 1) |
318 | EVT_CHECKBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKBOX_CLICKED, 1) | |
319 | EVT_CHOICE = wx.PyEventBinder( wxEVT_COMMAND_CHOICE_SELECTED, 1) | |
320 | EVT_LISTBOX = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_SELECTED, 1) | |
321 | EVT_LISTBOX_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, 1) | |
322 | EVT_MENU = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 1) | |
323 | EVT_MENU_RANGE = wx.PyEventBinder( wxEVT_COMMAND_MENU_SELECTED, 2) | |
324 | EVT_SLIDER = wx.PyEventBinder( wxEVT_COMMAND_SLIDER_UPDATED, 1) | |
325 | EVT_RADIOBOX = wx.PyEventBinder( wxEVT_COMMAND_RADIOBOX_SELECTED, 1) | |
326 | EVT_RADIOBUTTON = wx.PyEventBinder( wxEVT_COMMAND_RADIOBUTTON_SELECTED, 1) | |
327 | ||
328 | EVT_SCROLLBAR = wx.PyEventBinder( wxEVT_COMMAND_SCROLLBAR_UPDATED, 1) | |
329 | EVT_VLBOX = wx.PyEventBinder( wxEVT_COMMAND_VLBOX_SELECTED, 1) | |
330 | EVT_COMBOBOX = wx.PyEventBinder( wxEVT_COMMAND_COMBOBOX_SELECTED, 1) | |
331 | EVT_TOOL = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 1) | |
332 | EVT_TOOL_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_CLICKED, 2) | |
333 | EVT_TOOL_RCLICKED = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 1) | |
334 | EVT_TOOL_RCLICKED_RANGE = wx.PyEventBinder( wxEVT_COMMAND_TOOL_RCLICKED, 2) | |
335 | EVT_TOOL_ENTER = wx.PyEventBinder( wxEVT_COMMAND_TOOL_ENTER, 1) | |
336 | EVT_CHECKLISTBOX = wx.PyEventBinder( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, 1) | |
337 | ||
338 | ||
339 | EVT_COMMAND_LEFT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_CLICK, 1) | |
340 | EVT_COMMAND_LEFT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_LEFT_DCLICK, 1) | |
341 | EVT_COMMAND_RIGHT_CLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_CLICK, 1) | |
342 | EVT_COMMAND_RIGHT_DCLICK = wx.PyEventBinder( wxEVT_COMMAND_RIGHT_DCLICK, 1) | |
343 | EVT_COMMAND_SET_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_SET_FOCUS, 1) | |
344 | EVT_COMMAND_KILL_FOCUS = wx.PyEventBinder( wxEVT_COMMAND_KILL_FOCUS, 1) | |
345 | EVT_COMMAND_ENTER = wx.PyEventBinder( wxEVT_COMMAND_ENTER, 1) | |
346 | ||
347 | EVT_IDLE = wx.PyEventBinder( wxEVT_IDLE ) | |
348 | ||
349 | EVT_UPDATE_UI = wx.PyEventBinder( wxEVT_UPDATE_UI, 1) | |
350 | EVT_UPDATE_UI_RANGE = wx.PyEventBinder( wxEVT_UPDATE_UI, 2) | |
351 | ||
352 | EVT_CONTEXT_MENU = wx.PyEventBinder( wxEVT_CONTEXT_MENU ) | |
353 | ||
354 | ||
355 | } | |
356 | ||
357 | //--------------------------------------------------------------------------- | |
358 | %newgroup; | |
359 | ||
360 | class wxEvent : public wxObject { | |
361 | public: | |
362 | // wxEvent(int winid = 0, wxEventType commandType = wxEVT_NULL); // *** This class is now an ABC | |
363 | ~wxEvent(); | |
364 | ||
365 | void SetEventType(wxEventType typ); | |
366 | wxEventType GetEventType() const; | |
367 | wxObject *GetEventObject() const; | |
368 | void SetEventObject(wxObject *obj); | |
369 | long GetTimestamp() const; | |
370 | void SetTimestamp(long ts = 0); | |
371 | int GetId() const; | |
372 | void SetId(int Id); | |
373 | ||
374 | ||
375 | bool IsCommandEvent() const; | |
376 | ||
377 | // Can instruct event processor that we wish to ignore this event | |
378 | // (treat as if the event table entry had not been found): this must be done | |
379 | // to allow the event processing by the base classes (calling event.Skip() | |
380 | // is the analog of calling the base class verstion of a virtual function) | |
dd9f7fea | 381 | void Skip(bool skip = True); |
d14a1e28 RD |
382 | bool GetSkipped() const; |
383 | ||
384 | // Determine if this event should be propagating to the parent window. | |
385 | bool ShouldPropagate() const; | |
386 | ||
387 | // Stop an event from propagating to its parent window, returns the old | |
388 | // propagation level value | |
389 | int StopPropagation(); | |
390 | ||
391 | // Resume the event propagation by restoring the propagation level | |
392 | // (returned by StopPropagation()) | |
393 | void ResumePropagation(int propagationLevel); | |
394 | ||
395 | // this function is used to create a copy of the event polymorphically and | |
396 | // all derived classes must implement it because otherwise wxPostEvent() | |
397 | // for them wouldn't work (it needs to do a copy of the event) | |
398 | virtual wxEvent *Clone() /* =0*/; | |
399 | }; | |
400 | ||
401 | ||
402 | //--------------------------------------------------------------------------- | |
403 | %newgroup; | |
404 | ||
405 | // Helper class to temporarily change an event not to propagate. | |
406 | class wxPropagationDisabler | |
407 | { | |
408 | public: | |
409 | wxPropagationDisabler(wxEvent& event); | |
410 | ~wxPropagationDisabler(); | |
411 | }; | |
412 | ||
413 | ||
414 | // Another one to temporarily lower propagation level. | |
415 | class wxPropagateOnce | |
416 | { | |
417 | public: | |
418 | wxPropagateOnce(wxEvent& event); | |
419 | ~wxPropagateOnce(); | |
420 | }; | |
421 | ||
422 | //--------------------------------------------------------------------------- | |
423 | %newgroup; | |
424 | ||
425 | class wxCommandEvent : public wxEvent | |
426 | { | |
427 | public: | |
428 | wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); | |
429 | ||
430 | ||
431 | // // Set/Get client data from controls | |
432 | // void SetClientData(void* clientData) { m_clientData = clientData; } | |
433 | // void *GetClientData() const { return m_clientData; } | |
434 | ||
435 | // // Set/Get client object from controls | |
436 | // void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; } | |
437 | // void *GetClientObject() const { return m_clientObject; } | |
438 | ||
439 | ||
440 | // Get listbox selection if single-choice | |
441 | int GetSelection() const; | |
442 | ||
443 | // Set/Get listbox/choice selection string | |
444 | void SetString(const wxString& s); | |
445 | wxString GetString() const; | |
446 | ||
447 | // Get checkbox value | |
448 | bool IsChecked() const; | |
61c5a8ac RD |
449 | %pythoncode { Checked = IsChecked } |
450 | ||
dd9f7fea | 451 | // True if the listbox event was a selection. |
d14a1e28 RD |
452 | bool IsSelection() const; |
453 | ||
454 | void SetExtraLong(long extraLong); | |
455 | long GetExtraLong() const; | |
456 | ||
457 | void SetInt(int i); | |
458 | long GetInt() const; | |
459 | ||
460 | virtual wxEvent *Clone() const; | |
461 | ||
462 | }; | |
463 | ||
464 | //--------------------------------------------------------------------------- | |
465 | %newgroup; | |
466 | ||
467 | // this class adds a possibility to react (from the user) code to a control | |
468 | // notification: allow or veto the operation being reported. | |
469 | class wxNotifyEvent : public wxCommandEvent | |
470 | { | |
471 | public: | |
472 | wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); | |
473 | ||
474 | // veto the operation (usually it's allowed by default) | |
475 | void Veto(); | |
476 | ||
477 | // allow the operation if it was disabled by default | |
478 | void Allow(); | |
479 | ||
480 | // for implementation code only: is the operation allowed? | |
481 | bool IsAllowed(); | |
482 | }; | |
483 | ||
484 | ||
485 | //--------------------------------------------------------------------------- | |
486 | %newgroup; | |
487 | ||
488 | // Scroll event class, derived form wxCommandEvent. wxScrollEvents are | |
489 | // sent by wxSlider and wxScrollBar. | |
490 | class wxScrollEvent : public wxCommandEvent | |
491 | { | |
492 | public: | |
493 | wxScrollEvent(wxEventType commandType = wxEVT_NULL, | |
494 | int winid = 0, int pos = 0, int orient = 0); | |
495 | ||
496 | int GetOrientation() const; | |
497 | int GetPosition() const; | |
498 | void SetOrientation(int orient); | |
499 | void SetPosition(int pos); | |
500 | }; | |
501 | ||
502 | ||
503 | //--------------------------------------------------------------------------- | |
504 | %newgroup; | |
505 | ||
506 | // ScrollWin event class, derived fom wxEvent. wxScrollWinEvents | |
507 | // are sent by wxWindow. | |
508 | class wxScrollWinEvent : public wxEvent | |
509 | { | |
510 | public: | |
511 | wxScrollWinEvent(wxEventType commandType = wxEVT_NULL, | |
512 | int pos = 0, int orient = 0); | |
513 | ||
514 | int GetOrientation() const; | |
515 | int GetPosition() const; | |
516 | void SetOrientation(int orient); | |
517 | void SetPosition(int pos); | |
518 | }; | |
519 | ||
520 | //--------------------------------------------------------------------------- | |
521 | %newgroup; | |
522 | ||
523 | // the symbolic names for the mouse buttons | |
524 | enum | |
525 | { | |
526 | wxMOUSE_BTN_ANY = -1, | |
527 | wxMOUSE_BTN_NONE = -1, | |
528 | wxMOUSE_BTN_LEFT = 0, | |
529 | wxMOUSE_BTN_MIDDLE = 1, | |
530 | wxMOUSE_BTN_RIGHT = 2 | |
531 | }; | |
532 | ||
533 | ||
534 | // Mouse event class | |
535 | class wxMouseEvent : public wxEvent | |
536 | { | |
537 | public: | |
538 | wxMouseEvent(wxEventType mouseType = wxEVT_NULL); | |
539 | ||
540 | // Was it a button event? (*doesn't* mean: is any button *down*?) | |
541 | bool IsButton() const; | |
542 | ||
543 | // Was it a down event from this (or any) button? | |
544 | bool ButtonDown(int but = wxMOUSE_BTN_ANY) const; | |
545 | ||
546 | // Was it a dclick event from this (or any) button? | |
547 | bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const; | |
548 | ||
549 | // Was it a up event from this (or any) button? | |
550 | bool ButtonUp(int but = wxMOUSE_BTN_ANY) const; | |
551 | ||
552 | // Was the given button changing state? | |
553 | bool Button(int but) const; | |
554 | ||
555 | // Was the given button in Down state? | |
556 | bool ButtonIsDown(int but) const; | |
557 | ||
558 | // Get the button which is changing state (wxMOUSE_BTN_NONE if none) | |
559 | int GetButton() const; | |
560 | ||
561 | // Find state of shift/control keys | |
562 | bool ControlDown() const; | |
563 | bool MetaDown() const; | |
564 | bool AltDown() const; | |
565 | bool ShiftDown() const; | |
566 | ||
ba3e5ef2 RD |
567 | DocDeclStr( |
568 | bool , CmdDown() const, | |
569 | "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix | |
570 | platforms but the special \"Apple\" (a.k.a as \"Command\") key on | |
571 | Macs: it makes often sense to use it instead of, say, `ControlDown` | |
572 | because Cmd key is used for the same thing under Mac as Ctrl | |
573 | elsewhere. The Ctrl still exists, it's just not used for this | |
574 | purpose. So for non-Mac platforms this is the same as `ControlDown` | |
575 | and Macs this is the same as `MetaDown`.", ""); | |
576 | ||
d14a1e28 RD |
577 | // Find which event was just generated |
578 | bool LeftDown() const; | |
579 | bool MiddleDown() const; | |
580 | bool RightDown() const; | |
581 | ||
582 | bool LeftUp() const; | |
583 | bool MiddleUp() const; | |
584 | bool RightUp() const; | |
585 | ||
586 | bool LeftDClick() const; | |
587 | bool MiddleDClick() const; | |
588 | bool RightDClick() const; | |
589 | ||
590 | // Find the current state of the mouse buttons (regardless | |
591 | // of current event type) | |
592 | bool LeftIsDown(); | |
593 | bool MiddleIsDown(); | |
594 | bool RightIsDown(); | |
595 | ||
596 | // True if a button is down and the mouse is moving | |
597 | bool Dragging() const; | |
598 | ||
599 | // True if the mouse is moving, and no button is down | |
600 | bool Moving() const; | |
601 | ||
602 | // True if the mouse is just entering the window | |
603 | bool Entering() const; | |
604 | ||
605 | // True if the mouse is just leaving the window | |
606 | bool Leaving() const; | |
607 | ||
dd9f7fea RD |
608 | |
609 | DocStr(GetPosition, // sets the docstring for both | |
d07d2bc9 RD |
610 | "Returns the position of the mouse in window coordinates when the event |
611 | happened.", ""); | |
d14a1e28 | 612 | wxPoint GetPosition(); |
d14a1e28 | 613 | |
dd9f7fea RD |
614 | DocDeclAName( |
615 | void, GetPosition(long *OUTPUT, long *OUTPUT), | |
616 | "GetPositionTuple() -> (x,y)", | |
617 | GetPositionTuple); | |
618 | ||
d14a1e28 RD |
619 | // Find the logical position of the event given the DC |
620 | wxPoint GetLogicalPosition(const wxDC& dc) const; | |
621 | ||
622 | // Get X position | |
623 | wxCoord GetX() const; | |
624 | ||
625 | // Get Y position | |
626 | wxCoord GetY() const; | |
627 | ||
628 | // Get wheel rotation, positive or negative indicates direction of | |
629 | // rotation. Current devices all send an event when rotation is equal to | |
630 | // +/-WheelDelta, but this allows for finer resolution devices to be | |
631 | // created in the future. Because of this you shouldn't assume that one | |
632 | // event is equal to 1 line or whatever, but you should be able to either | |
633 | // do partial line scrolling or wait until +/-WheelDelta rotation values | |
634 | // have been accumulated before scrolling. | |
635 | int GetWheelRotation() const; | |
636 | ||
637 | // Get wheel delta, normally 120. This is the threshold for action to be | |
638 | // taken, and one such action (for example, scrolling one increment) | |
639 | // should occur for each delta. | |
640 | int GetWheelDelta() const; | |
641 | ||
642 | // Returns the configured number of lines (or whatever) to be scrolled per | |
643 | // wheel action. Defaults to one. | |
644 | int GetLinesPerAction() const; | |
645 | ||
646 | // Is the system set to do page scrolling? | |
647 | bool IsPageScroll() const; | |
648 | ||
649 | public: | |
650 | wxCoord m_x, m_y; | |
651 | ||
652 | bool m_leftDown; | |
653 | bool m_middleDown; | |
654 | bool m_rightDown; | |
655 | ||
656 | bool m_controlDown; | |
657 | bool m_shiftDown; | |
658 | bool m_altDown; | |
659 | bool m_metaDown; | |
660 | ||
661 | int m_wheelRotation; | |
662 | int m_wheelDelta; | |
663 | int m_linesPerAction; | |
664 | }; | |
665 | ||
666 | //--------------------------------------------------------------------------- | |
667 | %newgroup; | |
668 | ||
669 | // Cursor set event | |
670 | class wxSetCursorEvent : public wxEvent | |
671 | { | |
672 | public: | |
673 | wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0); | |
674 | ||
675 | wxCoord GetX() const; | |
676 | wxCoord GetY() const; | |
677 | ||
678 | void SetCursor(const wxCursor& cursor); | |
679 | const wxCursor& GetCursor() const; | |
680 | bool HasCursor() const; | |
681 | }; | |
682 | ||
683 | //--------------------------------------------------------------------------- | |
684 | %newgroup; | |
685 | ||
686 | // Keyboard input event class | |
687 | ||
688 | class wxKeyEvent : public wxEvent | |
689 | { | |
690 | public: | |
691 | wxKeyEvent(wxEventType keyType = wxEVT_NULL); | |
692 | ||
693 | // Find state of shift/control keys | |
694 | bool ControlDown() const; | |
695 | bool MetaDown() const; | |
696 | bool AltDown() const; | |
697 | bool ShiftDown() const; | |
ba3e5ef2 RD |
698 | |
699 | DocDeclStr( | |
700 | bool , CmdDown() const, | |
701 | "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix | |
702 | platforms but the special \"Apple\" (a.k.a as \"Command\") key on | |
703 | Macs: it makes often sense to use it instead of, say, `ControlDown` | |
704 | because Cmd key is used for the same thing under Mac as Ctrl | |
705 | elsewhere. The Ctrl still exists, it's just not used for this | |
706 | purpose. So for non-Mac platforms this is the same as `ControlDown` | |
707 | and Macs this is the same as `MetaDown`.", ""); | |
708 | ||
709 | ||
d14a1e28 RD |
710 | |
711 | // exclude MetaDown() from HasModifiers() because NumLock under X is often | |
712 | // configured as mod2 modifier, yet the key events even when it is pressed | |
713 | // should be processed normally, not like Ctrl- or Alt-key | |
714 | bool HasModifiers() const; | |
715 | ||
716 | // get the key code: an ASCII7 char or an element of wxKeyCode enum | |
717 | int GetKeyCode() const; | |
718 | %pythoncode { KeyCode = GetKeyCode } | |
719 | ||
720 | %extend { | |
ba87052f | 721 | int GetUnicodeKey() { |
3b7224dc | 722 | %#if wxUSE_UNICODE |
ba87052f | 723 | return self->GetUnicodeKey(); |
3b7224dc | 724 | %#else |
d14a1e28 | 725 | return 0; |
3b7224dc | 726 | %#endif |
d14a1e28 RD |
727 | } |
728 | } | |
ba87052f RD |
729 | %pythoncode { GetUniChar = GetUnicodeKey } |
730 | ||
d14a1e28 RD |
731 | |
732 | // get the raw key code (platform-dependent) | |
733 | wxUint32 GetRawKeyCode() const; | |
734 | ||
735 | // get the raw key flags (platform-dependent) | |
736 | wxUint32 GetRawKeyFlags() const; | |
737 | ||
dd9f7fea RD |
738 | |
739 | DocStr(GetPosition, // sets the docstring for both | |
d07d2bc9 | 740 | "Find the position of the event.", ""); |
d14a1e28 | 741 | wxPoint GetPosition(); |
dd9f7fea RD |
742 | |
743 | DocDeclAName( | |
744 | void, GetPosition(long *OUTPUT, long *OUTPUT), | |
745 | "GetPositionTuple() -> (x,y)", | |
746 | GetPositionTuple); | |
d14a1e28 RD |
747 | |
748 | // Get X position | |
749 | wxCoord GetX() const; | |
750 | ||
751 | // Get Y position | |
752 | wxCoord GetY() const; | |
753 | ||
754 | public: | |
755 | wxCoord m_x, m_y; | |
756 | ||
757 | long m_keyCode; | |
758 | ||
759 | bool m_controlDown; | |
760 | bool m_shiftDown; | |
761 | bool m_altDown; | |
762 | bool m_metaDown; | |
763 | bool m_scanCode; | |
764 | ||
765 | // these fields contain the platform-specific information about | |
766 | // key that was pressed | |
767 | wxUint32 m_rawCode; | |
768 | wxUint32 m_rawFlags; | |
769 | }; | |
770 | ||
771 | //--------------------------------------------------------------------------- | |
772 | %newgroup; | |
773 | ||
774 | // Size event class | |
775 | class wxSizeEvent : public wxEvent | |
776 | { | |
777 | public: | |
778 | wxSizeEvent(const wxSize& sz=wxDefaultSize, int winid = 0); | |
779 | ||
780 | wxSize GetSize() const; | |
781 | wxRect GetRect() const; | |
782 | void SetRect(wxRect rect); | |
783 | %extend { | |
784 | void SetSize(wxSize size) { | |
785 | self->m_size = size; | |
786 | } | |
787 | } | |
788 | ||
789 | public: | |
790 | wxSize m_size; | |
791 | wxRect m_rect; // Used for wxEVT_SIZING | |
792 | }; | |
793 | ||
794 | ||
795 | //--------------------------------------------------------------------------- | |
796 | %newgroup; | |
797 | ||
798 | // Move event class | |
799 | class wxMoveEvent : public wxEvent | |
800 | { | |
801 | public: | |
802 | wxMoveEvent(const wxPoint& pos=wxDefaultPosition, int winid = 0); | |
803 | ||
804 | wxPoint GetPosition() const; | |
805 | wxRect GetRect() const; | |
806 | void SetRect(wxRect rect); | |
807 | %extend { | |
808 | void SetPosition(wxPoint pos) { | |
809 | self->m_pos = pos; | |
810 | } | |
811 | } | |
812 | ||
813 | wxPoint m_pos; | |
814 | wxRect m_rect; | |
815 | }; | |
816 | ||
817 | //--------------------------------------------------------------------------- | |
818 | %newgroup; | |
819 | ||
820 | // Paint event class | |
821 | class wxPaintEvent : public wxEvent | |
822 | { | |
823 | public: | |
824 | wxPaintEvent(int Id = 0); | |
825 | }; | |
826 | ||
827 | ||
828 | class wxNcPaintEvent : public wxEvent | |
829 | { | |
830 | public: | |
831 | wxNcPaintEvent(int winid = 0); | |
832 | }; | |
833 | ||
834 | //--------------------------------------------------------------------------- | |
835 | %newgroup; | |
836 | ||
837 | class wxEraseEvent : public wxEvent | |
838 | { | |
839 | public: | |
840 | wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL); | |
841 | ||
842 | wxDC *GetDC() const; | |
843 | }; | |
844 | ||
845 | ||
846 | //--------------------------------------------------------------------------- | |
847 | %newgroup; | |
848 | ||
849 | class wxFocusEvent : public wxEvent | |
850 | { | |
851 | public: | |
852 | wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0); | |
853 | ||
854 | // The window associated with this event is the window which had focus | |
855 | // before for SET event and the window which will have focus for the KILL | |
856 | // one. NB: it may be NULL in both cases! | |
857 | wxWindow *GetWindow() const; | |
858 | void SetWindow(wxWindow *win); | |
859 | }; | |
860 | ||
861 | //--------------------------------------------------------------------------- | |
862 | %newgroup; | |
863 | ||
864 | // wxChildFocusEvent notifies the parent that a child has got the focus: unlike | |
865 | // wxFocusEvent it is propagated upwards the window chain | |
866 | class wxChildFocusEvent : public wxCommandEvent | |
867 | { | |
868 | public: | |
869 | wxChildFocusEvent(wxWindow *win = NULL); | |
870 | ||
871 | wxWindow *GetWindow() const; | |
872 | }; | |
873 | ||
874 | //--------------------------------------------------------------------------- | |
875 | %newgroup; | |
876 | ||
877 | class wxActivateEvent : public wxEvent | |
878 | { | |
879 | public: | |
dd9f7fea | 880 | wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = True, int Id = 0); |
d14a1e28 RD |
881 | bool GetActive() const; |
882 | }; | |
883 | ||
884 | ||
885 | //--------------------------------------------------------------------------- | |
886 | %newgroup; | |
887 | ||
888 | class wxInitDialogEvent : public wxEvent | |
889 | { | |
890 | public: | |
891 | wxInitDialogEvent(int Id = 0); | |
892 | }; | |
893 | ||
894 | ||
895 | //--------------------------------------------------------------------------- | |
896 | %newgroup; | |
897 | ||
898 | class wxMenuEvent : public wxEvent | |
899 | { | |
900 | public: | |
901 | wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL); | |
902 | ||
903 | // only for wxEVT_MENU_HIGHLIGHT | |
904 | int GetMenuId() const; | |
905 | ||
906 | // only for wxEVT_MENU_OPEN/CLOSE | |
907 | bool IsPopup() const; | |
908 | ||
909 | // only for wxEVT_MENU_OPEN/CLOSE | |
910 | wxMenu* GetMenu() const; | |
911 | }; | |
912 | ||
913 | //--------------------------------------------------------------------------- | |
914 | %newgroup; | |
915 | ||
916 | // Window close or session close event class | |
917 | class wxCloseEvent : public wxEvent | |
918 | { | |
919 | public: | |
920 | wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0); | |
921 | ||
922 | void SetLoggingOff(bool logOff); | |
923 | bool GetLoggingOff() const; | |
924 | ||
dd9f7fea | 925 | void Veto(bool veto = True); |
d14a1e28 RD |
926 | void SetCanVeto(bool canVeto); |
927 | ||
928 | bool CanVeto() const; | |
929 | bool GetVeto() const; | |
930 | }; | |
931 | ||
932 | ||
933 | //--------------------------------------------------------------------------- | |
934 | %newgroup; | |
935 | ||
936 | class wxShowEvent : public wxEvent | |
937 | { | |
938 | public: | |
dd9f7fea | 939 | wxShowEvent(int winid = 0, bool show = False); |
d14a1e28 RD |
940 | |
941 | void SetShow(bool show); | |
942 | bool GetShow() const; | |
943 | ||
944 | }; | |
945 | ||
946 | ||
947 | //--------------------------------------------------------------------------- | |
948 | %newgroup; | |
949 | ||
950 | class wxIconizeEvent: public wxEvent | |
951 | { | |
952 | public: | |
dd9f7fea | 953 | wxIconizeEvent(int id = 0, bool iconized = True); |
d14a1e28 RD |
954 | bool Iconized(); |
955 | }; | |
956 | ||
957 | ||
958 | //--------------------------------------------------------------------------- | |
959 | %newgroup; | |
960 | ||
961 | class wxMaximizeEvent: public wxEvent | |
962 | { | |
963 | public: | |
964 | wxMaximizeEvent(int id = 0); | |
965 | }; | |
966 | ||
967 | //--------------------------------------------------------------------------- | |
968 | %newgroup; | |
969 | ||
970 | class wxDropFilesEvent: public wxEvent | |
971 | { | |
972 | public: | |
973 | wxPoint GetPosition(); | |
974 | int GetNumberOfFiles(); | |
975 | ||
976 | %extend { | |
977 | PyObject* GetFiles() { | |
978 | int count = self->GetNumberOfFiles(); | |
979 | wxString* files = self->GetFiles(); | |
980 | PyObject* list = PyList_New(count); | |
981 | ||
982 | if (!list) { | |
983 | PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!"); | |
984 | return NULL; | |
985 | } | |
986 | ||
987 | for (int i=0; i<count; i++) { | |
1fc9204a | 988 | PyList_SetItem(list, i, wx2PyString(files[i])); |
d14a1e28 RD |
989 | } |
990 | return list; | |
991 | } | |
992 | } | |
993 | }; | |
994 | ||
995 | ||
996 | ||
997 | //--------------------------------------------------------------------------- | |
998 | %newgroup; | |
999 | ||
1000 | ||
1001 | // Whether to always send update events to windows, or | |
1002 | // to only send update events to those with the | |
1003 | // wxWS_EX_PROCESS_UI_UPDATES style. | |
1004 | ||
1005 | enum wxUpdateUIMode | |
1006 | { | |
1007 | // Send UI update events to all windows | |
1008 | wxUPDATE_UI_PROCESS_ALL, | |
1009 | ||
1010 | // Send UI update events to windows that have | |
1011 | // the wxWS_EX_PROCESS_UI_UPDATES flag specified | |
1012 | wxUPDATE_UI_PROCESS_SPECIFIED | |
1013 | }; | |
1014 | ||
64e8a1f0 RD |
1015 | |
1016 | ||
d14a1e28 RD |
1017 | class wxUpdateUIEvent : public wxCommandEvent |
1018 | { | |
1019 | public: | |
1020 | wxUpdateUIEvent(wxWindowID commandId = 0); | |
1021 | ||
1022 | bool GetChecked() const; | |
1023 | bool GetEnabled() const; | |
1024 | wxString GetText() const; | |
1025 | bool GetSetText() const; | |
1026 | bool GetSetChecked() const; | |
1027 | bool GetSetEnabled() const; | |
1028 | ||
1029 | void Check(bool check); | |
1030 | void Enable(bool enable); | |
1031 | void SetText(const wxString& text); | |
1032 | ||
1033 | // Sets the interval between updates in milliseconds. | |
1034 | // Set to -1 to disable updates, or to 0 to update as frequently as possible. | |
1035 | static void SetUpdateInterval(long updateInterval); | |
1036 | ||
1037 | // Returns the current interval between updates in milliseconds | |
1038 | static long GetUpdateInterval(); | |
1039 | ||
1040 | // Can we update this window? | |
1041 | static bool CanUpdate(wxWindow *win); | |
1042 | ||
1043 | // Reset the update time to provide a delay until the next | |
1044 | // time we should update | |
1045 | static void ResetUpdateTime(); | |
1046 | ||
1047 | // Specify how wxWindows will send update events: to | |
1048 | // all windows, or only to those which specify that they | |
1049 | // will process the events. | |
1050 | static void SetMode(wxUpdateUIMode mode); | |
1051 | ||
1052 | // Returns the UI update mode | |
1053 | static wxUpdateUIMode GetMode(); | |
1054 | }; | |
1055 | ||
d14a1e28 RD |
1056 | //--------------------------------------------------------------------------- |
1057 | %newgroup; | |
1058 | ||
1059 | class wxSysColourChangedEvent: public wxEvent { | |
1060 | public: | |
1061 | wxSysColourChangedEvent(); | |
1062 | }; | |
1063 | ||
1064 | //--------------------------------------------------------------------------- | |
1065 | %newgroup; | |
1066 | ||
1067 | ||
1068 | // wxEVT_MOUSE_CAPTURE_CHANGED | |
1069 | // The window losing the capture receives this message | |
1070 | // (even if it released the capture itself). | |
1071 | class wxMouseCaptureChangedEvent : public wxEvent | |
1072 | { | |
1073 | public: | |
1074 | wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL); | |
1075 | ||
1076 | wxWindow* GetCapturedWindow() const; | |
1077 | }; | |
1078 | ||
1079 | //--------------------------------------------------------------------------- | |
1080 | %newgroup; | |
1081 | ||
1082 | class wxDisplayChangedEvent : public wxEvent | |
1083 | { | |
1084 | public: | |
1085 | wxDisplayChangedEvent(); | |
1086 | }; | |
1087 | ||
1088 | //--------------------------------------------------------------------------- | |
1089 | %newgroup; | |
1090 | ||
1091 | class wxPaletteChangedEvent : public wxEvent | |
1092 | { | |
1093 | public: | |
1094 | wxPaletteChangedEvent(wxWindowID id = 0); | |
1095 | ||
1096 | void SetChangedWindow(wxWindow* win); | |
1097 | wxWindow* GetChangedWindow(); | |
1098 | ||
1099 | }; | |
1100 | ||
1101 | //--------------------------------------------------------------------------- | |
1102 | %newgroup; | |
1103 | ||
1104 | ||
1105 | // wxEVT_QUERY_NEW_PALETTE | |
1106 | // Indicates the window is getting keyboard focus and should re-do its palette. | |
1107 | class wxQueryNewPaletteEvent : public wxEvent | |
1108 | { | |
1109 | public: | |
1110 | wxQueryNewPaletteEvent(wxWindowID winid = 0); | |
1111 | ||
1112 | // App sets this if it changes the palette. | |
1113 | void SetPaletteRealized(bool realized); | |
1114 | bool GetPaletteRealized() const; | |
1115 | }; | |
1116 | ||
1117 | //--------------------------------------------------------------------------- | |
1118 | %newgroup; | |
1119 | ||
1120 | ||
1121 | // Event generated by dialog navigation keys | |
1122 | // wxEVT_NAVIGATION_KEY | |
1123 | ||
1124 | class wxNavigationKeyEvent : public wxEvent | |
1125 | { | |
1126 | public: | |
1127 | wxNavigationKeyEvent(); | |
1128 | ||
dd9f7fea | 1129 | // direction: forward (True) or backward (False) |
d14a1e28 | 1130 | bool GetDirection() const; |
3b74f194 | 1131 | void SetDirection(bool forward); |
d14a1e28 RD |
1132 | |
1133 | // it may be a window change event (MDI, notebook pages...) or a control | |
1134 | // change event | |
1135 | bool IsWindowChange() const; | |
3b74f194 | 1136 | void SetWindowChange(bool ischange); |
d14a1e28 | 1137 | |
3b74f194 RD |
1138 | void SetFlags(long flags); |
1139 | ||
d14a1e28 RD |
1140 | // the child which has the focus currently (may be NULL - use |
1141 | // wxWindow::FindFocus then) | |
1142 | wxWindow* GetCurrentFocus() const; | |
1143 | void SetCurrentFocus(wxWindow *win); | |
3b74f194 RD |
1144 | |
1145 | enum { | |
5a319c5c | 1146 | IsBackward, |
3b74f194 RD |
1147 | IsForward, |
1148 | WinChange | |
1149 | }; | |
d14a1e28 RD |
1150 | }; |
1151 | ||
1152 | ||
1153 | //--------------------------------------------------------------------------- | |
1154 | %newgroup; | |
1155 | ||
1156 | // Window creation/destruction events: the first is sent as soon as window is | |
1157 | // created (i.e. the underlying GUI object exists), but when the C++ object is | |
1158 | // fully initialized (so virtual functions may be called). The second, | |
1159 | // wxEVT_DESTROY, is sent right before the window is destroyed - again, it's | |
1160 | // still safe to call virtual functions at this moment | |
1161 | ||
1162 | class wxWindowCreateEvent : public wxCommandEvent | |
1163 | { | |
1164 | public: | |
1165 | wxWindowCreateEvent(wxWindow *win = NULL); | |
1166 | wxWindow *GetWindow() const; | |
1167 | }; | |
1168 | ||
1169 | class wxWindowDestroyEvent : public wxCommandEvent | |
1170 | { | |
1171 | public: | |
1172 | wxWindowDestroyEvent(wxWindow *win = NULL); | |
1173 | wxWindow *GetWindow() const; | |
1174 | }; | |
1175 | ||
1176 | ||
1177 | //--------------------------------------------------------------------------- | |
1178 | %newgroup; | |
1179 | ||
1180 | // A Context event is sent when the user right clicks on a window or | |
1181 | // presses Shift-F10 | |
1182 | // NOTE : Under windows this is a repackaged WM_CONTETXMENU message | |
1183 | // Under other systems it may have to be generated from a right click event | |
1184 | /* | |
1185 | wxEVT_CONTEXT_MENU | |
1186 | */ | |
1187 | ||
1188 | class wxContextMenuEvent : public wxCommandEvent | |
1189 | { | |
1190 | public: | |
1191 | wxContextMenuEvent(wxEventType type = wxEVT_NULL, | |
1192 | wxWindowID winid = 0, | |
1193 | const wxPoint& pt = wxDefaultPosition); | |
1194 | ||
1195 | // Position of event (in screen coordinates) | |
1196 | const wxPoint& GetPosition() const; | |
1197 | void SetPosition(const wxPoint& pos); | |
1198 | }; | |
1199 | ||
1200 | //--------------------------------------------------------------------------- | |
1201 | %newgroup; | |
1202 | ||
1203 | // Whether to always send idle events to windows, or | |
1204 | // to only send update events to those with the | |
1205 | // wxWS_EX_PROCESS_IDLE style. | |
1206 | ||
1207 | enum wxIdleMode | |
1208 | { | |
1209 | // Send idle events to all windows | |
1210 | wxIDLE_PROCESS_ALL, | |
1211 | ||
1212 | // Send idle events to windows that have | |
1213 | // the wxWS_EX_PROCESS_IDLE flag specified | |
1214 | wxIDLE_PROCESS_SPECIFIED | |
1215 | }; | |
1216 | ||
64e8a1f0 | 1217 | |
d14a1e28 RD |
1218 | class wxIdleEvent : public wxEvent |
1219 | { | |
1220 | public: | |
1221 | wxIdleEvent(); | |
1222 | ||
dd9f7fea | 1223 | void RequestMore(bool needMore = True); |
d14a1e28 RD |
1224 | bool MoreRequested() const; |
1225 | ||
1226 | // Specify how wxWindows will send idle events: to | |
1227 | // all windows, or only to those which specify that they | |
1228 | // will process the events. | |
1229 | static void SetMode(wxIdleMode mode); | |
1230 | ||
1231 | // Returns the idle event mode | |
1232 | static wxIdleMode GetMode(); | |
1233 | ||
1234 | // Can we send an idle event? | |
1235 | static bool CanSend(wxWindow* win); | |
1236 | }; | |
1237 | ||
1238 | //--------------------------------------------------------------------------- | |
1239 | %newgroup; | |
1240 | ||
1241 | // These classes can be derived from in Python and passed through the event | |
1242 | // system without loosing anything. They do this by keeping a reference to | |
1243 | // themselves and some special case handling in wxPyCallback::EventThunker. | |
1244 | ||
1245 | class wxPyEvent : public wxEvent { | |
1246 | public: | |
2b9048c5 | 1247 | %pythonAppend wxPyEvent "self.SetSelf(self)" |
d14a1e28 RD |
1248 | wxPyEvent(int winid=0, wxEventType commandType = wxEVT_NULL ); |
1249 | ~wxPyEvent(); | |
1250 | ||
1251 | ||
1252 | void SetSelf(PyObject* self); | |
1253 | PyObject* GetSelf(); | |
1254 | }; | |
1255 | ||
1256 | ||
1257 | class wxPyCommandEvent : public wxCommandEvent { | |
1258 | public: | |
2b9048c5 | 1259 | %pythonAppend wxPyCommandEvent "self.SetSelf(self)" |
d14a1e28 RD |
1260 | wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0); |
1261 | ~wxPyCommandEvent(); | |
1262 | ||
1263 | void SetSelf(PyObject* self); | |
1264 | PyObject* GetSelf(); | |
1265 | }; | |
1266 | ||
1267 | ||
1268 | ||
1269 | //--------------------------------------------------------------------------- | |
1270 | ||
1271 | ||
1272 |