]>
Commit | Line | Data |
---|---|---|
1 | #---------------------------------------------------------------------------- | |
2 | # Name: _extra.py | |
3 | # Purpose: This file is appended to the shadow class file generated | |
4 | # by SWIG. We add some unSWIGable things here. | |
5 | # | |
6 | # Author: Robin Dunn | |
7 | # | |
8 | # Created: 6/30/97 | |
9 | # RCS-ID: $Id$ | |
10 | # Copyright: (c) 1998 by Total Control Software | |
11 | # Licence: wxWindows license | |
12 | #---------------------------------------------------------------------------- | |
13 | ||
14 | import sys | |
15 | ||
16 | #---------------------------------------------------------------------- | |
17 | # This gives this module's dictionary to the C++ extension code... | |
18 | ||
19 | _wxSetDictionary(vars()) | |
20 | ||
21 | ||
22 | #---------------------------------------------------------------------- | |
23 | #---------------------------------------------------------------------- | |
24 | # Helper function to link python methods to wxWindows virtual | |
25 | # functions by name. | |
26 | ||
27 | def _checkForCallback(obj, name, event, theID=-1): | |
28 | try: cb = getattr(obj, name) | |
29 | except: pass | |
30 | else: obj.Connect(theID, -1, event, cb) | |
31 | ||
32 | def _StdWindowCallbacks(win): | |
33 | _checkForCallback(win, "OnChar", wxEVT_CHAR) | |
34 | _checkForCallback(win, "OnSize", wxEVT_SIZE) | |
35 | _checkForCallback(win, "OnEraseBackground", wxEVT_ERASE_BACKGROUND) | |
36 | _checkForCallback(win, "OnSysColourChanged", wxEVT_SYS_COLOUR_CHANGED) | |
37 | _checkForCallback(win, "OnInitDialog", wxEVT_INIT_DIALOG) | |
38 | _checkForCallback(win, "OnIdle", wxEVT_IDLE) | |
39 | _checkForCallback(win, "OnPaint", wxEVT_PAINT) | |
40 | ||
41 | def _StdFrameCallbacks(win): | |
42 | _StdWindowCallbacks(win) | |
43 | _checkForCallback(win, "OnActivate", wxEVT_ACTIVATE) | |
44 | _checkForCallback(win, "OnMenuHighlight", wxEVT_MENU_HIGHLIGHT) | |
45 | _checkForCallback(win, "OnCloseWindow", wxEVT_CLOSE_WINDOW) | |
46 | ||
47 | ||
48 | def _StdDialogCallbacks(win): | |
49 | _StdWindowCallbacks(win) | |
50 | _checkForCallback(win, "OnOk", wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK) | |
51 | _checkForCallback(win, "OnApply", wxEVT_COMMAND_BUTTON_CLICKED, wxID_APPLY) | |
52 | _checkForCallback(win, "OnCancel", wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL) | |
53 | _checkForCallback(win, "OnCloseWindow", wxEVT_CLOSE_WINDOW) | |
54 | _checkForCallback(win, "OnCharHook", wxEVT_CHAR_HOOK) | |
55 | ||
56 | ||
57 | def _StdOnScrollCallback(win): | |
58 | try: cb = getattr(win, "OnScroll") | |
59 | except: pass | |
60 | else: EVT_SCROLL(win, cb) | |
61 | ||
62 | ||
63 | ||
64 | #---------------------------------------------------------------------- | |
65 | #---------------------------------------------------------------------- | |
66 | # functions that look and act like the C++ Macros of the same name | |
67 | ||
68 | ||
69 | # Miscellaneous | |
70 | def EVT_SIZE(win, func): | |
71 | win.Connect(-1, -1, wxEVT_SIZE, func) | |
72 | ||
73 | def EVT_MOVE(win, func): | |
74 | win.Connect(-1, -1, wxEVT_MOVE, func) | |
75 | ||
76 | def EVT_CLOSE(win, func): | |
77 | win.Connect(-1, -1, wxEVT_CLOSE_WINDOW, func) | |
78 | ||
79 | def EVT_PAINT(win, func): | |
80 | win.Connect(-1, -1, wxEVT_PAINT, func) | |
81 | ||
82 | def EVT_ERASE_BACKGROUND(win, func): | |
83 | win.Connect(-1, -1, wxEVT_ERASE_BACKGROUND, func) | |
84 | ||
85 | def EVT_CHAR(win, func): | |
86 | win.Connect(-1, -1, wxEVT_CHAR, func) | |
87 | ||
88 | def EVT_CHAR_HOOK(win, func): | |
89 | win.Connect(-1, -1, wxEVT_CHAR_HOOK, func) | |
90 | ||
91 | def EVT_MENU_HIGHLIGHT(win, id, func): | |
92 | win.Connect(id, -1, wxEVT_MENU_HIGHLIGHT, func) | |
93 | ||
94 | def EVT_MENU_HIGHLIGHT_ALL(win, func): | |
95 | win.Connect(-1, -1, wxEVT_MENU_HIGHLIGHT, func) | |
96 | ||
97 | def EVT_SET_FOCUS(win, func): | |
98 | win.Connect(-1, -1, wxEVT_SET_FOCUS, func) | |
99 | ||
100 | def EVT_KILL_FOCUS(win, func): | |
101 | win.Connect(-1, -1, wxEVT_KILL_FOCUS, func) | |
102 | ||
103 | def EVT_ACTIVATE(win, func): | |
104 | win.Connect(-1, -1, wxEVT_ACTIVATE, func) | |
105 | ||
106 | def EVT_ACTIVATE_APP(win, func): | |
107 | win.Connect(-1, -1, wxEVT_ACTIVATE_APP, func) | |
108 | ||
109 | def EVT_END_SESSION(win, func): | |
110 | win.Connect(-1, -1, wxEVT_END_SESSION, func) | |
111 | ||
112 | def EVT_QUERY_END_SESSION(win, func): | |
113 | win.Connect(-1, -1, wxEVT_QUERY_END_SESSION, func) | |
114 | ||
115 | def EVT_DROP_FILES(win, func): | |
116 | win.Connect(-1, -1, wxEVT_DROP_FILES, func) | |
117 | ||
118 | def EVT_INIT_DIALOG(win, func): | |
119 | win.Connect(-1, -1, wxEVT_INIT_DIALOG, func) | |
120 | ||
121 | def EVT_SYS_COLOUR_CHANGED(win, func): | |
122 | win.Connect(-1, -1, wxEVT_SYS_COLOUR_CHANGED, func) | |
123 | ||
124 | def EVT_SHOW(win, func): | |
125 | win.Connect(-1, -1, wxEVT_SHOW, func) | |
126 | ||
127 | def EVT_MAXIMIZE(win, func): | |
128 | win.Connect(-1, -1, wxEVT_MAXIMIZE, func) | |
129 | ||
130 | def EVT_ICONIZE(win, func): | |
131 | win.Connect(-1, -1, wxEVT_ICONIZE, func) | |
132 | ||
133 | def EVT_NAVIGATION_KEY(win, func): | |
134 | win.Connect(-1, -1, wxEVT_NAVIGATION_KEY, func) | |
135 | ||
136 | ||
137 | # Mouse Events | |
138 | def EVT_LEFT_DOWN(win, func): | |
139 | win.Connect(-1, -1, wxEVT_LEFT_DOWN, func) | |
140 | ||
141 | def EVT_LEFT_UP(win, func): | |
142 | win.Connect(-1, -1, wxEVT_LEFT_UP, func) | |
143 | ||
144 | def EVT_MIDDLE_DOWN(win, func): | |
145 | win.Connect(-1, -1, wxEVT_MIDDLE_DOWN, func) | |
146 | ||
147 | def EVT_MIDDLE_UP(win, func): | |
148 | win.Connect(-1, -1, wxEVT_MIDDLE_UP, func) | |
149 | ||
150 | def EVT_RIGHT_DOWN(win, func): | |
151 | win.Connect(-1, -1, wxEVT_RIGHT_DOWN, func) | |
152 | ||
153 | def EVT_RIGHT_UP(win, func): | |
154 | win.Connect(-1, -1, wxEVT_RIGHT_UP, func) | |
155 | ||
156 | def EVT_MOTION(win, func): | |
157 | win.Connect(-1, -1, wxEVT_MOTION, func) | |
158 | ||
159 | def EVT_LEFT_DCLICK(win, func): | |
160 | win.Connect(-1, -1, wxEVT_LEFT_DCLICK, func) | |
161 | ||
162 | def EVT_MIDDLE_DCLICK(win, func): | |
163 | win.Connect(-1, -1, wxEVT_MIDDLE_DCLICK, func) | |
164 | ||
165 | def EVT_RIGHT_DCLICK(win, func): | |
166 | win.Connect(-1, -1, wxEVT_RIGHT_DCLICK, func) | |
167 | ||
168 | def EVT_LEAVE_WINDOW(win, func): | |
169 | win.Connect(-1, -1, wxEVT_LEAVE_WINDOW, func) | |
170 | ||
171 | def EVT_ENTER_WINDOW(win, func): | |
172 | win.Connect(-1, -1, wxEVT_ENTER_WINDOW, func) | |
173 | ||
174 | ||
175 | # all mouse events | |
176 | def EVT_MOUSE_EVENTS(win, func): | |
177 | win.Connect(-1, -1, wxEVT_LEFT_DOWN, func) | |
178 | win.Connect(-1, -1, wxEVT_LEFT_UP, func) | |
179 | win.Connect(-1, -1, wxEVT_MIDDLE_DOWN, func) | |
180 | win.Connect(-1, -1, wxEVT_MIDDLE_UP, func) | |
181 | win.Connect(-1, -1, wxEVT_RIGHT_DOWN, func) | |
182 | win.Connect(-1, -1, wxEVT_RIGHT_UP, func) | |
183 | win.Connect(-1, -1, wxEVT_MOTION, func) | |
184 | win.Connect(-1, -1, wxEVT_LEFT_DCLICK, func) | |
185 | win.Connect(-1, -1, wxEVT_MIDDLE_DCLICK, func) | |
186 | win.Connect(-1, -1, wxEVT_RIGHT_DCLICK, func) | |
187 | win.Connect(-1, -1, wxEVT_LEAVE_WINDOW, func) | |
188 | win.Connect(-1, -1, wxEVT_ENTER_WINDOW, func) | |
189 | ||
190 | # EVT_COMMAND | |
191 | def EVT_COMMAND(win, id, cmd, func): | |
192 | win.Connect(id, -1, cmd, func) | |
193 | ||
194 | def EVT_COMMAND_RANGE(win, id1, id2, cmd, func): | |
195 | win.Connect(id1, id2, cmd, func) | |
196 | ||
197 | # Scrolling | |
198 | def EVT_SCROLL(win, func): | |
199 | win.Connect(-1, -1, wxEVT_SCROLL_TOP, func) | |
200 | win.Connect(-1, -1, wxEVT_SCROLL_BOTTOM, func) | |
201 | win.Connect(-1, -1, wxEVT_SCROLL_LINEUP, func) | |
202 | win.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN, func) | |
203 | win.Connect(-1, -1, wxEVT_SCROLL_PAGEUP, func) | |
204 | win.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN, func) | |
205 | win.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK,func) | |
206 | ||
207 | def EVT_SCROLL_TOP(win, func): | |
208 | win.Connect(-1, -1, wxEVT_SCROLL_TOP, func) | |
209 | ||
210 | def EVT_SCROLL_BOTTOM(win, func): | |
211 | win.Connect(-1, -1, wxEVT_SCROLL_BOTTOM, func) | |
212 | ||
213 | def EVT_SCROLL_LINEUP(win, func): | |
214 | win.Connect(-1, -1, wxEVT_SCROLL_LINEUP, func) | |
215 | ||
216 | def EVT_SCROLL_LINEDOWN(win, func): | |
217 | win.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN, func) | |
218 | ||
219 | def EVT_SCROLL_PAGEUP(win, func): | |
220 | win.Connect(-1, -1, wxEVT_SCROLL_PAGEUP, func) | |
221 | ||
222 | def EVT_SCROLL_PAGEDOWN(win, func): | |
223 | win.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN, func) | |
224 | ||
225 | def EVT_SCROLL_THUMBTRACK(win, func): | |
226 | win.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK, func) | |
227 | ||
228 | ||
229 | ||
230 | # Scrolling, with an id | |
231 | def EVT_COMMAND_SCROLL(win, id, func): | |
232 | win.Connect(id, -1, wxEVT_SCROLL_TOP, func) | |
233 | win.Connect(id, -1, wxEVT_SCROLL_BOTTOM, func) | |
234 | win.Connect(id, -1, wxEVT_SCROLL_LINEUP, func) | |
235 | win.Connect(id, -1, wxEVT_SCROLL_LINEDOWN, func) | |
236 | win.Connect(id, -1, wxEVT_SCROLL_PAGEUP, func) | |
237 | win.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN, func) | |
238 | win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK,func) | |
239 | ||
240 | def EVT_COMMAND_SCROLL_TOP(win, id, func): | |
241 | win.Connect(id, -1, wxEVT_SCROLL_TOP, func) | |
242 | ||
243 | def EVT_COMMAND_SCROLL_BOTTOM(win, id, func): | |
244 | win.Connect(id, -1, wxEVT_SCROLL_BOTTOM, func) | |
245 | ||
246 | def EVT_COMMAND_SCROLL_LINEUP(win, id, func): | |
247 | win.Connect(id, -1, wxEVT_SCROLL_LINEUP, func) | |
248 | ||
249 | def EVT_COMMAND_SCROLL_LINEDOWN(win, id, func): | |
250 | win.Connect(id, -1, wxEVT_SCROLL_LINEDOWN, func) | |
251 | ||
252 | def EVT_COMMAND_SCROLL_PAGEUP(win, id, func): | |
253 | win.Connect(id, -1, wxEVT_SCROLL_PAGEUP, func) | |
254 | ||
255 | def EVT_COMMAND_SCROLL_PAGEDOWN(win, id, func): | |
256 | win.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN, func) | |
257 | ||
258 | def EVT_COMMAND_SCROLL_THUMBTRACK(win, id, func): | |
259 | win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK, func) | |
260 | ||
261 | ||
262 | # Convenience commands | |
263 | def EVT_BUTTON(win, id, func): | |
264 | win.Connect(id, -1, wxEVT_COMMAND_BUTTON_CLICKED, func) | |
265 | ||
266 | def EVT_CHECKBOX(win, id, func): | |
267 | win.Connect(id, -1, wxEVT_COMMAND_CHECKBOX_CLICKED, func) | |
268 | ||
269 | def EVT_CHOICE(win, id, func): | |
270 | win.Connect(id, -1, wxEVT_COMMAND_CHOICE_SELECTED, func) | |
271 | ||
272 | def EVT_LISTBOX(win, id, func): | |
273 | win.Connect(id, -1, wxEVT_COMMAND_LISTBOX_SELECTED, func) | |
274 | ||
275 | def EVT_LISTBOX_DCLICK(win, id, func): | |
276 | win.Connect(id, -1, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, func) | |
277 | ||
278 | def EVT_TEXT(win, id, func): | |
279 | win.Connect(id, -1, wxEVT_COMMAND_TEXT_UPDATED, func) | |
280 | ||
281 | def EVT_TEXT_ENTER(win, id, func): | |
282 | win.Connect(id, -1, wxEVT_COMMAND_TEXT_ENTER, func) | |
283 | ||
284 | def EVT_MENU(win, id, func): | |
285 | win.Connect(id, -1, wxEVT_COMMAND_MENU_SELECTED, func) | |
286 | ||
287 | def EVT_MENU_RANGE(win, id1, id2, func): | |
288 | win.Connect(id1, id2, wxEVT_COMMAND_MENU_SELECTED, func) | |
289 | ||
290 | def EVT_SLIDER(win, id, func): | |
291 | win.Connect(id, -1, wxEVT_COMMAND_SLIDER_UPDATED, func) | |
292 | ||
293 | def EVT_RADIOBOX(win, id, func): | |
294 | win.Connect(id, -1, wxEVT_COMMAND_RADIOBOX_SELECTED, func) | |
295 | ||
296 | def EVT_RADIOBUTTON(win, id, func): | |
297 | win.Connect(id, -1, wxEVT_COMMAND_RADIOBUTTON_SELECTED, func) | |
298 | ||
299 | def EVT_VLBOX(win, id, func): | |
300 | win.Connect(id, -1, wxEVT_COMMAND_VLBOX_SELECTED, func) | |
301 | ||
302 | def EVT_COMBOBOX(win, id, func): | |
303 | win.Connect(id, -1, wxEVT_COMMAND_COMBOBOX_SELECTED, func) | |
304 | ||
305 | def EVT_TOOL(win, id, func): | |
306 | win.Connect(id, -1, wxEVT_COMMAND_TOOL_CLICKED, func) | |
307 | ||
308 | def EVT_TOOL_RCLICKED(win, id, func): | |
309 | win.Connect(id, -1, wxEVT_COMMAND_TOOL_RCLICKED, func) | |
310 | ||
311 | def EVT_TOOL_ENTER(win, id, func): | |
312 | win.Connect(id, -1, wxEVT_COMMAND_TOOL_ENTER, func) | |
313 | ||
314 | def EVT_CHECKLISTBOX(win, id, func): | |
315 | win.Connect(id, -1, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, func) | |
316 | ||
317 | ||
318 | # Generic command events | |
319 | ||
320 | def EVT_COMMAND_LEFT_CLICK(win, id, func): | |
321 | win.Connect(id, -1, wxEVT_COMMAND_LEFT_CLICK, func) | |
322 | ||
323 | def EVT_COMMAND_LEFT_DCLICK(win, id, func): | |
324 | win.Connect(id, -1, wxEVT_COMMAND_LEFT_DCLICK, func) | |
325 | ||
326 | def EVT_COMMAND_RIGHT_CLICK(win, id, func): | |
327 | win.Connect(id, -1, wxEVT_COMMAND_RIGHT_CLICK, func) | |
328 | ||
329 | def EVT_COMMAND_RIGHT_DCLICK(win, id, func): | |
330 | win.Connect(id, -1, wxEVT_COMMAND_RIGHT_DCLICK, func) | |
331 | ||
332 | def EVT_COMMAND_SET_FOCUS(win, id, func): | |
333 | win.Connect(id, -1, wxEVT_COMMAND_SET_FOCUS, func) | |
334 | ||
335 | def EVT_COMMAND_KILL_FOCUS(win, id, func): | |
336 | win.Connect(id, -1, wxEVT_COMMAND_KILL_FOCUS, func) | |
337 | ||
338 | def EVT_COMMAND_ENTER(win, id, func): | |
339 | win.Connect(id, -1, wxEVT_COMMAND_ENTER, func) | |
340 | ||
341 | ||
342 | # wxNotebook events | |
343 | def EVT_NOTEBOOK_PAGE_CHANGED(win, id, func): | |
344 | win.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, func) | |
345 | ||
346 | def EVT_NOTEBOOK_PAGE_CHANGING(win, id, func): | |
347 | win.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, func) | |
348 | ||
349 | ||
350 | # wxTreeCtrl events | |
351 | def EVT_TREE_BEGIN_DRAG(win, id, func): | |
352 | win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_DRAG, func) | |
353 | ||
354 | def EVT_TREE_BEGIN_RDRAG(win, id, func): | |
355 | win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_RDRAG, func) | |
356 | ||
357 | def EVT_TREE_BEGIN_LABEL_EDIT(win, id, func): | |
358 | win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, func) | |
359 | ||
360 | def EVT_TREE_END_LABEL_EDIT(win, id, func): | |
361 | win.Connect(id, -1, wxEVT_COMMAND_TREE_END_LABEL_EDIT, func) | |
362 | ||
363 | def EVT_TREE_GET_INFO(win, id, func): | |
364 | win.Connect(id, -1, wxEVT_COMMAND_TREE_GET_INFO, func) | |
365 | ||
366 | def EVT_TREE_SET_INFO(win, id, func): | |
367 | win.Connect(id, -1, wxEVT_COMMAND_TREE_SET_INFO, func) | |
368 | ||
369 | def EVT_TREE_ITEM_EXPANDED(win, id, func): | |
370 | win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDED, func) | |
371 | ||
372 | def EVT_TREE_ITEM_EXPANDING(win, id, func): | |
373 | win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDING, func) | |
374 | ||
375 | def EVT_TREE_ITEM_COLLAPSED(win, id, func): | |
376 | win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSED, func) | |
377 | ||
378 | def EVT_TREE_ITEM_COLLAPSING(win, id, func): | |
379 | win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSING, func) | |
380 | ||
381 | def EVT_TREE_SEL_CHANGED(win, id, func): | |
382 | win.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGED, func) | |
383 | ||
384 | def EVT_TREE_SEL_CHANGING(win, id, func): | |
385 | win.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGING, func) | |
386 | ||
387 | def EVT_TREE_KEY_DOWN(win, id, func): | |
388 | win.Connect(id, -1, wxEVT_COMMAND_TREE_KEY_DOWN, func) | |
389 | ||
390 | def EVT_TREE_DELETE_ITEM(win, id, func): | |
391 | win.Connect(id, -1, wxEVT_COMMAND_TREE_DELETE_ITEM, func) | |
392 | ||
393 | ||
394 | # wxSpinButton | |
395 | def EVT_SPIN_UP(win, id, func): | |
396 | win.Connect(id, -1, wxEVT_SCROLL_LINEUP, func) | |
397 | ||
398 | def EVT_SPIN_DOWN(win, id, func): | |
399 | win.Connect(id, -1,wxEVT_SCROLL_LINEDOWN, func) | |
400 | ||
401 | def EVT_SPIN(win, id, func): | |
402 | win.Connect(id, -1, wxEVT_SCROLL_TOP, func) | |
403 | win.Connect(id, -1, wxEVT_SCROLL_BOTTOM, func) | |
404 | win.Connect(id, -1, wxEVT_SCROLL_LINEUP, func) | |
405 | win.Connect(id, -1, wxEVT_SCROLL_LINEDOWN, func) | |
406 | win.Connect(id, -1, wxEVT_SCROLL_PAGEUP, func) | |
407 | win.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN, func) | |
408 | win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK,func) | |
409 | ||
410 | ||
411 | ||
412 | ||
413 | # wxTaskBarIcon | |
414 | def EVT_TASKBAR_MOVE(win, func): | |
415 | win.Connect(-1, -1, wxEVT_TASKBAR_MOVE, func) | |
416 | ||
417 | def EVT_TASKBAR_LEFT_DOWN(win, func): | |
418 | win.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DOWN, func) | |
419 | ||
420 | def EVT_TASKBAR_LEFT_UP(win, func): | |
421 | win.Connect(-1, -1, wxEVT_TASKBAR_LEFT_UP, func) | |
422 | ||
423 | def EVT_TASKBAR_RIGHT_DOWN(win, func): | |
424 | win.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DOWN, func) | |
425 | ||
426 | def EVT_TASKBAR_RIGHT_UP(win, func): | |
427 | win.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_UP, func) | |
428 | ||
429 | def EVT_TASKBAR_LEFT_DCLICK(win, func): | |
430 | win.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DCLICK, func) | |
431 | ||
432 | def EVT_TASKBAR_RIGHT_DCLICK(win, func): | |
433 | win.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DCLICK, func) | |
434 | ||
435 | ||
436 | # wxGrid | |
437 | def EVT_GRID_SELECT_CELL(win, fn): | |
438 | win.Connect(-1, -1, wxEVT_GRID_SELECT_CELL, fn) | |
439 | ||
440 | def EVT_GRID_CREATE_CELL(win, fn): | |
441 | win.Connect(-1, -1, wxEVT_GRID_CREATE_CELL, fn) | |
442 | ||
443 | def EVT_GRID_CHANGE_LABELS(win, fn): | |
444 | win.Connect(-1, -1, wxEVT_GRID_CHANGE_LABELS, fn) | |
445 | ||
446 | def EVT_GRID_CHANGE_SEL_LABEL(win, fn): | |
447 | win.Connect(-1, -1, wxEVT_GRID_CHANGE_SEL_LABEL, fn) | |
448 | ||
449 | def EVT_GRID_CELL_CHANGE(win, fn): | |
450 | win.Connect(-1, -1, wxEVT_GRID_CELL_CHANGE, fn) | |
451 | ||
452 | def EVT_GRID_CELL_LCLICK(win, fn): | |
453 | win.Connect(-1, -1, wxEVT_GRID_CELL_LCLICK, fn) | |
454 | ||
455 | def EVT_GRID_CELL_RCLICK(win, fn): | |
456 | win.Connect(-1, -1, wxEVT_GRID_CELL_RCLICK, fn) | |
457 | ||
458 | def EVT_GRID_LABEL_LCLICK(win, fn): | |
459 | win.Connect(-1, -1, wxEVT_GRID_LABEL_LCLICK, fn) | |
460 | ||
461 | def EVT_GRID_LABEL_RCLICK(win, fn): | |
462 | win.Connect(-1, -1, wxEVT_GRID_LABEL_RCLICK, fn) | |
463 | ||
464 | ||
465 | # wxSashWindow | |
466 | def EVT_SASH_DRAGGED(win, id, func): | |
467 | win.Connect(id, -1, wxEVT_SASH_DRAGGED, func) | |
468 | ||
469 | def EVT_SASH_DRAGGED_RANGE(win, id1, id2, func): | |
470 | win.Connect(id1, id2, wxEVT_SASH_DRAGGED, func) | |
471 | ||
472 | def EVT_QUERY_LAYOUT_INFO(win, func): | |
473 | win.Connect(-1, -1, wxEVT_EVT_QUERY_LAYOUT_INFO, func) | |
474 | ||
475 | def EVT_CALCULATE_LAYOUT(win, func): | |
476 | win.Connect(-1, -1, wxEVT_EVT_CALCULATE_LAYOUT, func) | |
477 | ||
478 | ||
479 | # wxListCtrl | |
480 | def EVT_LIST_BEGIN_DRAG(win, id, func): | |
481 | win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_DRAG, func) | |
482 | ||
483 | def EVT_LIST_BEGIN_RDRAG(win, id, func): | |
484 | win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_RDRAG, func) | |
485 | ||
486 | def EVT_LIST_BEGIN_LABEL_EDIT(win, id, func): | |
487 | win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, func) | |
488 | ||
489 | def EVT_LIST_END_LABEL_EDIT(win, id, func): | |
490 | win.Connect(id, -1, wxEVT_COMMAND_LIST_END_LABEL_EDIT, func) | |
491 | ||
492 | def EVT_LIST_DELETE_ITEM(win, id, func): | |
493 | win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ITEM, func) | |
494 | ||
495 | def EVT_LIST_DELETE_ALL_ITEMS(win, id, func): | |
496 | win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, func) | |
497 | ||
498 | def EVT_LIST_GET_INFO(win, id, func): | |
499 | win.Connect(id, -1, wxEVT_COMMAND_LIST_GET_INFO, func) | |
500 | ||
501 | def EVT_LIST_SET_INFO(win, id, func): | |
502 | win.Connect(id, -1, wxEVT_COMMAND_LIST_SET_INFO, func) | |
503 | ||
504 | def EVT_LIST_ITEM_SELECTED(win, id, func): | |
505 | win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED, func) | |
506 | ||
507 | def EVT_LIST_ITEM_DESELECTED(win, id, func): | |
508 | win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_DESELECTED, func) | |
509 | ||
510 | def EVT_LIST_KEY_DOWN(win, id, func): | |
511 | win.Connect(id, -1, wxEVT_COMMAND_LIST_KEY_DOWN, func) | |
512 | ||
513 | def EVT_LIST_INSERT_ITEM(win, id, func): | |
514 | win.Connect(id, -1, wxEVT_COMMAND_LIST_INSERT_ITEM, func) | |
515 | ||
516 | def EVT_LIST_COL_CLICK(win, id, func): | |
517 | win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK, func) | |
518 | ||
519 | ||
520 | #---------------------------------------------------------------------- | |
521 | ||
522 | class wxTimer(wxPyTimer): | |
523 | def __init__(self): | |
524 | wxPyTimer.__init__(self, self.Notify) # derived class must provide | |
525 | # Notify(self) method. | |
526 | ||
527 | #---------------------------------------------------------------------- | |
528 | # Some wxWin methods can take "NULL" as parameters, but the shadow classes | |
529 | # expect an object with the SWIG pointer as a 'this' member. This class | |
530 | # and instance fools the shadow into passing the NULL pointer. | |
531 | ||
532 | class NullObj: | |
533 | this = 'NULL' # SWIG converts this to (void*)0 | |
534 | ||
535 | NULL = NullObj() | |
536 | ||
537 | ||
538 | #---------------------------------------------------------------------- | |
539 | # aliases | |
540 | ||
541 | wxColor = wxColour | |
542 | wxNamedColor = wxNamedColour | |
543 | ||
544 | wxPyDefaultPosition.Set(-1,-1) | |
545 | wxPyDefaultSize.Set(-1,-1) | |
546 | ||
547 | # aliases so that C++ documentation applies: | |
548 | wxDefaultPosition = wxPyDefaultPosition | |
549 | wxDefaultSize = wxPyDefaultSize | |
550 | ||
551 | ||
552 | # This is to cover up a bug in SWIG. We are redefining | |
553 | # the shadow class that is generated for wxAcceleratorTable | |
554 | # because SWIG incorrectly uses "arg0.this" | |
555 | class wxAcceleratorTable(wxAcceleratorTablePtr): | |
556 | def __init__(self,arg0) : | |
557 | self.this = miscc.new_wxAcceleratorTable(arg0) | |
558 | self.thisown = 1 | |
559 | ||
560 | #---------------------------------------------------------------------- | |
561 | ||
562 | ## class wxPyStdOutWindow(wxFrame): | |
563 | ## def __init__(self, title = "wxPython: stdout/stderr"): | |
564 | ## wxFrame.__init__(self, NULL, title) | |
565 | ## self.title = title | |
566 | ## self.text = wxTextWindow(self) | |
567 | ## self.text.SetFont(wxFont(10, wxMODERN, wxNORMAL, wxBOLD)) | |
568 | ## self.SetSize(-1,-1,400,200) | |
569 | ## self.Show(false) | |
570 | ## self.isShown = false | |
571 | ||
572 | ## def write(self, str): # with this method, | |
573 | ## if not self.isShown: | |
574 | ## self.Show(true) | |
575 | ## self.isShown = true | |
576 | ## self.text.WriteText(str) | |
577 | ||
578 | ## def OnCloseWindow(self, event): # doesn't allow the window to close, just hides it | |
579 | ## self.Show(false) | |
580 | ## self.isShown = false | |
581 | ||
582 | ||
583 | _defRedirect = (wxPlatform == '__WXMSW__') | |
584 | ||
585 | #---------------------------------------------------------------------- | |
586 | # The main application class. Derive from this and implement an OnInit | |
587 | # method that creates a frame and then calls self.SetTopWindow(frame) | |
588 | ||
589 | class wxApp(wxPyApp): | |
590 | error = 'wxApp.error' | |
591 | ||
592 | def __init__(self, redirect=_defRedirect, filename=None): | |
593 | wxPyApp.__init__(self) | |
594 | self.stdioWin = None | |
595 | self.saveStdio = (sys.stdout, sys.stderr) | |
596 | if redirect: | |
597 | self.RedirectStdio(filename) | |
598 | ||
599 | # this initializes wxWindows and then calls our OnInit | |
600 | _wxStart(self.OnInit) | |
601 | ||
602 | ||
603 | def __del__(self): | |
604 | try: | |
605 | self.RestoreStdio() | |
606 | except: | |
607 | pass | |
608 | ||
609 | def RedirectStdio(self, filename): | |
610 | if filename: | |
611 | sys.stdout = sys.stderr = open(filename, 'a') | |
612 | else: | |
613 | raise self.error, 'wxPyStdOutWindow not yet implemented.' | |
614 | #self.stdioWin = sys.stdout = sys.stderr = wxPyStdOutWindow() | |
615 | ||
616 | def RestoreStdio(self): | |
617 | sys.stdout, sys.stderr = self.saveStdio | |
618 | if self.stdioWin != None: | |
619 | self.stdioWin.Show(false) | |
620 | self.stdioWin.Destroy() | |
621 | self.stdioWin = None | |
622 | ||
623 | ||
624 | #---------------------------------------------------------------------------- | |
625 | # | |
626 | # $Log$ | |
627 | # Revision 1.11 1999/02/20 09:02:55 RD | |
628 | # Added wxWindow_FromHWND(hWnd) for wxMSW to construct a wxWindow from a | |
629 | # window handle. If you can get the window handle into the python code, | |
630 | # it should just work... More news on this later. | |
631 | # | |
632 | # Added wxImageList, wxToolTip. | |
633 | # | |
634 | # Re-enabled wxConfig.DeleteAll() since it is reportedly fixed for the | |
635 | # wxRegConfig class. | |
636 | # | |
637 | # As usual, some bug fixes, tweaks, etc. | |
638 | # | |
639 | # Revision 1.10 1999/02/01 00:10:39 RD | |
640 | # | |
641 | # Added the missing EVT_LIST_ITEM_SELECTED and friends. | |
642 | # | |
643 | # Revision 1.9 1999/01/30 07:30:09 RD | |
644 | # | |
645 | # Added wxSashWindow, wxSashEvent, wxLayoutAlgorithm, etc. | |
646 | # | |
647 | # Various cleanup, tweaks, minor additions, etc. to maintain | |
648 | # compatibility with the current wxWindows. | |
649 | # | |
650 | # Revision 1.8 1999/01/29 21:13:42 HH | |
651 | # Added aliases for wxDefaultPosition and wxDefaultSize (from wxPy..) in _extras, | |
652 | # so that C++ documentation applies. | |
653 | # | |
654 | # Revision 1.7 1998/11/25 08:45:21 RD | |
655 | # | |
656 | # Added wxPalette, wxRegion, wxRegionIterator, wxTaskbarIcon | |
657 | # Added events for wxGrid | |
658 | # Other various fixes and additions | |
659 | # | |
660 | # Revision 1.6 1998/11/16 00:00:52 RD | |
661 | # Generic treectrl for wxPython/GTK compiles... | |
662 | # | |
663 | # Revision 1.5 1998/10/20 07:38:02 RD | |
664 | # bug fix | |
665 | # | |
666 | # Revision 1.4 1998/10/20 06:43:54 RD | |
667 | # New wxTreeCtrl wrappers (untested) | |
668 | # some changes in helpers | |
669 | # etc. | |
670 | # | |
671 | # Revision 1.3 1998/10/02 06:40:33 RD | |
672 | # | |
673 | # Version 0.4 of wxPython for MSW. | |
674 | # | |
675 | # Revision 1.2 1998/08/18 19:48:12 RD | |
676 | # more wxGTK compatibility things. | |
677 | # | |
678 | # It builds now but there are serious runtime problems... | |
679 | # | |
680 | # Revision 1.1 1998/08/09 08:25:49 RD | |
681 | # Initial version | |
682 | # | |
683 | # | |
684 |