]>
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); | |
31066066 | 371 | int GetId() const; |
d14a1e28 RD |
372 | void SetId(int Id); |
373 | ||
374 | ||
375 | bool IsCommandEvent() const; | |
376 | ||
31066066 RD |
377 | DocDeclStr( |
378 | void , Skip(bool skip = true), | |
379 | "Called by an event handler, it controls whether additional event | |
380 | handlers bound to this event will be called after the current event | |
381 | handler returns. Skip(false) (the default setting) will prevent | |
382 | additional event handlers from being called and control will be | |
383 | returned to the sender of the event immediately after the current | |
384 | handler has finished. Skip(True) will cause the event processing | |
385 | system to continue searching for a handler function for this event. | |
386 | ", ""); | |
387 | ||
d14a1e28 RD |
388 | bool GetSkipped() const; |
389 | ||
390 | // Determine if this event should be propagating to the parent window. | |
391 | bool ShouldPropagate() const; | |
392 | ||
393 | // Stop an event from propagating to its parent window, returns the old | |
394 | // propagation level value | |
395 | int StopPropagation(); | |
396 | ||
397 | // Resume the event propagation by restoring the propagation level | |
398 | // (returned by StopPropagation()) | |
399 | void ResumePropagation(int propagationLevel); | |
400 | ||
401 | // this function is used to create a copy of the event polymorphically and | |
402 | // all derived classes must implement it because otherwise wxPostEvent() | |
403 | // for them wouldn't work (it needs to do a copy of the event) | |
404 | virtual wxEvent *Clone() /* =0*/; | |
405 | }; | |
406 | ||
407 | ||
408 | //--------------------------------------------------------------------------- | |
409 | %newgroup; | |
410 | ||
411 | // Helper class to temporarily change an event not to propagate. | |
412 | class wxPropagationDisabler | |
413 | { | |
414 | public: | |
415 | wxPropagationDisabler(wxEvent& event); | |
416 | ~wxPropagationDisabler(); | |
417 | }; | |
418 | ||
419 | ||
420 | // Another one to temporarily lower propagation level. | |
421 | class wxPropagateOnce | |
422 | { | |
423 | public: | |
424 | wxPropagateOnce(wxEvent& event); | |
425 | ~wxPropagateOnce(); | |
426 | }; | |
427 | ||
428 | //--------------------------------------------------------------------------- | |
429 | %newgroup; | |
430 | ||
431 | class wxCommandEvent : public wxEvent | |
432 | { | |
433 | public: | |
434 | wxCommandEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); | |
435 | ||
436 | ||
437 | // // Set/Get client data from controls | |
438 | // void SetClientData(void* clientData) { m_clientData = clientData; } | |
439 | // void *GetClientData() const { return m_clientData; } | |
440 | ||
441 | // // Set/Get client object from controls | |
442 | // void SetClientObject(wxClientData* clientObject) { m_clientObject = clientObject; } | |
443 | // void *GetClientObject() const { return m_clientObject; } | |
444 | ||
445 | ||
446 | // Get listbox selection if single-choice | |
447 | int GetSelection() const; | |
448 | ||
449 | // Set/Get listbox/choice selection string | |
450 | void SetString(const wxString& s); | |
451 | wxString GetString() const; | |
452 | ||
453 | // Get checkbox value | |
454 | bool IsChecked() const; | |
61c5a8ac RD |
455 | %pythoncode { Checked = IsChecked } |
456 | ||
dd9f7fea | 457 | // True if the listbox event was a selection. |
d14a1e28 RD |
458 | bool IsSelection() const; |
459 | ||
460 | void SetExtraLong(long extraLong); | |
461 | long GetExtraLong() const; | |
462 | ||
463 | void SetInt(int i); | |
464 | long GetInt() const; | |
465 | ||
466 | virtual wxEvent *Clone() const; | |
467 | ||
468 | }; | |
469 | ||
470 | //--------------------------------------------------------------------------- | |
471 | %newgroup; | |
472 | ||
473 | // this class adds a possibility to react (from the user) code to a control | |
474 | // notification: allow or veto the operation being reported. | |
475 | class wxNotifyEvent : public wxCommandEvent | |
476 | { | |
477 | public: | |
478 | wxNotifyEvent(wxEventType commandType = wxEVT_NULL, int winid = 0); | |
479 | ||
480 | // veto the operation (usually it's allowed by default) | |
481 | void Veto(); | |
482 | ||
483 | // allow the operation if it was disabled by default | |
484 | void Allow(); | |
485 | ||
486 | // for implementation code only: is the operation allowed? | |
487 | bool IsAllowed(); | |
488 | }; | |
489 | ||
490 | ||
491 | //--------------------------------------------------------------------------- | |
492 | %newgroup; | |
493 | ||
494 | // Scroll event class, derived form wxCommandEvent. wxScrollEvents are | |
495 | // sent by wxSlider and wxScrollBar. | |
496 | class wxScrollEvent : public wxCommandEvent | |
497 | { | |
498 | public: | |
499 | wxScrollEvent(wxEventType commandType = wxEVT_NULL, | |
500 | int winid = 0, int pos = 0, int orient = 0); | |
501 | ||
502 | int GetOrientation() const; | |
503 | int GetPosition() const; | |
504 | void SetOrientation(int orient); | |
505 | void SetPosition(int pos); | |
506 | }; | |
507 | ||
508 | ||
509 | //--------------------------------------------------------------------------- | |
510 | %newgroup; | |
511 | ||
512 | // ScrollWin event class, derived fom wxEvent. wxScrollWinEvents | |
513 | // are sent by wxWindow. | |
514 | class wxScrollWinEvent : public wxEvent | |
515 | { | |
516 | public: | |
517 | wxScrollWinEvent(wxEventType commandType = wxEVT_NULL, | |
518 | int pos = 0, int orient = 0); | |
519 | ||
520 | int GetOrientation() const; | |
521 | int GetPosition() const; | |
522 | void SetOrientation(int orient); | |
523 | void SetPosition(int pos); | |
524 | }; | |
525 | ||
526 | //--------------------------------------------------------------------------- | |
527 | %newgroup; | |
528 | ||
529 | // the symbolic names for the mouse buttons | |
530 | enum | |
531 | { | |
532 | wxMOUSE_BTN_ANY = -1, | |
533 | wxMOUSE_BTN_NONE = -1, | |
534 | wxMOUSE_BTN_LEFT = 0, | |
535 | wxMOUSE_BTN_MIDDLE = 1, | |
536 | wxMOUSE_BTN_RIGHT = 2 | |
537 | }; | |
538 | ||
539 | ||
540 | // Mouse event class | |
541 | class wxMouseEvent : public wxEvent | |
542 | { | |
543 | public: | |
544 | wxMouseEvent(wxEventType mouseType = wxEVT_NULL); | |
545 | ||
546 | // Was it a button event? (*doesn't* mean: is any button *down*?) | |
547 | bool IsButton() const; | |
548 | ||
549 | // Was it a down event from this (or any) button? | |
550 | bool ButtonDown(int but = wxMOUSE_BTN_ANY) const; | |
551 | ||
552 | // Was it a dclick event from this (or any) button? | |
553 | bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const; | |
554 | ||
555 | // Was it a up event from this (or any) button? | |
556 | bool ButtonUp(int but = wxMOUSE_BTN_ANY) const; | |
557 | ||
558 | // Was the given button changing state? | |
559 | bool Button(int but) const; | |
560 | ||
561 | // Was the given button in Down state? | |
562 | bool ButtonIsDown(int but) const; | |
563 | ||
564 | // Get the button which is changing state (wxMOUSE_BTN_NONE if none) | |
565 | int GetButton() const; | |
566 | ||
567 | // Find state of shift/control keys | |
568 | bool ControlDown() const; | |
569 | bool MetaDown() const; | |
570 | bool AltDown() const; | |
571 | bool ShiftDown() const; | |
572 | ||
ba3e5ef2 RD |
573 | DocDeclStr( |
574 | bool , CmdDown() const, | |
575 | "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix | |
576 | platforms but the special \"Apple\" (a.k.a as \"Command\") key on | |
577 | Macs: it makes often sense to use it instead of, say, `ControlDown` | |
578 | because Cmd key is used for the same thing under Mac as Ctrl | |
579 | elsewhere. The Ctrl still exists, it's just not used for this | |
580 | purpose. So for non-Mac platforms this is the same as `ControlDown` | |
581 | and Macs this is the same as `MetaDown`.", ""); | |
582 | ||
d14a1e28 RD |
583 | // Find which event was just generated |
584 | bool LeftDown() const; | |
585 | bool MiddleDown() const; | |
586 | bool RightDown() const; | |
587 | ||
588 | bool LeftUp() const; | |
589 | bool MiddleUp() const; | |
590 | bool RightUp() const; | |
591 | ||
592 | bool LeftDClick() const; | |
593 | bool MiddleDClick() const; | |
594 | bool RightDClick() const; | |
595 | ||
596 | // Find the current state of the mouse buttons (regardless | |
597 | // of current event type) | |
598 | bool LeftIsDown(); | |
599 | bool MiddleIsDown(); | |
600 | bool RightIsDown(); | |
601 | ||
602 | // True if a button is down and the mouse is moving | |
603 | bool Dragging() const; | |
604 | ||
605 | // True if the mouse is moving, and no button is down | |
606 | bool Moving() const; | |
607 | ||
608 | // True if the mouse is just entering the window | |
609 | bool Entering() const; | |
610 | ||
611 | // True if the mouse is just leaving the window | |
612 | bool Leaving() const; | |
613 | ||
dd9f7fea RD |
614 | |
615 | DocStr(GetPosition, // sets the docstring for both | |
d07d2bc9 RD |
616 | "Returns the position of the mouse in window coordinates when the event |
617 | happened.", ""); | |
d14a1e28 | 618 | wxPoint GetPosition(); |
d14a1e28 | 619 | |
dd9f7fea RD |
620 | DocDeclAName( |
621 | void, GetPosition(long *OUTPUT, long *OUTPUT), | |
622 | "GetPositionTuple() -> (x,y)", | |
623 | GetPositionTuple); | |
624 | ||
d14a1e28 RD |
625 | // Find the logical position of the event given the DC |
626 | wxPoint GetLogicalPosition(const wxDC& dc) const; | |
627 | ||
628 | // Get X position | |
629 | wxCoord GetX() const; | |
630 | ||
631 | // Get Y position | |
632 | wxCoord GetY() const; | |
633 | ||
634 | // Get wheel rotation, positive or negative indicates direction of | |
635 | // rotation. Current devices all send an event when rotation is equal to | |
636 | // +/-WheelDelta, but this allows for finer resolution devices to be | |
637 | // created in the future. Because of this you shouldn't assume that one | |
638 | // event is equal to 1 line or whatever, but you should be able to either | |
639 | // do partial line scrolling or wait until +/-WheelDelta rotation values | |
640 | // have been accumulated before scrolling. | |
641 | int GetWheelRotation() const; | |
642 | ||
643 | // Get wheel delta, normally 120. This is the threshold for action to be | |
644 | // taken, and one such action (for example, scrolling one increment) | |
645 | // should occur for each delta. | |
646 | int GetWheelDelta() const; | |
647 | ||
648 | // Returns the configured number of lines (or whatever) to be scrolled per | |
649 | // wheel action. Defaults to one. | |
650 | int GetLinesPerAction() const; | |
651 | ||
652 | // Is the system set to do page scrolling? | |
653 | bool IsPageScroll() const; | |
654 | ||
655 | public: | |
656 | wxCoord m_x, m_y; | |
657 | ||
658 | bool m_leftDown; | |
659 | bool m_middleDown; | |
660 | bool m_rightDown; | |
661 | ||
662 | bool m_controlDown; | |
663 | bool m_shiftDown; | |
664 | bool m_altDown; | |
665 | bool m_metaDown; | |
666 | ||
667 | int m_wheelRotation; | |
668 | int m_wheelDelta; | |
669 | int m_linesPerAction; | |
670 | }; | |
671 | ||
672 | //--------------------------------------------------------------------------- | |
673 | %newgroup; | |
674 | ||
675 | // Cursor set event | |
676 | class wxSetCursorEvent : public wxEvent | |
677 | { | |
678 | public: | |
679 | wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0); | |
680 | ||
681 | wxCoord GetX() const; | |
682 | wxCoord GetY() const; | |
683 | ||
684 | void SetCursor(const wxCursor& cursor); | |
685 | const wxCursor& GetCursor() const; | |
686 | bool HasCursor() const; | |
687 | }; | |
688 | ||
689 | //--------------------------------------------------------------------------- | |
690 | %newgroup; | |
691 | ||
692 | // Keyboard input event class | |
693 | ||
694 | class wxKeyEvent : public wxEvent | |
695 | { | |
696 | public: | |
697 | wxKeyEvent(wxEventType keyType = wxEVT_NULL); | |
698 | ||
699 | // Find state of shift/control keys | |
700 | bool ControlDown() const; | |
701 | bool MetaDown() const; | |
702 | bool AltDown() const; | |
703 | bool ShiftDown() const; | |
ba3e5ef2 RD |
704 | |
705 | DocDeclStr( | |
706 | bool , CmdDown() const, | |
707 | "\"Cmd\" is a pseudo key which is the same as Control for PC and Unix | |
708 | platforms but the special \"Apple\" (a.k.a as \"Command\") key on | |
709 | Macs: it makes often sense to use it instead of, say, `ControlDown` | |
710 | because Cmd key is used for the same thing under Mac as Ctrl | |
711 | elsewhere. The Ctrl still exists, it's just not used for this | |
712 | purpose. So for non-Mac platforms this is the same as `ControlDown` | |
713 | and Macs this is the same as `MetaDown`.", ""); | |
714 | ||
715 | ||
d14a1e28 RD |
716 | |
717 | // exclude MetaDown() from HasModifiers() because NumLock under X is often | |
718 | // configured as mod2 modifier, yet the key events even when it is pressed | |
719 | // should be processed normally, not like Ctrl- or Alt-key | |
720 | bool HasModifiers() const; | |
721 | ||
722 | // get the key code: an ASCII7 char or an element of wxKeyCode enum | |
723 | int GetKeyCode() const; | |
724 | %pythoncode { KeyCode = GetKeyCode } | |
725 | ||
726 | %extend { | |
ba87052f | 727 | int GetUnicodeKey() { |
3b7224dc | 728 | %#if wxUSE_UNICODE |
ba87052f | 729 | return self->GetUnicodeKey(); |
3b7224dc | 730 | %#else |
d14a1e28 | 731 | return 0; |
3b7224dc | 732 | %#endif |
d14a1e28 RD |
733 | } |
734 | } | |
ba87052f RD |
735 | %pythoncode { GetUniChar = GetUnicodeKey } |
736 | ||
d14a1e28 RD |
737 | |
738 | // get the raw key code (platform-dependent) | |
739 | wxUint32 GetRawKeyCode() const; | |
740 | ||
741 | // get the raw key flags (platform-dependent) | |
742 | wxUint32 GetRawKeyFlags() const; | |
743 | ||
dd9f7fea RD |
744 | |
745 | DocStr(GetPosition, // sets the docstring for both | |
d07d2bc9 | 746 | "Find the position of the event.", ""); |
d14a1e28 | 747 | wxPoint GetPosition(); |
dd9f7fea RD |
748 | |
749 | DocDeclAName( | |
750 | void, GetPosition(long *OUTPUT, long *OUTPUT), | |
751 | "GetPositionTuple() -> (x,y)", | |
752 | GetPositionTuple); | |
d14a1e28 RD |
753 | |
754 | // Get X position | |
755 | wxCoord GetX() const; | |
756 | ||
757 | // Get Y position | |
758 | wxCoord GetY() const; | |
759 | ||
760 | public: | |
761 | wxCoord m_x, m_y; | |
762 | ||
763 | long m_keyCode; | |
764 | ||
765 | bool m_controlDown; | |
766 | bool m_shiftDown; | |
767 | bool m_altDown; | |
768 | bool m_metaDown; | |
769 | bool m_scanCode; | |
770 | ||
771 | // these fields contain the platform-specific information about | |
772 | // key that was pressed | |
773 | wxUint32 m_rawCode; | |
774 | wxUint32 m_rawFlags; | |
775 | }; | |
776 | ||
777 | //--------------------------------------------------------------------------- | |
778 | %newgroup; | |
779 | ||
780 | // Size event class | |
781 | class wxSizeEvent : public wxEvent | |
782 | { | |
783 | public: | |
784 | wxSizeEvent(const wxSize& sz=wxDefaultSize, int winid = 0); | |
785 | ||
786 | wxSize GetSize() const; | |
787 | wxRect GetRect() const; | |
788 | void SetRect(wxRect rect); | |
789 | %extend { | |
790 | void SetSize(wxSize size) { | |
791 | self->m_size = size; | |
792 | } | |
793 | } | |
794 | ||
795 | public: | |
796 | wxSize m_size; | |
797 | wxRect m_rect; // Used for wxEVT_SIZING | |
798 | }; | |
799 | ||
800 | ||
801 | //--------------------------------------------------------------------------- | |
802 | %newgroup; | |
803 | ||
804 | // Move event class | |
805 | class wxMoveEvent : public wxEvent | |
806 | { | |
807 | public: | |
808 | wxMoveEvent(const wxPoint& pos=wxDefaultPosition, int winid = 0); | |
809 | ||
810 | wxPoint GetPosition() const; | |
811 | wxRect GetRect() const; | |
812 | void SetRect(wxRect rect); | |
813 | %extend { | |
814 | void SetPosition(wxPoint pos) { | |
815 | self->m_pos = pos; | |
816 | } | |
817 | } | |
818 | ||
819 | wxPoint m_pos; | |
820 | wxRect m_rect; | |
821 | }; | |
822 | ||
823 | //--------------------------------------------------------------------------- | |
824 | %newgroup; | |
825 | ||
826 | // Paint event class | |
827 | class wxPaintEvent : public wxEvent | |
828 | { | |
829 | public: | |
830 | wxPaintEvent(int Id = 0); | |
831 | }; | |
832 | ||
833 | ||
834 | class wxNcPaintEvent : public wxEvent | |
835 | { | |
836 | public: | |
837 | wxNcPaintEvent(int winid = 0); | |
838 | }; | |
839 | ||
840 | //--------------------------------------------------------------------------- | |
841 | %newgroup; | |
842 | ||
843 | class wxEraseEvent : public wxEvent | |
844 | { | |
845 | public: | |
846 | wxEraseEvent(int Id = 0, wxDC *dc = (wxDC *) NULL); | |
847 | ||
848 | wxDC *GetDC() const; | |
849 | }; | |
850 | ||
851 | ||
852 | //--------------------------------------------------------------------------- | |
853 | %newgroup; | |
854 | ||
855 | class wxFocusEvent : public wxEvent | |
856 | { | |
857 | public: | |
858 | wxFocusEvent(wxEventType type = wxEVT_NULL, int winid = 0); | |
859 | ||
860 | // The window associated with this event is the window which had focus | |
861 | // before for SET event and the window which will have focus for the KILL | |
862 | // one. NB: it may be NULL in both cases! | |
863 | wxWindow *GetWindow() const; | |
864 | void SetWindow(wxWindow *win); | |
865 | }; | |
866 | ||
867 | //--------------------------------------------------------------------------- | |
868 | %newgroup; | |
869 | ||
870 | // wxChildFocusEvent notifies the parent that a child has got the focus: unlike | |
871 | // wxFocusEvent it is propagated upwards the window chain | |
872 | class wxChildFocusEvent : public wxCommandEvent | |
873 | { | |
874 | public: | |
875 | wxChildFocusEvent(wxWindow *win = NULL); | |
876 | ||
877 | wxWindow *GetWindow() const; | |
878 | }; | |
879 | ||
880 | //--------------------------------------------------------------------------- | |
881 | %newgroup; | |
882 | ||
883 | class wxActivateEvent : public wxEvent | |
884 | { | |
885 | public: | |
a72f4631 | 886 | wxActivateEvent(wxEventType type = wxEVT_NULL, bool active = true, int Id = 0); |
d14a1e28 RD |
887 | bool GetActive() const; |
888 | }; | |
889 | ||
890 | ||
891 | //--------------------------------------------------------------------------- | |
892 | %newgroup; | |
893 | ||
894 | class wxInitDialogEvent : public wxEvent | |
895 | { | |
896 | public: | |
897 | wxInitDialogEvent(int Id = 0); | |
898 | }; | |
899 | ||
900 | ||
901 | //--------------------------------------------------------------------------- | |
902 | %newgroup; | |
903 | ||
904 | class wxMenuEvent : public wxEvent | |
905 | { | |
906 | public: | |
907 | wxMenuEvent(wxEventType type = wxEVT_NULL, int winid = 0, wxMenu* menu = NULL); | |
908 | ||
909 | // only for wxEVT_MENU_HIGHLIGHT | |
910 | int GetMenuId() const; | |
911 | ||
912 | // only for wxEVT_MENU_OPEN/CLOSE | |
913 | bool IsPopup() const; | |
914 | ||
915 | // only for wxEVT_MENU_OPEN/CLOSE | |
916 | wxMenu* GetMenu() const; | |
917 | }; | |
918 | ||
919 | //--------------------------------------------------------------------------- | |
920 | %newgroup; | |
921 | ||
922 | // Window close or session close event class | |
923 | class wxCloseEvent : public wxEvent | |
924 | { | |
925 | public: | |
926 | wxCloseEvent(wxEventType type = wxEVT_NULL, int winid = 0); | |
927 | ||
928 | void SetLoggingOff(bool logOff); | |
929 | bool GetLoggingOff() const; | |
930 | ||
a72f4631 | 931 | void Veto(bool veto = true); |
d14a1e28 RD |
932 | void SetCanVeto(bool canVeto); |
933 | ||
934 | bool CanVeto() const; | |
935 | bool GetVeto() const; | |
936 | }; | |
937 | ||
938 | ||
939 | //--------------------------------------------------------------------------- | |
940 | %newgroup; | |
941 | ||
942 | class wxShowEvent : public wxEvent | |
943 | { | |
944 | public: | |
a72f4631 | 945 | wxShowEvent(int winid = 0, bool show = false); |
d14a1e28 RD |
946 | |
947 | void SetShow(bool show); | |
948 | bool GetShow() const; | |
949 | ||
950 | }; | |
951 | ||
952 | ||
953 | //--------------------------------------------------------------------------- | |
954 | %newgroup; | |
955 | ||
956 | class wxIconizeEvent: public wxEvent | |
957 | { | |
958 | public: | |
a72f4631 | 959 | wxIconizeEvent(int id = 0, bool iconized = true); |
d14a1e28 RD |
960 | bool Iconized(); |
961 | }; | |
962 | ||
963 | ||
964 | //--------------------------------------------------------------------------- | |
965 | %newgroup; | |
966 | ||
967 | class wxMaximizeEvent: public wxEvent | |
968 | { | |
969 | public: | |
970 | wxMaximizeEvent(int id = 0); | |
971 | }; | |
972 | ||
973 | //--------------------------------------------------------------------------- | |
974 | %newgroup; | |
975 | ||
976 | class wxDropFilesEvent: public wxEvent | |
977 | { | |
978 | public: | |
979 | wxPoint GetPosition(); | |
980 | int GetNumberOfFiles(); | |
981 | ||
982 | %extend { | |
983 | PyObject* GetFiles() { | |
984 | int count = self->GetNumberOfFiles(); | |
985 | wxString* files = self->GetFiles(); | |
986 | PyObject* list = PyList_New(count); | |
987 | ||
988 | if (!list) { | |
989 | PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!"); | |
990 | return NULL; | |
991 | } | |
992 | ||
993 | for (int i=0; i<count; i++) { | |
1fc9204a | 994 | PyList_SetItem(list, i, wx2PyString(files[i])); |
d14a1e28 RD |
995 | } |
996 | return list; | |
997 | } | |
998 | } | |
999 | }; | |
1000 | ||
1001 | ||
1002 | ||
1003 | //--------------------------------------------------------------------------- | |
1004 | %newgroup; | |
1005 | ||
1006 | ||
1007 | // Whether to always send update events to windows, or | |
1008 | // to only send update events to those with the | |
1009 | // wxWS_EX_PROCESS_UI_UPDATES style. | |
1010 | ||
1011 | enum wxUpdateUIMode | |
1012 | { | |
1013 | // Send UI update events to all windows | |
1014 | wxUPDATE_UI_PROCESS_ALL, | |
1015 | ||
1016 | // Send UI update events to windows that have | |
1017 | // the wxWS_EX_PROCESS_UI_UPDATES flag specified | |
1018 | wxUPDATE_UI_PROCESS_SPECIFIED | |
1019 | }; | |
1020 | ||
64e8a1f0 RD |
1021 | |
1022 | ||
d14a1e28 RD |
1023 | class wxUpdateUIEvent : public wxCommandEvent |
1024 | { | |
1025 | public: | |
1026 | wxUpdateUIEvent(wxWindowID commandId = 0); | |
1027 | ||
1028 | bool GetChecked() const; | |
1029 | bool GetEnabled() const; | |
1030 | wxString GetText() const; | |
1031 | bool GetSetText() const; | |
1032 | bool GetSetChecked() const; | |
1033 | bool GetSetEnabled() const; | |
1034 | ||
1035 | void Check(bool check); | |
1036 | void Enable(bool enable); | |
1037 | void SetText(const wxString& text); | |
1038 | ||
1039 | // Sets the interval between updates in milliseconds. | |
1040 | // Set to -1 to disable updates, or to 0 to update as frequently as possible. | |
1041 | static void SetUpdateInterval(long updateInterval); | |
1042 | ||
1043 | // Returns the current interval between updates in milliseconds | |
1044 | static long GetUpdateInterval(); | |
1045 | ||
1046 | // Can we update this window? | |
1047 | static bool CanUpdate(wxWindow *win); | |
1048 | ||
1049 | // Reset the update time to provide a delay until the next | |
1050 | // time we should update | |
1051 | static void ResetUpdateTime(); | |
1052 | ||
1053 | // Specify how wxWindows will send update events: to | |
1054 | // all windows, or only to those which specify that they | |
1055 | // will process the events. | |
1056 | static void SetMode(wxUpdateUIMode mode); | |
1057 | ||
1058 | // Returns the UI update mode | |
1059 | static wxUpdateUIMode GetMode(); | |
1060 | }; | |
1061 | ||
d14a1e28 RD |
1062 | //--------------------------------------------------------------------------- |
1063 | %newgroup; | |
1064 | ||
1065 | class wxSysColourChangedEvent: public wxEvent { | |
1066 | public: | |
1067 | wxSysColourChangedEvent(); | |
1068 | }; | |
1069 | ||
1070 | //--------------------------------------------------------------------------- | |
1071 | %newgroup; | |
1072 | ||
1073 | ||
1074 | // wxEVT_MOUSE_CAPTURE_CHANGED | |
1075 | // The window losing the capture receives this message | |
1076 | // (even if it released the capture itself). | |
1077 | class wxMouseCaptureChangedEvent : public wxEvent | |
1078 | { | |
1079 | public: | |
1080 | wxMouseCaptureChangedEvent(wxWindowID winid = 0, wxWindow* gainedCapture = NULL); | |
1081 | ||
1082 | wxWindow* GetCapturedWindow() const; | |
1083 | }; | |
1084 | ||
1085 | //--------------------------------------------------------------------------- | |
1086 | %newgroup; | |
1087 | ||
1088 | class wxDisplayChangedEvent : public wxEvent | |
1089 | { | |
1090 | public: | |
1091 | wxDisplayChangedEvent(); | |
1092 | }; | |
1093 | ||
1094 | //--------------------------------------------------------------------------- | |
1095 | %newgroup; | |
1096 | ||
1097 | class wxPaletteChangedEvent : public wxEvent | |
1098 | { | |
1099 | public: | |
1100 | wxPaletteChangedEvent(wxWindowID id = 0); | |
1101 | ||
1102 | void SetChangedWindow(wxWindow* win); | |
1103 | wxWindow* GetChangedWindow(); | |
1104 | ||
1105 | }; | |
1106 | ||
1107 | //--------------------------------------------------------------------------- | |
1108 | %newgroup; | |
1109 | ||
1110 | ||
1111 | // wxEVT_QUERY_NEW_PALETTE | |
1112 | // Indicates the window is getting keyboard focus and should re-do its palette. | |
1113 | class wxQueryNewPaletteEvent : public wxEvent | |
1114 | { | |
1115 | public: | |
1116 | wxQueryNewPaletteEvent(wxWindowID winid = 0); | |
1117 | ||
1118 | // App sets this if it changes the palette. | |
1119 | void SetPaletteRealized(bool realized); | |
1120 | bool GetPaletteRealized() const; | |
1121 | }; | |
1122 | ||
1123 | //--------------------------------------------------------------------------- | |
1124 | %newgroup; | |
1125 | ||
1126 | ||
1127 | // Event generated by dialog navigation keys | |
1128 | // wxEVT_NAVIGATION_KEY | |
1129 | ||
1130 | class wxNavigationKeyEvent : public wxEvent | |
1131 | { | |
1132 | public: | |
1133 | wxNavigationKeyEvent(); | |
1134 | ||
dd9f7fea | 1135 | // direction: forward (True) or backward (False) |
d14a1e28 | 1136 | bool GetDirection() const; |
3b74f194 | 1137 | void SetDirection(bool forward); |
d14a1e28 RD |
1138 | |
1139 | // it may be a window change event (MDI, notebook pages...) or a control | |
1140 | // change event | |
1141 | bool IsWindowChange() const; | |
3b74f194 | 1142 | void SetWindowChange(bool ischange); |
d14a1e28 | 1143 | |
3b74f194 RD |
1144 | void SetFlags(long flags); |
1145 | ||
d14a1e28 RD |
1146 | // the child which has the focus currently (may be NULL - use |
1147 | // wxWindow::FindFocus then) | |
1148 | wxWindow* GetCurrentFocus() const; | |
1149 | void SetCurrentFocus(wxWindow *win); | |
3b74f194 RD |
1150 | |
1151 | enum { | |
5a319c5c | 1152 | IsBackward, |
3b74f194 RD |
1153 | IsForward, |
1154 | WinChange | |
1155 | }; | |
d14a1e28 RD |
1156 | }; |
1157 | ||
1158 | ||
1159 | //--------------------------------------------------------------------------- | |
1160 | %newgroup; | |
1161 | ||
1162 | // Window creation/destruction events: the first is sent as soon as window is | |
1163 | // created (i.e. the underlying GUI object exists), but when the C++ object is | |
1164 | // fully initialized (so virtual functions may be called). The second, | |
1165 | // wxEVT_DESTROY, is sent right before the window is destroyed - again, it's | |
1166 | // still safe to call virtual functions at this moment | |
1167 | ||
1168 | class wxWindowCreateEvent : public wxCommandEvent | |
1169 | { | |
1170 | public: | |
1171 | wxWindowCreateEvent(wxWindow *win = NULL); | |
1172 | wxWindow *GetWindow() const; | |
1173 | }; | |
1174 | ||
1175 | class wxWindowDestroyEvent : public wxCommandEvent | |
1176 | { | |
1177 | public: | |
1178 | wxWindowDestroyEvent(wxWindow *win = NULL); | |
1179 | wxWindow *GetWindow() const; | |
1180 | }; | |
1181 | ||
1182 | ||
1183 | //--------------------------------------------------------------------------- | |
1184 | %newgroup; | |
1185 | ||
1186 | // A Context event is sent when the user right clicks on a window or | |
1187 | // presses Shift-F10 | |
1188 | // NOTE : Under windows this is a repackaged WM_CONTETXMENU message | |
1189 | // Under other systems it may have to be generated from a right click event | |
1190 | /* | |
1191 | wxEVT_CONTEXT_MENU | |
1192 | */ | |
1193 | ||
1194 | class wxContextMenuEvent : public wxCommandEvent | |
1195 | { | |
1196 | public: | |
1197 | wxContextMenuEvent(wxEventType type = wxEVT_NULL, | |
1198 | wxWindowID winid = 0, | |
1199 | const wxPoint& pt = wxDefaultPosition); | |
1200 | ||
1201 | // Position of event (in screen coordinates) | |
1202 | const wxPoint& GetPosition() const; | |
1203 | void SetPosition(const wxPoint& pos); | |
1204 | }; | |
1205 | ||
1206 | //--------------------------------------------------------------------------- | |
1207 | %newgroup; | |
1208 | ||
1209 | // Whether to always send idle events to windows, or | |
1210 | // to only send update events to those with the | |
1211 | // wxWS_EX_PROCESS_IDLE style. | |
1212 | ||
1213 | enum wxIdleMode | |
1214 | { | |
1215 | // Send idle events to all windows | |
1216 | wxIDLE_PROCESS_ALL, | |
1217 | ||
1218 | // Send idle events to windows that have | |
1219 | // the wxWS_EX_PROCESS_IDLE flag specified | |
1220 | wxIDLE_PROCESS_SPECIFIED | |
1221 | }; | |
1222 | ||
64e8a1f0 | 1223 | |
d14a1e28 RD |
1224 | class wxIdleEvent : public wxEvent |
1225 | { | |
1226 | public: | |
1227 | wxIdleEvent(); | |
1228 | ||
a72f4631 | 1229 | void RequestMore(bool needMore = true); |
d14a1e28 RD |
1230 | bool MoreRequested() const; |
1231 | ||
1232 | // Specify how wxWindows will send idle events: to | |
1233 | // all windows, or only to those which specify that they | |
1234 | // will process the events. | |
1235 | static void SetMode(wxIdleMode mode); | |
1236 | ||
1237 | // Returns the idle event mode | |
1238 | static wxIdleMode GetMode(); | |
1239 | ||
1240 | // Can we send an idle event? | |
1241 | static bool CanSend(wxWindow* win); | |
1242 | }; | |
1243 | ||
1244 | //--------------------------------------------------------------------------- | |
1245 | %newgroup; | |
1246 | ||
1247 | // These classes can be derived from in Python and passed through the event | |
1248 | // system without loosing anything. They do this by keeping a reference to | |
1249 | // themselves and some special case handling in wxPyCallback::EventThunker. | |
1250 | ||
1251 | class wxPyEvent : public wxEvent { | |
1252 | public: | |
2b9048c5 | 1253 | %pythonAppend wxPyEvent "self.SetSelf(self)" |
d14a1e28 RD |
1254 | wxPyEvent(int winid=0, wxEventType commandType = wxEVT_NULL ); |
1255 | ~wxPyEvent(); | |
1256 | ||
1257 | ||
1258 | void SetSelf(PyObject* self); | |
1259 | PyObject* GetSelf(); | |
1260 | }; | |
1261 | ||
1262 | ||
1263 | class wxPyCommandEvent : public wxCommandEvent { | |
1264 | public: | |
2b9048c5 | 1265 | %pythonAppend wxPyCommandEvent "self.SetSelf(self)" |
d14a1e28 RD |
1266 | wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0); |
1267 | ~wxPyCommandEvent(); | |
1268 | ||
1269 | void SetSelf(PyObject* self); | |
1270 | PyObject* GetSelf(); | |
1271 | }; | |
1272 | ||
1273 | ||
1274 | ||
1275 | //--------------------------------------------------------------------------- | |
1276 | ||
1277 | ||
1278 |