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