1 #----------------------------------------------------------------------------
3 # Purpose: This file is appended to the shadow class file generated
4 # by SWIG. We add some unSWIGable things here.
10 # Copyright: (c) 1998 by Total Control Software
11 # Licence: wxWindows license
12 #----------------------------------------------------------------------------
16 #----------------------------------------------------------------------
17 # This gives this module's dictionary to the C++ extension code...
19 _wxSetDictionary(vars())
22 #----------------------------------------------------------------------
23 #----------------------------------------------------------------------
24 # Helper function to link python methods to wxWindows virtual
27 def _checkForCallback(obj
, name
, event
, theID
=-1):
28 try: cb
= getattr(obj
, name
)
30 else: obj
.Connect(theID
, -1, event
, cb
)
33 #----------------------------------------------------------------------
34 #----------------------------------------------------------------------
35 # functions that look and act like the C++ Macros of the same name
39 def EVT_SIZE(win
, func
):
40 win
.Connect(-1, -1, wxEVT_SIZE
, func
)
42 def EVT_MOVE(win
, func
):
43 win
.Connect(-1, -1, wxEVT_MOVE
, func
)
45 def EVT_CLOSE(win
, func
):
46 win
.Connect(-1, -1, wxEVT_CLOSE_WINDOW
, func
)
48 def EVT_PAINT(win
, func
):
49 win
.Connect(-1, -1, wxEVT_PAINT
, func
)
51 def EVT_ERASE_BACKGROUND(win
, func
):
52 win
.Connect(-1, -1, wxEVT_ERASE_BACKGROUND
, func
)
54 def EVT_CHAR(win
, func
):
55 win
.Connect(-1, -1, wxEVT_CHAR
, func
)
57 def EVT_CHAR_HOOK(win
, func
):
58 win
.Connect(-1, -1, wxEVT_CHAR_HOOK
, func
)
60 def EVT_KEY_DOWN(win
, func
):
61 win
.Connect(-1, -1, wxEVT_KEY_DOWN
, func
)
63 def EVT_KEY_UP(win
, func
):
64 win
.Connect(-1, -1, wxEVT_KEY_UP
, func
)
66 def EVT_MENU_HIGHLIGHT(win
, id, func
):
67 win
.Connect(id, -1, wxEVT_MENU_HIGHLIGHT
, func
)
69 def EVT_MENU_HIGHLIGHT_ALL(win
, func
):
70 win
.Connect(-1, -1, wxEVT_MENU_HIGHLIGHT
, func
)
72 def EVT_SET_FOCUS(win
, func
):
73 win
.Connect(-1, -1, wxEVT_SET_FOCUS
, func
)
75 def EVT_KILL_FOCUS(win
, func
):
76 win
.Connect(-1, -1, wxEVT_KILL_FOCUS
, func
)
78 def EVT_ACTIVATE(win
, func
):
79 win
.Connect(-1, -1, wxEVT_ACTIVATE
, func
)
81 def EVT_ACTIVATE_APP(win
, func
):
82 win
.Connect(-1, -1, wxEVT_ACTIVATE_APP
, func
)
84 def EVT_END_SESSION(win
, func
):
85 win
.Connect(-1, -1, wxEVT_END_SESSION
, func
)
87 def EVT_QUERY_END_SESSION(win
, func
):
88 win
.Connect(-1, -1, wxEVT_QUERY_END_SESSION
, func
)
90 def EVT_DROP_FILES(win
, func
):
91 win
.Connect(-1, -1, wxEVT_DROP_FILES
, func
)
93 def EVT_INIT_DIALOG(win
, func
):
94 win
.Connect(-1, -1, wxEVT_INIT_DIALOG
, func
)
96 def EVT_SYS_COLOUR_CHANGED(win
, func
):
97 win
.Connect(-1, -1, wxEVT_SYS_COLOUR_CHANGED
, func
)
99 def EVT_SHOW(win
, func
):
100 win
.Connect(-1, -1, wxEVT_SHOW
, func
)
102 def EVT_MAXIMIZE(win
, func
):
103 win
.Connect(-1, -1, wxEVT_MAXIMIZE
, func
)
105 def EVT_ICONIZE(win
, func
):
106 win
.Connect(-1, -1, wxEVT_ICONIZE
, func
)
108 def EVT_NAVIGATION_KEY(win
, func
):
109 win
.Connect(-1, -1, wxEVT_NAVIGATION_KEY
, func
)
111 def EVT_PALETTE_CHANGED(win
, func
):
112 win
.Connect(-1, -1, wxEVT_PALETTE_CHANGED
, func
)
114 def EVT_QUERY_NEW_PALETTE(win
, func
):
115 win
.Connect(-1, -1, wxEVT_QUERY_NEW_PALETTE
, func
)
117 def EVT_WINDOW_CREATE(win
, func
):
118 win
.Connect(-1, -1, wxEVT_CREATE
, func
)
120 def EVT_WINDOW_DESTROY(win
, func
):
121 win
.Connect(-1, -1, wxEVT_DESTROY
, func
)
125 def EVT_IDLE(win
, func
):
126 win
.Connect(-1, -1, wxEVT_IDLE
, func
)
128 def EVT_UPDATE_UI(win
, id, func
):
129 win
.Connect(id, -1, wxEVT_UPDATE_UI
, func
)
131 def EVT_UPDATE_UI_RANGE(win
, id, id2
, func
):
132 win
.Connect(id, id2
, wxEVT_UPDATE_UI
, func
)
136 def EVT_LEFT_DOWN(win
, func
):
137 win
.Connect(-1, -1, wxEVT_LEFT_DOWN
, func
)
139 def EVT_LEFT_UP(win
, func
):
140 win
.Connect(-1, -1, wxEVT_LEFT_UP
, func
)
142 def EVT_MIDDLE_DOWN(win
, func
):
143 win
.Connect(-1, -1, wxEVT_MIDDLE_DOWN
, func
)
145 def EVT_MIDDLE_UP(win
, func
):
146 win
.Connect(-1, -1, wxEVT_MIDDLE_UP
, func
)
148 def EVT_RIGHT_DOWN(win
, func
):
149 win
.Connect(-1, -1, wxEVT_RIGHT_DOWN
, func
)
151 def EVT_RIGHT_UP(win
, func
):
152 win
.Connect(-1, -1, wxEVT_RIGHT_UP
, func
)
154 def EVT_MOTION(win
, func
):
155 win
.Connect(-1, -1, wxEVT_MOTION
, func
)
157 def EVT_LEFT_DCLICK(win
, func
):
158 win
.Connect(-1, -1, wxEVT_LEFT_DCLICK
, func
)
160 def EVT_MIDDLE_DCLICK(win
, func
):
161 win
.Connect(-1, -1, wxEVT_MIDDLE_DCLICK
, func
)
163 def EVT_RIGHT_DCLICK(win
, func
):
164 win
.Connect(-1, -1, wxEVT_RIGHT_DCLICK
, func
)
166 def EVT_LEAVE_WINDOW(win
, func
):
167 win
.Connect(-1, -1, wxEVT_LEAVE_WINDOW
, func
)
169 def EVT_ENTER_WINDOW(win
, func
):
170 win
.Connect(-1, -1, wxEVT_ENTER_WINDOW
, func
)
172 def EVT_MOUSEWHEEL(win
, func
):
173 win
.Connect(-1, -1, wxEVT_MOUSEWHEEL
, func
)
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
)
191 def EVT_COMMAND(win
, id, cmd
, func
):
192 win
.Connect(id, -1, cmd
, func
)
194 def EVT_COMMAND_RANGE(win
, id1
, id2
, cmd
, func
):
195 win
.Connect(id1
, id2
, cmd
, func
)
199 def EVT_SCROLL(win
, func
):
200 win
.Connect(-1, -1, wxEVT_SCROLL_TOP
, func
)
201 win
.Connect(-1, -1, wxEVT_SCROLL_BOTTOM
, func
)
202 win
.Connect(-1, -1, wxEVT_SCROLL_LINEUP
, func
)
203 win
.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN
, func
)
204 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEUP
, func
)
205 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
206 win
.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK
,func
)
207 win
.Connect(-1, -1, wxEVT_SCROLL_THUMBRELEASE
,func
)
209 def EVT_SCROLL_TOP(win
, func
):
210 win
.Connect(-1, -1, wxEVT_SCROLL_TOP
, func
)
212 def EVT_SCROLL_BOTTOM(win
, func
):
213 win
.Connect(-1, -1, wxEVT_SCROLL_BOTTOM
, func
)
215 def EVT_SCROLL_LINEUP(win
, func
):
216 win
.Connect(-1, -1, wxEVT_SCROLL_LINEUP
, func
)
218 def EVT_SCROLL_LINEDOWN(win
, func
):
219 win
.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN
, func
)
221 def EVT_SCROLL_PAGEUP(win
, func
):
222 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEUP
, func
)
224 def EVT_SCROLL_PAGEDOWN(win
, func
):
225 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
227 def EVT_SCROLL_THUMBTRACK(win
, func
):
228 win
.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK
, func
)
230 def EVT_SCROLL_THUMBRELEASE(win
, func
):
231 win
.Connect(-1, -1, wxEVT_SCROLL_THUMBRELEASE
, func
)
235 # Scrolling, with an id
236 def EVT_COMMAND_SCROLL(win
, id, func
):
237 win
.Connect(id, -1, wxEVT_SCROLL_TOP
, func
)
238 win
.Connect(id, -1, wxEVT_SCROLL_BOTTOM
, func
)
239 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
240 win
.Connect(id, -1, wxEVT_SCROLL_LINEDOWN
, func
)
241 win
.Connect(id, -1, wxEVT_SCROLL_PAGEUP
, func
)
242 win
.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
243 win
.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK
,func
)
244 win
.Connect(id, -1, wxEVT_SCROLL_THUMBRELEASE
,func
)
246 def EVT_COMMAND_SCROLL_TOP(win
, id, func
):
247 win
.Connect(id, -1, wxEVT_SCROLL_TOP
, func
)
249 def EVT_COMMAND_SCROLL_BOTTOM(win
, id, func
):
250 win
.Connect(id, -1, wxEVT_SCROLL_BOTTOM
, func
)
252 def EVT_COMMAND_SCROLL_LINEUP(win
, id, func
):
253 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
255 def EVT_COMMAND_SCROLL_LINEDOWN(win
, id, func
):
256 win
.Connect(id, -1, wxEVT_SCROLL_LINEDOWN
, func
)
258 def EVT_COMMAND_SCROLL_PAGEUP(win
, id, func
):
259 win
.Connect(id, -1, wxEVT_SCROLL_PAGEUP
, func
)
261 def EVT_COMMAND_SCROLL_PAGEDOWN(win
, id, func
):
262 win
.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
264 def EVT_COMMAND_SCROLL_THUMBTRACK(win
, id, func
):
265 win
.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK
, func
)
267 def EVT_COMMAND_SCROLL_THUMBRELEASE(win
, id, func
):
268 win
.Connect(id, -1, wxEVT_SCROLL_THUMBRELEASE
, func
)
271 def EVT_SCROLLWIN(win
, func
):
272 win
.Connect(-1, -1, wxEVT_SCROLLWIN_TOP
, func
)
273 win
.Connect(-1, -1, wxEVT_SCROLLWIN_BOTTOM
, func
)
274 win
.Connect(-1, -1, wxEVT_SCROLLWIN_LINEUP
, func
)
275 win
.Connect(-1, -1, wxEVT_SCROLLWIN_LINEDOWN
, func
)
276 win
.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEUP
, func
)
277 win
.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEDOWN
, func
)
278 win
.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBTRACK
, func
)
279 win
.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBRELEASE
,func
)
281 def EVT_SCROLLWIN_TOP(win
, func
):
282 win
.Connect(-1, -1, wxEVT_SCROLLWIN_TOP
, func
)
284 def EVT_SCROLLWIN_BOTTOM(win
, func
):
285 win
.Connect(-1, -1, wxEVT_SCROLLWIN_BOTTOM
, func
)
287 def EVT_SCROLLWIN_LINEUP(win
, func
):
288 win
.Connect(-1, -1, wxEVT_SCROLLWIN_LINEUP
, func
)
290 def EVT_SCROLLWIN_LINEDOWN(win
, func
):
291 win
.Connect(-1, -1, wxEVT_SCROLLWIN_LINEDOWN
, func
)
293 def EVT_SCROLLWIN_PAGEUP(win
, func
):
294 win
.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEUP
, func
)
296 def EVT_SCROLLWIN_PAGEDOWN(win
, func
):
297 win
.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEDOWN
, func
)
299 def EVT_SCROLLWIN_THUMBTRACK(win
, func
):
300 win
.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBTRACK
, func
)
302 def EVT_SCROLLWIN_THUMBRELEASE(win
, func
):
303 win
.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBRELEASE
, func
)
307 # Scrolling, with an id
308 def EVT_COMMAND_SCROLLWIN(win
, id, func
):
309 win
.Connect(id, -1, wxEVT_SCROLLWIN_TOP
, func
)
310 win
.Connect(id, -1, wxEVT_SCROLLWIN_BOTTOM
, func
)
311 win
.Connect(id, -1, wxEVT_SCROLLWIN_LINEUP
, func
)
312 win
.Connect(id, -1, wxEVT_SCROLLWIN_LINEDOWN
, func
)
313 win
.Connect(id, -1, wxEVT_SCROLLWIN_PAGEUP
, func
)
314 win
.Connect(id, -1, wxEVT_SCROLLWIN_PAGEDOWN
, func
)
315 win
.Connect(id, -1, wxEVT_SCROLLWIN_THUMBTRACK
, func
)
316 win
.Connect(id, -1, wxEVT_SCROLLWIN_THUMBRELEASE
,func
)
318 def EVT_COMMAND_SCROLLWIN_TOP(win
, id, func
):
319 win
.Connect(id, -1, wxEVT_SCROLLWIN_TOP
, func
)
321 def EVT_COMMAND_SCROLLWIN_BOTTOM(win
, id, func
):
322 win
.Connect(id, -1, wxEVT_SCROLLWIN_BOTTOM
, func
)
324 def EVT_COMMAND_SCROLLWIN_LINEUP(win
, id, func
):
325 win
.Connect(id, -1, wxEVT_SCROLLWIN_LINEUP
, func
)
327 def EVT_COMMAND_SCROLLWIN_LINEDOWN(win
, id, func
):
328 win
.Connect(id, -1, wxEVT_SCROLLWIN_LINEDOWN
, func
)
330 def EVT_COMMAND_SCROLLWIN_PAGEUP(win
, id, func
):
331 win
.Connect(id, -1, wxEVT_SCROLLWIN_PAGEUP
, func
)
333 def EVT_COMMAND_SCROLLWIN_PAGEDOWN(win
, id, func
):
334 win
.Connect(id, -1, wxEVT_SCROLLWIN_PAGEDOWN
, func
)
336 def EVT_COMMAND_SCROLLWIN_THUMBTRACK(win
, id, func
):
337 win
.Connect(id, -1, wxEVT_SCROLLWIN_THUMBTRACK
, func
)
339 def EVT_COMMAND_SCROLLWIN_THUMBRELEASE(win
, id, func
):
340 win
.Connect(id, -1, wxEVT_SCROLLWIN_THUMBRELEASE
, func
)
343 # Convenience commands
344 def EVT_BUTTON(win
, id, func
):
345 win
.Connect(id, -1, wxEVT_COMMAND_BUTTON_CLICKED
, func
)
347 def EVT_CHECKBOX(win
, id, func
):
348 win
.Connect(id, -1, wxEVT_COMMAND_CHECKBOX_CLICKED
, func
)
350 def EVT_CHOICE(win
, id, func
):
351 win
.Connect(id, -1, wxEVT_COMMAND_CHOICE_SELECTED
, func
)
353 def EVT_LISTBOX(win
, id, func
):
354 win
.Connect(id, -1, wxEVT_COMMAND_LISTBOX_SELECTED
, func
)
356 def EVT_LISTBOX_DCLICK(win
, id, func
):
357 win
.Connect(id, -1, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
, func
)
359 def EVT_TEXT(win
, id, func
):
360 win
.Connect(id, -1, wxEVT_COMMAND_TEXT_UPDATED
, func
)
362 def EVT_TEXT_ENTER(win
, id, func
):
363 win
.Connect(id, -1, wxEVT_COMMAND_TEXT_ENTER
, func
)
365 def EVT_MENU(win
, id, func
):
366 win
.Connect(id, -1, wxEVT_COMMAND_MENU_SELECTED
, func
)
368 def EVT_MENU_RANGE(win
, id1
, id2
, func
):
369 win
.Connect(id1
, id2
, wxEVT_COMMAND_MENU_SELECTED
, func
)
371 def EVT_SLIDER(win
, id, func
):
372 win
.Connect(id, -1, wxEVT_COMMAND_SLIDER_UPDATED
, func
)
374 def EVT_RADIOBOX(win
, id, func
):
375 win
.Connect(id, -1, wxEVT_COMMAND_RADIOBOX_SELECTED
, func
)
377 def EVT_RADIOBUTTON(win
, id, func
):
378 win
.Connect(id, -1, wxEVT_COMMAND_RADIOBUTTON_SELECTED
, func
)
380 def EVT_VLBOX(win
, id, func
):
381 win
.Connect(id, -1, wxEVT_COMMAND_VLBOX_SELECTED
, func
)
383 def EVT_COMBOBOX(win
, id, func
):
384 win
.Connect(id, -1, wxEVT_COMMAND_COMBOBOX_SELECTED
, func
)
386 def EVT_TOOL(win
, id, func
):
387 win
.Connect(id, -1, wxEVT_COMMAND_TOOL_CLICKED
, func
)
389 def EVT_TOOL_RANGE(win
, id, id2
, func
):
390 win
.Connect(id, id2
, wxEVT_COMMAND_TOOL_CLICKED
, func
)
392 def EVT_TOOL_RCLICKED(win
, id, func
):
393 win
.Connect(id, -1, wxEVT_COMMAND_TOOL_RCLICKED
, func
)
395 def EVT_TOOL_RCLICKED_RANGE(win
, id, id2
, func
):
396 win
.Connect(id, id2
, wxEVT_COMMAND_TOOL_RCLICKED
, func
)
398 def EVT_TOOL_ENTER(win
, id, func
):
399 win
.Connect(id, -1, wxEVT_COMMAND_TOOL_ENTER
, func
)
401 def EVT_CHECKLISTBOX(win
, id, func
):
402 win
.Connect(id, -1, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
, func
)
404 def EVT_SPINCTRL(win
, id, func
):
405 win
.Connect(id, -1, wxEVT_COMMAND_SPINCTRL_UPDATED
, func
)
409 # Generic command events
411 def EVT_COMMAND_LEFT_CLICK(win
, id, func
):
412 win
.Connect(id, -1, wxEVT_COMMAND_LEFT_CLICK
, func
)
414 def EVT_COMMAND_LEFT_DCLICK(win
, id, func
):
415 win
.Connect(id, -1, wxEVT_COMMAND_LEFT_DCLICK
, func
)
417 def EVT_COMMAND_RIGHT_CLICK(win
, id, func
):
418 win
.Connect(id, -1, wxEVT_COMMAND_RIGHT_CLICK
, func
)
420 def EVT_COMMAND_RIGHT_DCLICK(win
, id, func
):
421 win
.Connect(id, -1, wxEVT_COMMAND_RIGHT_DCLICK
, func
)
423 def EVT_COMMAND_SET_FOCUS(win
, id, func
):
424 win
.Connect(id, -1, wxEVT_COMMAND_SET_FOCUS
, func
)
426 def EVT_COMMAND_KILL_FOCUS(win
, id, func
):
427 win
.Connect(id, -1, wxEVT_COMMAND_KILL_FOCUS
, func
)
429 def EVT_COMMAND_ENTER(win
, id, func
):
430 win
.Connect(id, -1, wxEVT_COMMAND_ENTER
, func
)
434 def EVT_NOTEBOOK_PAGE_CHANGED(win
, id, func
):
435 win
.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
, func
)
437 def EVT_NOTEBOOK_PAGE_CHANGING(win
, id, func
):
438 win
.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
, func
)
442 def EVT_TREE_BEGIN_DRAG(win
, id, func
):
443 win
.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_DRAG
, func
)
445 def EVT_TREE_BEGIN_RDRAG(win
, id, func
):
446 win
.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_RDRAG
, func
)
448 def EVT_TREE_END_DRAG(win
, id, func
):
449 win
.Connect(id, -1, wxEVT_COMMAND_TREE_END_DRAG
, func
)
451 def EVT_TREE_BEGIN_LABEL_EDIT(win
, id, func
):
452 win
.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT
, func
)
454 def EVT_TREE_END_LABEL_EDIT(win
, id, func
):
455 win
.Connect(id, -1, wxEVT_COMMAND_TREE_END_LABEL_EDIT
, func
)
457 def EVT_TREE_GET_INFO(win
, id, func
):
458 win
.Connect(id, -1, wxEVT_COMMAND_TREE_GET_INFO
, func
)
460 def EVT_TREE_SET_INFO(win
, id, func
):
461 win
.Connect(id, -1, wxEVT_COMMAND_TREE_SET_INFO
, func
)
463 def EVT_TREE_ITEM_EXPANDED(win
, id, func
):
464 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDED
, func
)
466 def EVT_TREE_ITEM_EXPANDING(win
, id, func
):
467 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDING
, func
)
469 def EVT_TREE_ITEM_COLLAPSED(win
, id, func
):
470 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSED
, func
)
472 def EVT_TREE_ITEM_COLLAPSING(win
, id, func
):
473 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSING
, func
)
475 def EVT_TREE_SEL_CHANGED(win
, id, func
):
476 win
.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGED
, func
)
478 def EVT_TREE_SEL_CHANGING(win
, id, func
):
479 win
.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGING
, func
)
481 def EVT_TREE_KEY_DOWN(win
, id, func
):
482 win
.Connect(id, -1, wxEVT_COMMAND_TREE_KEY_DOWN
, func
)
484 def EVT_TREE_DELETE_ITEM(win
, id, func
):
485 win
.Connect(id, -1, wxEVT_COMMAND_TREE_DELETE_ITEM
, func
)
487 def EVT_TREE_ITEM_ACTIVATED(win
, id, func
):
488 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_ACTIVATED
, func
)
490 def EVT_TREE_ITEM_RIGHT_CLICK(win
, id, func
):
491 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK
, func
)
493 def EVT_TREE_ITEM_MIDDLE_CLICK(win
, id, func
):
494 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK
, func
)
498 def EVT_SPIN_UP(win
, id, func
):
499 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
501 def EVT_SPIN_DOWN(win
, id, func
):
502 win
.Connect(id, -1, wxEVT_SCROLL_LINEDOWN
, func
)
504 def EVT_SPIN(win
, id, func
):
505 win
.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK
,func
)
511 def EVT_TASKBAR_MOVE(win
, func
):
512 win
.Connect(-1, -1, wxEVT_TASKBAR_MOVE
, func
)
514 def EVT_TASKBAR_LEFT_DOWN(win
, func
):
515 win
.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DOWN
, func
)
517 def EVT_TASKBAR_LEFT_UP(win
, func
):
518 win
.Connect(-1, -1, wxEVT_TASKBAR_LEFT_UP
, func
)
520 def EVT_TASKBAR_RIGHT_DOWN(win
, func
):
521 win
.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DOWN
, func
)
523 def EVT_TASKBAR_RIGHT_UP(win
, func
):
524 win
.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_UP
, func
)
526 def EVT_TASKBAR_LEFT_DCLICK(win
, func
):
527 win
.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DCLICK
, func
)
529 def EVT_TASKBAR_RIGHT_DCLICK(win
, func
):
530 win
.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DCLICK
, func
)
534 def EVT_SASH_DRAGGED(win
, id, func
):
535 win
.Connect(id, -1, wxEVT_SASH_DRAGGED
, func
)
537 def EVT_SASH_DRAGGED_RANGE(win
, id1
, id2
, func
):
538 win
.Connect(id1
, id2
, wxEVT_SASH_DRAGGED
, func
)
540 def EVT_QUERY_LAYOUT_INFO(win
, func
):
541 win
.Connect(-1, -1, wxEVT_EVT_QUERY_LAYOUT_INFO
, func
)
543 def EVT_CALCULATE_LAYOUT(win
, func
):
544 win
.Connect(-1, -1, wxEVT_EVT_CALCULATE_LAYOUT
, func
)
548 def EVT_LIST_BEGIN_DRAG(win
, id, func
):
549 win
.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_DRAG
, func
)
551 def EVT_LIST_BEGIN_RDRAG(win
, id, func
):
552 win
.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_RDRAG
, func
)
554 def EVT_LIST_BEGIN_LABEL_EDIT(win
, id, func
):
555 win
.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT
, func
)
557 def EVT_LIST_END_LABEL_EDIT(win
, id, func
):
558 win
.Connect(id, -1, wxEVT_COMMAND_LIST_END_LABEL_EDIT
, func
)
560 def EVT_LIST_DELETE_ITEM(win
, id, func
):
561 win
.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ITEM
, func
)
563 def EVT_LIST_DELETE_ALL_ITEMS(win
, id, func
):
564 win
.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS
, func
)
566 def EVT_LIST_GET_INFO(win
, id, func
):
567 win
.Connect(id, -1, wxEVT_COMMAND_LIST_GET_INFO
, func
)
569 def EVT_LIST_SET_INFO(win
, id, func
):
570 win
.Connect(id, -1, wxEVT_COMMAND_LIST_SET_INFO
, func
)
572 def EVT_LIST_ITEM_SELECTED(win
, id, func
):
573 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED
, func
)
575 def EVT_LIST_ITEM_DESELECTED(win
, id, func
):
576 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_DESELECTED
, func
)
578 def EVT_LIST_KEY_DOWN(win
, id, func
):
579 win
.Connect(id, -1, wxEVT_COMMAND_LIST_KEY_DOWN
, func
)
581 def EVT_LIST_INSERT_ITEM(win
, id, func
):
582 win
.Connect(id, -1, wxEVT_COMMAND_LIST_INSERT_ITEM
, func
)
584 def EVT_LIST_COL_CLICK(win
, id, func
):
585 win
.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK
, func
)
587 def EVT_LIST_ITEM_RIGHT_CLICK(win
, id, func
):
588 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK
, func
)
590 def EVT_LIST_ITEM_MIDDLE_CLICK(win
, id, func
):
591 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK
, func
)
593 def EVT_LIST_ITEM_ACTIVATED(win
, id, func
):
594 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED
, func
)
600 def EVT_SPLITTER_SASH_POS_CHANGING(win
, id, func
):
601 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING
, func
)
603 def EVT_SPLITTER_SASH_POS_CHANGED(win
, id, func
):
604 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED
, func
)
606 def EVT_SPLITTER_UNSPLIT(win
, id, func
):
607 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_UNSPLIT
, func
)
609 def EVT_SPLITTER_DOUBLECLICKED(win
, id, func
):
610 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_DOUBLECLICKED
, func
)
614 def EVT_TIMER(win
, id, func
):
615 win
.Connect(id, -1, wxEVT_TIMER
, func
)
618 def EVT_END_PROCESS(eh
, id, func
):
619 eh
.Connect(id, -1, wxEVT_END_PROCESS
, func
)
623 def EVT_JOY_DOWN(win
, func
):
624 win
.Connect(-1, -1, wxEVT_JOY_BUTTON_DOWN
, func
)
626 def EVT_JOY_UP(win
, func
):
627 win
.Connect(-1, -1, wxEVT_JOY_BUTTON_UP
, func
)
629 def EVT_JOY_MOVE(win
, func
):
630 win
.Connect(-1, -1, wxEVT_JOY_MOVE
, func
)
632 def EVT_JOY_ZMOVE(win
, func
):
633 win
.Connect(-1, -1, wxEVT_JOY_ZMOVE
, func
)
635 def EVT_JOYSTICK_EVENTS(win
, func
):
636 win
.Connect(-1, -1, wxEVT_JOY_BUTTON_DOWN
, func
)
637 win
.Connect(-1, -1, wxEVT_JOY_BUTTON_UP
, func
)
638 win
.Connect(-1, -1, wxEVT_JOY_MOVE
, func
)
639 win
.Connect(-1, -1, wxEVT_JOY_ZMOVE
, func
)
642 def EVT_TOGGLEBUTTON(win
, id, func
):
643 win
.Connect(id, -1, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED
, func
)
646 #----------------------------------------------------------------------
648 class wxTimer(wxPyTimer
):
649 def __init__(self
, evtHandler
= None, id = -1):
650 if evtHandler
is None:
651 wxPyTimer
.__init
__(self
, self
.Notify
) # derived class must provide
652 # Notify(self) method.
654 wxPyTimer
.__init
__(self
, None)
655 self
.SetOwner(evtHandler
, id)
657 #----------------------------------------------------------------------
659 NULL
= None # For backwards compatibility only. You should really be
663 #----------------------------------------------------------------------
667 wxNamedColor
= wxNamedColour
670 # backwards compatibility
671 wxNoRefBitmap
= wxBitmap
672 wxPyDefaultPosition
= wxDefaultPosition
673 wxPyDefaultSize
= wxDefaultSize
675 #----------------------------------------------------------------------
676 # This helper function will take a wxPython object and convert it to
677 # another wxPython object type. This will not be able to create objects
678 # that are derived from wxPython classes by the user, only those that are
679 # actually part of wxPython and directly corespond to C++ objects.
681 # This is useful in situations where some method returns a generic
682 # type such as wxWindow, but you know that it is actually some
683 # derived type such as a wxTextCtrl. You can't call wxTextCtrl specific
684 # methods on a wxWindow object, but you can use this function to
685 # create a wxTextCtrl object that will pass the same pointer to
686 # the C++ code. You use it like this:
688 # textCtrl = wxPyTypeCast(window, "wxTextCtrl")
691 # WARNING: Using this function to type cast objects into types that
692 # they are not is not recommended and is likely to cause your
693 # program to crash... Hard.
696 def wxPyTypeCast(obj
, typeStr
):
699 theClass
= globals()[typeStr
+"Ptr"]
700 typeStr
= __wxPyPtrTypeMap
.get(typeStr
, typeStr
)
701 if hasattr(obj
, "this"):
702 if obj
.__class
__ is theClass
: # if already the right type then just return it
704 newPtr
= ptrcast(obj
.this
, typeStr
+"_p")
706 newPtr
= ptrcast(obj
, typeStr
+"_p")
707 theObj
= theClass(newPtr
)
708 if hasattr(obj
, "this"):
709 theObj
.thisown
= obj
.thisown
713 #----------------------------------------------------------------------
714 #----------------------------------------------------------------------
716 class wxPyOnDemandOutputWindow
:
717 def __init__(self
, title
= "wxPython: stdout/stderr"):
722 def SetParent(self
, parent
):
725 def OnCloseWindow(self
, event
):
726 if self
.frame
!= None:
731 # These methods provide the file-like output behaviour.
732 def write(self
, str):
733 if not wxThread_IsMain():
734 # Aquire the GUI mutex before making GUI calls. Mutex is released
735 # when locker is deleted at the end of this function.
736 locker
= wxMutexGuiLocker()
739 self
.frame
= wxFrame(self
.parent
, -1, self
.title
,
740 style
=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE
)
741 self
.text
= wxTextCtrl(self
.frame
, -1, "",
742 style
= wxTE_MULTILINE|wxTE_READONLY
)
743 self
.frame
.SetSize(wxSize(450, 300))
744 self
.frame
.Show(true
)
745 EVT_CLOSE(self
.frame
, self
.OnCloseWindow
)
746 self
.text
.AppendText(str)
749 if self
.frame
!= None:
750 if not wxThread_IsMain():
751 locker
= wxMutexGuiLocker()
755 _defRedirect
= (wxPlatform
== '__WXMSW__')
757 #----------------------------------------------------------------------
758 # The main application class. Derive from this and implement an OnInit
759 # method that creates a frame and then calls self.SetTopWindow(frame)
761 class wxApp(wxPyApp
):
762 error
= 'wxApp.error'
763 outputWindowClass
= wxPyOnDemandOutputWindow
765 def __init__(self
, redirect
=_defRedirect
, filename
=None):
766 wxPyApp
.__init
__(self
)
768 self
.saveStdio
= (sys
.stdout
, sys
.stderr
)
770 self
.RedirectStdio(filename
)
771 # this initializes wxWindows and then calls our OnInit
772 _wxStart(self
.OnInit
)
782 def SetTopWindow(self
, frame
):
784 self
.stdioWin
.SetParent(frame
)
785 wxPyApp
.SetTopWindow(self
, frame
)
789 wxPyApp
.MainLoop(self
)
793 def RedirectStdio(self
, filename
):
795 sys
.stdout
= sys
.stderr
= open(filename
, 'a')
797 self
.stdioWin
= self
.outputWindowClass() # wxPyOnDemandOutputWindow
798 sys
.stdout
= sys
.stderr
= self
.stdioWin
801 def RestoreStdio(self
):
802 sys
.stdout
, sys
.stderr
= self
.saveStdio
805 #----------------------------------------------------------------------------
807 class wxPySimpleApp(wxApp
):
808 def __init__(self
, flag
=0):
809 wxApp
.__init
__(self
, flag
)
814 class wxPyWidgetTester(wxApp
):
815 def __init__(self
, size
= (250, 100)):
817 wxApp
.__init
__(self
, 0)
820 self
.frame
= wxFrame(None, -1, "Widget Tester", pos
=(0,0), size
=self
.size
)
821 self
.SetTopWindow(self
.frame
)
824 def SetWidget(self
, widgetClass
, *args
):
825 w
= apply(widgetClass
, (self
.frame
,) + args
)
826 self
.frame
.Show(true
)
828 #----------------------------------------------------------------------------
829 # DO NOT hold any other references to this object. This is how we know when
830 # to cleanup system resources that wxWin is holding. When this module is
831 # unloaded, the refcount on __cleanMeUp goes to zero and it calls the
832 # wxApp_CleanUp function.
836 self
.cleanup
= wxc
.wxApp_CleanUp
840 __cleanMeUp
= __wxPyCleanup()
842 #----------------------------------------------------------------------------
843 #----------------------------------------------------------------------------