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
)
174 def EVT_MOUSE_EVENTS(win
, func
):
175 win
.Connect(-1, -1, wxEVT_LEFT_DOWN
, func
)
176 win
.Connect(-1, -1, wxEVT_LEFT_UP
, func
)
177 win
.Connect(-1, -1, wxEVT_MIDDLE_DOWN
, func
)
178 win
.Connect(-1, -1, wxEVT_MIDDLE_UP
, func
)
179 win
.Connect(-1, -1, wxEVT_RIGHT_DOWN
, func
)
180 win
.Connect(-1, -1, wxEVT_RIGHT_UP
, func
)
181 win
.Connect(-1, -1, wxEVT_MOTION
, func
)
182 win
.Connect(-1, -1, wxEVT_LEFT_DCLICK
, func
)
183 win
.Connect(-1, -1, wxEVT_MIDDLE_DCLICK
, func
)
184 win
.Connect(-1, -1, wxEVT_RIGHT_DCLICK
, func
)
185 win
.Connect(-1, -1, wxEVT_LEAVE_WINDOW
, func
)
186 win
.Connect(-1, -1, wxEVT_ENTER_WINDOW
, func
)
189 def EVT_COMMAND(win
, id, cmd
, func
):
190 win
.Connect(id, -1, cmd
, func
)
192 def EVT_COMMAND_RANGE(win
, id1
, id2
, cmd
, func
):
193 win
.Connect(id1
, id2
, cmd
, func
)
197 def EVT_SCROLL(win
, func
):
198 win
.Connect(-1, -1, wxEVT_SCROLL_TOP
, func
)
199 win
.Connect(-1, -1, wxEVT_SCROLL_BOTTOM
, func
)
200 win
.Connect(-1, -1, wxEVT_SCROLL_LINEUP
, func
)
201 win
.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN
, func
)
202 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEUP
, func
)
203 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
204 win
.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK
,func
)
205 win
.Connect(-1, -1, wxEVT_SCROLL_THUMBRELEASE
,func
)
207 def EVT_SCROLL_TOP(win
, func
):
208 win
.Connect(-1, -1, wxEVT_SCROLL_TOP
, func
)
210 def EVT_SCROLL_BOTTOM(win
, func
):
211 win
.Connect(-1, -1, wxEVT_SCROLL_BOTTOM
, func
)
213 def EVT_SCROLL_LINEUP(win
, func
):
214 win
.Connect(-1, -1, wxEVT_SCROLL_LINEUP
, func
)
216 def EVT_SCROLL_LINEDOWN(win
, func
):
217 win
.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN
, func
)
219 def EVT_SCROLL_PAGEUP(win
, func
):
220 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEUP
, func
)
222 def EVT_SCROLL_PAGEDOWN(win
, func
):
223 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
225 def EVT_SCROLL_THUMBTRACK(win
, func
):
226 win
.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK
, func
)
228 def EVT_SCROLL_THUMBRELEASE(win
, func
):
229 win
.Connect(-1, -1, wxEVT_SCROLL_THUMBRELEASE
, func
)
233 # Scrolling, with an id
234 def EVT_COMMAND_SCROLL(win
, id, func
):
235 win
.Connect(id, -1, wxEVT_SCROLL_TOP
, func
)
236 win
.Connect(id, -1, wxEVT_SCROLL_BOTTOM
, func
)
237 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
238 win
.Connect(id, -1, wxEVT_SCROLL_LINEDOWN
, func
)
239 win
.Connect(id, -1, wxEVT_SCROLL_PAGEUP
, func
)
240 win
.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
241 win
.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK
,func
)
242 win
.Connect(id, -1, wxEVT_SCROLL_THUMBRELEASE
,func
)
244 def EVT_COMMAND_SCROLL_TOP(win
, id, func
):
245 win
.Connect(id, -1, wxEVT_SCROLL_TOP
, func
)
247 def EVT_COMMAND_SCROLL_BOTTOM(win
, id, func
):
248 win
.Connect(id, -1, wxEVT_SCROLL_BOTTOM
, func
)
250 def EVT_COMMAND_SCROLL_LINEUP(win
, id, func
):
251 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
253 def EVT_COMMAND_SCROLL_LINEDOWN(win
, id, func
):
254 win
.Connect(id, -1, wxEVT_SCROLL_LINEDOWN
, func
)
256 def EVT_COMMAND_SCROLL_PAGEUP(win
, id, func
):
257 win
.Connect(id, -1, wxEVT_SCROLL_PAGEUP
, func
)
259 def EVT_COMMAND_SCROLL_PAGEDOWN(win
, id, func
):
260 win
.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
262 def EVT_COMMAND_SCROLL_THUMBTRACK(win
, id, func
):
263 win
.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK
, func
)
265 def EVT_COMMAND_SCROLL_THUMBRELEASE(win
, id, func
):
266 win
.Connect(id, -1, wxEVT_SCROLL_THUMBRELEASE
, func
)
269 def EVT_SCROLLWIN(win
, func
):
270 win
.Connect(-1, -1, wxEVT_SCROLLWIN_TOP
, func
)
271 win
.Connect(-1, -1, wxEVT_SCROLLWIN_BOTTOM
, func
)
272 win
.Connect(-1, -1, wxEVT_SCROLLWIN_LINEUP
, func
)
273 win
.Connect(-1, -1, wxEVT_SCROLLWIN_LINEDOWN
, func
)
274 win
.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEUP
, func
)
275 win
.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEDOWN
, func
)
276 win
.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBTRACK
, func
)
277 win
.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBRELEASE
,func
)
279 def EVT_SCROLLWIN_TOP(win
, func
):
280 win
.Connect(-1, -1, wxEVT_SCROLLWIN_TOP
, func
)
282 def EVT_SCROLLWIN_BOTTOM(win
, func
):
283 win
.Connect(-1, -1, wxEVT_SCROLLWIN_BOTTOM
, func
)
285 def EVT_SCROLLWIN_LINEUP(win
, func
):
286 win
.Connect(-1, -1, wxEVT_SCROLLWIN_LINEUP
, func
)
288 def EVT_SCROLLWIN_LINEDOWN(win
, func
):
289 win
.Connect(-1, -1, wxEVT_SCROLLWIN_LINEDOWN
, func
)
291 def EVT_SCROLLWIN_PAGEUP(win
, func
):
292 win
.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEUP
, func
)
294 def EVT_SCROLLWIN_PAGEDOWN(win
, func
):
295 win
.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEDOWN
, func
)
297 def EVT_SCROLLWIN_THUMBTRACK(win
, func
):
298 win
.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBTRACK
, func
)
300 def EVT_SCROLLWIN_THUMBRELEASE(win
, func
):
301 win
.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBRELEASE
, func
)
305 # Scrolling, with an id
306 def EVT_COMMAND_SCROLLWIN(win
, id, func
):
307 win
.Connect(id, -1, wxEVT_SCROLLWIN_TOP
, func
)
308 win
.Connect(id, -1, wxEVT_SCROLLWIN_BOTTOM
, func
)
309 win
.Connect(id, -1, wxEVT_SCROLLWIN_LINEUP
, func
)
310 win
.Connect(id, -1, wxEVT_SCROLLWIN_LINEDOWN
, func
)
311 win
.Connect(id, -1, wxEVT_SCROLLWIN_PAGEUP
, func
)
312 win
.Connect(id, -1, wxEVT_SCROLLWIN_PAGEDOWN
, func
)
313 win
.Connect(id, -1, wxEVT_SCROLLWIN_THUMBTRACK
, func
)
314 win
.Connect(id, -1, wxEVT_SCROLLWIN_THUMBRELEASE
,func
)
316 def EVT_COMMAND_SCROLLWIN_TOP(win
, id, func
):
317 win
.Connect(id, -1, wxEVT_SCROLLWIN_TOP
, func
)
319 def EVT_COMMAND_SCROLLWIN_BOTTOM(win
, id, func
):
320 win
.Connect(id, -1, wxEVT_SCROLLWIN_BOTTOM
, func
)
322 def EVT_COMMAND_SCROLLWIN_LINEUP(win
, id, func
):
323 win
.Connect(id, -1, wxEVT_SCROLLWIN_LINEUP
, func
)
325 def EVT_COMMAND_SCROLLWIN_LINEDOWN(win
, id, func
):
326 win
.Connect(id, -1, wxEVT_SCROLLWIN_LINEDOWN
, func
)
328 def EVT_COMMAND_SCROLLWIN_PAGEUP(win
, id, func
):
329 win
.Connect(id, -1, wxEVT_SCROLLWIN_PAGEUP
, func
)
331 def EVT_COMMAND_SCROLLWIN_PAGEDOWN(win
, id, func
):
332 win
.Connect(id, -1, wxEVT_SCROLLWIN_PAGEDOWN
, func
)
334 def EVT_COMMAND_SCROLLWIN_THUMBTRACK(win
, id, func
):
335 win
.Connect(id, -1, wxEVT_SCROLLWIN_THUMBTRACK
, func
)
337 def EVT_COMMAND_SCROLLWIN_THUMBRELEASE(win
, id, func
):
338 win
.Connect(id, -1, wxEVT_SCROLLWIN_THUMBRELEASE
, func
)
341 # Convenience commands
342 def EVT_BUTTON(win
, id, func
):
343 win
.Connect(id, -1, wxEVT_COMMAND_BUTTON_CLICKED
, func
)
345 def EVT_CHECKBOX(win
, id, func
):
346 win
.Connect(id, -1, wxEVT_COMMAND_CHECKBOX_CLICKED
, func
)
348 def EVT_CHOICE(win
, id, func
):
349 win
.Connect(id, -1, wxEVT_COMMAND_CHOICE_SELECTED
, func
)
351 def EVT_LISTBOX(win
, id, func
):
352 win
.Connect(id, -1, wxEVT_COMMAND_LISTBOX_SELECTED
, func
)
354 def EVT_LISTBOX_DCLICK(win
, id, func
):
355 win
.Connect(id, -1, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
, func
)
357 def EVT_TEXT(win
, id, func
):
358 win
.Connect(id, -1, wxEVT_COMMAND_TEXT_UPDATED
, func
)
360 def EVT_TEXT_ENTER(win
, id, func
):
361 win
.Connect(id, -1, wxEVT_COMMAND_TEXT_ENTER
, func
)
363 def EVT_MENU(win
, id, func
):
364 win
.Connect(id, -1, wxEVT_COMMAND_MENU_SELECTED
, func
)
366 def EVT_MENU_RANGE(win
, id1
, id2
, func
):
367 win
.Connect(id1
, id2
, wxEVT_COMMAND_MENU_SELECTED
, func
)
369 def EVT_SLIDER(win
, id, func
):
370 win
.Connect(id, -1, wxEVT_COMMAND_SLIDER_UPDATED
, func
)
372 def EVT_RADIOBOX(win
, id, func
):
373 win
.Connect(id, -1, wxEVT_COMMAND_RADIOBOX_SELECTED
, func
)
375 def EVT_RADIOBUTTON(win
, id, func
):
376 win
.Connect(id, -1, wxEVT_COMMAND_RADIOBUTTON_SELECTED
, func
)
378 def EVT_VLBOX(win
, id, func
):
379 win
.Connect(id, -1, wxEVT_COMMAND_VLBOX_SELECTED
, func
)
381 def EVT_COMBOBOX(win
, id, func
):
382 win
.Connect(id, -1, wxEVT_COMMAND_COMBOBOX_SELECTED
, func
)
384 def EVT_TOOL(win
, id, func
):
385 win
.Connect(id, -1, wxEVT_COMMAND_TOOL_CLICKED
, func
)
387 def EVT_TOOL_RANGE(win
, id, id2
, func
):
388 win
.Connect(id, id2
, wxEVT_COMMAND_TOOL_CLICKED
, func
)
390 def EVT_TOOL_RCLICKED(win
, id, func
):
391 win
.Connect(id, -1, wxEVT_COMMAND_TOOL_RCLICKED
, func
)
393 def EVT_TOOL_RCLICKED_RANGE(win
, id, id2
, func
):
394 win
.Connect(id, id2
, wxEVT_COMMAND_TOOL_RCLICKED
, func
)
396 def EVT_TOOL_ENTER(win
, id, func
):
397 win
.Connect(id, -1, wxEVT_COMMAND_TOOL_ENTER
, func
)
399 def EVT_CHECKLISTBOX(win
, id, func
):
400 win
.Connect(id, -1, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
, func
)
402 def EVT_SPINCTRL(win
, id, func
):
403 win
.Connect(id, -1, wxEVT_COMMAND_SPINCTRL_UPDATED
, func
)
407 # Generic command events
409 def EVT_COMMAND_LEFT_CLICK(win
, id, func
):
410 win
.Connect(id, -1, wxEVT_COMMAND_LEFT_CLICK
, func
)
412 def EVT_COMMAND_LEFT_DCLICK(win
, id, func
):
413 win
.Connect(id, -1, wxEVT_COMMAND_LEFT_DCLICK
, func
)
415 def EVT_COMMAND_RIGHT_CLICK(win
, id, func
):
416 win
.Connect(id, -1, wxEVT_COMMAND_RIGHT_CLICK
, func
)
418 def EVT_COMMAND_RIGHT_DCLICK(win
, id, func
):
419 win
.Connect(id, -1, wxEVT_COMMAND_RIGHT_DCLICK
, func
)
421 def EVT_COMMAND_SET_FOCUS(win
, id, func
):
422 win
.Connect(id, -1, wxEVT_COMMAND_SET_FOCUS
, func
)
424 def EVT_COMMAND_KILL_FOCUS(win
, id, func
):
425 win
.Connect(id, -1, wxEVT_COMMAND_KILL_FOCUS
, func
)
427 def EVT_COMMAND_ENTER(win
, id, func
):
428 win
.Connect(id, -1, wxEVT_COMMAND_ENTER
, func
)
432 def EVT_NOTEBOOK_PAGE_CHANGED(win
, id, func
):
433 win
.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
, func
)
435 def EVT_NOTEBOOK_PAGE_CHANGING(win
, id, func
):
436 win
.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
, func
)
440 def EVT_TREE_BEGIN_DRAG(win
, id, func
):
441 win
.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_DRAG
, func
)
443 def EVT_TREE_BEGIN_RDRAG(win
, id, func
):
444 win
.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_RDRAG
, func
)
446 def EVT_TREE_BEGIN_LABEL_EDIT(win
, id, func
):
447 win
.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT
, func
)
449 def EVT_TREE_END_LABEL_EDIT(win
, id, func
):
450 win
.Connect(id, -1, wxEVT_COMMAND_TREE_END_LABEL_EDIT
, func
)
452 def EVT_TREE_GET_INFO(win
, id, func
):
453 win
.Connect(id, -1, wxEVT_COMMAND_TREE_GET_INFO
, func
)
455 def EVT_TREE_SET_INFO(win
, id, func
):
456 win
.Connect(id, -1, wxEVT_COMMAND_TREE_SET_INFO
, func
)
458 def EVT_TREE_ITEM_EXPANDED(win
, id, func
):
459 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDED
, func
)
461 def EVT_TREE_ITEM_EXPANDING(win
, id, func
):
462 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDING
, func
)
464 def EVT_TREE_ITEM_COLLAPSED(win
, id, func
):
465 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSED
, func
)
467 def EVT_TREE_ITEM_COLLAPSING(win
, id, func
):
468 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSING
, func
)
470 def EVT_TREE_SEL_CHANGED(win
, id, func
):
471 win
.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGED
, func
)
473 def EVT_TREE_SEL_CHANGING(win
, id, func
):
474 win
.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGING
, func
)
476 def EVT_TREE_KEY_DOWN(win
, id, func
):
477 win
.Connect(id, -1, wxEVT_COMMAND_TREE_KEY_DOWN
, func
)
479 def EVT_TREE_DELETE_ITEM(win
, id, func
):
480 win
.Connect(id, -1, wxEVT_COMMAND_TREE_DELETE_ITEM
, func
)
482 def EVT_TREE_ITEM_ACTIVATED(win
, id, func
):
483 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_ACTIVATED
, func
)
485 def EVT_TREE_ITEM_RIGHT_CLICK(win
, id, func
):
486 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK
, func
)
488 def EVT_TREE_ITEM_MIDDLE_CLICK(win
, id, func
):
489 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK
, func
)
493 def EVT_SPIN_UP(win
, id, func
):
494 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
496 def EVT_SPIN_DOWN(win
, id, func
):
497 win
.Connect(id, -1, wxEVT_SCROLL_LINEDOWN
, func
)
499 def EVT_SPIN(win
, id, func
):
500 win
.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK
,func
)
506 def EVT_TASKBAR_MOVE(win
, func
):
507 win
.Connect(-1, -1, wxEVT_TASKBAR_MOVE
, func
)
509 def EVT_TASKBAR_LEFT_DOWN(win
, func
):
510 win
.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DOWN
, func
)
512 def EVT_TASKBAR_LEFT_UP(win
, func
):
513 win
.Connect(-1, -1, wxEVT_TASKBAR_LEFT_UP
, func
)
515 def EVT_TASKBAR_RIGHT_DOWN(win
, func
):
516 win
.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DOWN
, func
)
518 def EVT_TASKBAR_RIGHT_UP(win
, func
):
519 win
.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_UP
, func
)
521 def EVT_TASKBAR_LEFT_DCLICK(win
, func
):
522 win
.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DCLICK
, func
)
524 def EVT_TASKBAR_RIGHT_DCLICK(win
, func
):
525 win
.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DCLICK
, func
)
529 def EVT_SASH_DRAGGED(win
, id, func
):
530 win
.Connect(id, -1, wxEVT_SASH_DRAGGED
, func
)
532 def EVT_SASH_DRAGGED_RANGE(win
, id1
, id2
, func
):
533 win
.Connect(id1
, id2
, wxEVT_SASH_DRAGGED
, func
)
535 def EVT_QUERY_LAYOUT_INFO(win
, func
):
536 win
.Connect(-1, -1, wxEVT_EVT_QUERY_LAYOUT_INFO
, func
)
538 def EVT_CALCULATE_LAYOUT(win
, func
):
539 win
.Connect(-1, -1, wxEVT_EVT_CALCULATE_LAYOUT
, func
)
543 def EVT_LIST_BEGIN_DRAG(win
, id, func
):
544 win
.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_DRAG
, func
)
546 def EVT_LIST_BEGIN_RDRAG(win
, id, func
):
547 win
.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_RDRAG
, func
)
549 def EVT_LIST_BEGIN_LABEL_EDIT(win
, id, func
):
550 win
.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT
, func
)
552 def EVT_LIST_END_LABEL_EDIT(win
, id, func
):
553 win
.Connect(id, -1, wxEVT_COMMAND_LIST_END_LABEL_EDIT
, func
)
555 def EVT_LIST_DELETE_ITEM(win
, id, func
):
556 win
.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ITEM
, func
)
558 def EVT_LIST_DELETE_ALL_ITEMS(win
, id, func
):
559 win
.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS
, func
)
561 def EVT_LIST_GET_INFO(win
, id, func
):
562 win
.Connect(id, -1, wxEVT_COMMAND_LIST_GET_INFO
, func
)
564 def EVT_LIST_SET_INFO(win
, id, func
):
565 win
.Connect(id, -1, wxEVT_COMMAND_LIST_SET_INFO
, func
)
567 def EVT_LIST_ITEM_SELECTED(win
, id, func
):
568 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED
, func
)
570 def EVT_LIST_ITEM_DESELECTED(win
, id, func
):
571 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_DESELECTED
, func
)
573 def EVT_LIST_KEY_DOWN(win
, id, func
):
574 win
.Connect(id, -1, wxEVT_COMMAND_LIST_KEY_DOWN
, func
)
576 def EVT_LIST_INSERT_ITEM(win
, id, func
):
577 win
.Connect(id, -1, wxEVT_COMMAND_LIST_INSERT_ITEM
, func
)
579 def EVT_LIST_COL_CLICK(win
, id, func
):
580 win
.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK
, func
)
582 def EVT_LIST_ITEM_RIGHT_CLICK(win
, id, func
):
583 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK
, func
)
585 def EVT_LIST_ITEM_MIDDLE_CLICK(win
, id, func
):
586 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK
, func
)
588 def EVT_LIST_ITEM_ACTIVATED(win
, id, func
):
589 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED
, func
)
595 def EVT_SPLITTER_SASH_POS_CHANGING(win
, id, func
):
596 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING
, func
)
598 def EVT_SPLITTER_SASH_POS_CHANGED(win
, id, func
):
599 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED
, func
)
601 def EVT_SPLITTER_UNSPLIT(win
, id, func
):
602 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_UNSPLIT
, func
)
604 def EVT_SPLITTER_DOUBLECLICKED(win
, id, func
):
605 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_DOUBLECLICKED
, func
)
609 def EVT_TIMER(win
, id, func
):
610 win
.Connect(id, -1, wxEVT_TIMER
, func
)
613 def EVT_END_PROCESS(eh
, id, func
):
614 eh
.Connect(id, -1, wxEVT_END_PROCESS
, func
)
618 def EVT_JOY_DOWN(win
, func
):
619 win
.Connect(-1, -1, wxEVT_JOY_DOWN
, func
)
621 def EVT_JOY_UP(win
, func
):
622 win
.Connect(-1, -1, wxEVT_JOY_UP
, func
)
624 def EVT_JOY_MOVE(win
, func
):
625 win
.Connect(-1, -1, wxEVT_JOY_MOVE
, func
)
627 def EVT_JOY_ZMOVE(win
, func
):
628 win
.Connect(-1, -1, wxEVT_JOY_ZMOVE
, func
)
630 def EVT_JOYSTICK_EVENTS(win
, func
):
631 win
.Connect(-1, -1, wxEVT_JOY_DOWN
, func
)
632 win
.Connect(-1, -1, wxEVT_JOY_UP
, func
)
633 win
.Connect(-1, -1, wxEVT_JOY_MOVE
, func
)
634 win
.Connect(-1, -1, wxEVT_JOY_ZMOVE
, func
)
636 #----------------------------------------------------------------------
638 class wxTimer(wxPyTimer
):
639 def __init__(self
, evtHandler
= None, id = -1):
640 if evtHandler
is None:
641 wxPyTimer
.__init
__(self
, self
.Notify
) # derived class must provide
642 # Notify(self) method.
644 wxPyTimer
.__init
__(self
, None)
645 self
.SetOwner(evtHandler
, id)
647 #----------------------------------------------------------------------
648 # Some wxWin methods can take "NULL" as parameters, but the shadow classes
649 # expect an object with the SWIG pointer as a 'this' member. This class
650 # and instance fools the shadow into passing the NULL pointer.
652 ## NOTE: This is not needed anymore as None can be passed instead and
653 # will be interpreted as NULL.
656 this
= 'NULL' # SWIG converts this to (void*)0
661 #----------------------------------------------------------------------
665 wxNamedColor
= wxNamedColour
668 # backwards compatibility
669 wxNoRefBitmap
= wxBitmap
670 wxPyDefaultPosition
= wxDefaultPosition
671 wxPyDefaultSize
= wxDefaultSize
673 #----------------------------------------------------------------------
674 # This helper function will take a wxPython object and convert it to
675 # another wxPython object type. This will not be able to create objects
676 # that are derived from wxPython classes by the user, only those that are
677 # actually part of wxPython and directly corespond to C++ objects.
679 # This is useful in situations where some method returns a generic
680 # type such as wxWindow, but you know that it is actually some
681 # derived type such as a wxTextCtrl. You can't call wxTextCtrl specific
682 # methods on a wxWindow object, but you can use this function to
683 # create a wxTextCtrl object that will pass the same pointer to
684 # the C++ code. You use it like this:
686 # textCtrl = wxPyTypeCast(window, "wxTextCtrl")
689 # WARNING: Using this function to type cast objects into types that
690 # they are not is not recommended and is likely to cause your
691 # program to crash... Hard.
694 def wxPyTypeCast(obj
, typeStr
):
697 if hasattr(obj
, "this"):
698 newPtr
= ptrcast(obj
.this
, typeStr
+"_p")
700 newPtr
= ptrcast(obj
, typeStr
+"_p")
701 theClass
= globals()[typeStr
+"Ptr"]
702 theObj
= theClass(newPtr
)
703 if hasattr(obj
, "this"):
704 theObj
.thisown
= obj
.thisown
708 #----------------------------------------------------------------------
709 #----------------------------------------------------------------------
711 class wxPyOnDemandOutputWindow
:
712 def __init__(self
, title
= "wxPython: stdout/stderr"):
717 def SetParent(self
, parent
):
720 def OnCloseWindow(self
, event
):
721 if self
.frame
!= None:
726 # These methods provide the file-like output behaviour.
727 def write(self
, str):
728 if not wxThread_IsMain():
729 # Aquire the GUI mutex before making GUI calls. Mutex is released
730 # when locker is deleted a the end of this function.
731 locker
= wxMutexGuiLocker()
734 self
.frame
= wxFrame(self
.parent
, -1, self
.title
)
735 self
.text
= wxTextCtrl(self
.frame
, -1, "",
736 style
= wxTE_MULTILINE|wxTE_READONLY
)
737 self
.frame
.SetSize(wxSize(450, 300))
738 self
.frame
.Show(true
)
739 EVT_CLOSE(self
.frame
, self
.OnCloseWindow
)
740 self
.text
.AppendText(str)
743 if self
.frame
!= None:
744 if not wxThread_IsMain():
745 locker
= wxMutexGuiLocker()
749 _defRedirect
= (wxPlatform
== '__WXMSW__')
751 #----------------------------------------------------------------------
752 # The main application class. Derive from this and implement an OnInit
753 # method that creates a frame and then calls self.SetTopWindow(frame)
755 class wxApp(wxPyApp
):
756 error
= 'wxApp.error'
757 outputWindowClass
= wxPyOnDemandOutputWindow
759 def __init__(self
, redirect
=_defRedirect
, filename
=None):
760 wxPyApp
.__init
__(self
)
762 self
.saveStdio
= (sys
.stdout
, sys
.stderr
)
764 self
.RedirectStdio(filename
)
765 # this initializes wxWindows and then calls our OnInit
766 _wxStart(self
.OnInit
)
776 def SetTopWindow(self
, frame
):
778 self
.stdioWin
.SetParent(frame
)
779 wxPyApp
.SetTopWindow(self
, frame
)
783 wxPyApp
.MainLoop(self
)
787 def RedirectStdio(self
, filename
):
789 sys
.stdout
= sys
.stderr
= open(filename
, 'a')
791 self
.stdioWin
= self
.outputWindowClass() # wxPyOnDemandOutputWindow
792 sys
.stdout
= sys
.stderr
= self
.stdioWin
795 def RestoreStdio(self
):
796 sys
.stdout
, sys
.stderr
= self
.saveStdio
799 #----------------------------------------------------------------------------
801 class wxPySimpleApp(wxApp
):
802 def __init__(self
, flag
=0):
803 wxApp
.__init
__(self
, flag
)
808 class wxPyWidgetTester(wxApp
):
809 def __init__(self
, size
= (250, 100)):
811 wxApp
.__init
__(self
, 0)
814 self
.frame
= wxFrame(None, -1, "Widget Tester", pos
=(0,0), size
=self
.size
)
815 self
.SetTopWindow(self
.frame
)
818 def SetWidget(self
, widgetClass
, *args
):
819 w
= apply(widgetClass
, (self
.frame
,) + args
)
820 self
.frame
.Show(true
)
822 #----------------------------------------------------------------------------
823 # DO NOT hold any other references to this object. This is how we know when
824 # to cleanup system resources that wxWin is holding. When this module is
825 # unloaded, the refcount on __cleanMeUp goes to zero and it calls the
826 # wxApp_CleanUp function.
830 self
.cleanup
= wxc
.wxApp_CleanUp
834 __cleanMeUp
= __wxPyCleanup()
835 #----------------------------------------------------------------------------