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
)
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
, "OnPaint", wxEVT_PAINT
)
39 _checkForCallback(win
, "OnIdle", wxEVT_IDLE
)
42 def _StdFrameCallbacks(win
):
43 _StdWindowCallbacks(win
)
44 _checkForCallback(win
, "OnActivate", wxEVT_ACTIVATE
)
45 _checkForCallback(win
, "OnMenuHighlight", wxEVT_MENU_HIGHLIGHT
)
46 _checkForCallback(win
, "OnCloseWindow", wxEVT_CLOSE_WINDOW
)
49 def _StdDialogCallbacks(win
):
50 _StdWindowCallbacks(win
)
51 _checkForCallback(win
, "OnOk", wxEVT_COMMAND_BUTTON_CLICKED
, wxID_OK
)
52 _checkForCallback(win
, "OnApply", wxEVT_COMMAND_BUTTON_CLICKED
, wxID_APPLY
)
53 _checkForCallback(win
, "OnCancel", wxEVT_COMMAND_BUTTON_CLICKED
, wxID_CANCEL
)
54 _checkForCallback(win
, "OnCloseWindow", wxEVT_CLOSE_WINDOW
)
55 _checkForCallback(win
, "OnCharHook", wxEVT_CHAR_HOOK
)
58 def _StdOnScrollCallbacks(win
):
59 try: cb
= getattr(win
, "OnScroll")
61 else: EVT_SCROLL(win
, cb
)
65 #----------------------------------------------------------------------
66 #----------------------------------------------------------------------
67 # functions that look and act like the C++ Macros of the same name
71 def EVT_SIZE(win
, func
):
72 win
.Connect(-1, -1, wxEVT_SIZE
, func
)
74 def EVT_MOVE(win
, func
):
75 win
.Connect(-1, -1, wxEVT_MOVE
, func
)
77 def EVT_CLOSE(win
, func
):
78 win
.Connect(-1, -1, wxEVT_CLOSE_WINDOW
, func
)
80 def EVT_PAINT(win
, func
):
81 win
.Connect(-1, -1, wxEVT_PAINT
, func
)
83 def EVT_ERASE_BACKGROUND(win
, func
):
84 win
.Connect(-1, -1, wxEVT_ERASE_BACKGROUND
, func
)
86 def EVT_CHAR(win
, func
):
87 win
.Connect(-1, -1, wxEVT_CHAR
, func
)
89 def EVT_CHAR_HOOK(win
, func
):
90 win
.Connect(-1, -1, wxEVT_CHAR_HOOK
, func
)
92 def EVT_KEY_DOWN(win
, func
):
93 win
.Connect(-1, -1, wxEVT_KEY_DOWN
, func
)
95 def EVT_KEY_UP(win
, func
):
96 win
.Connect(-1, -1, wxEVT_KEY_UP
, func
)
98 def EVT_MENU_HIGHLIGHT(win
, id, func
):
99 win
.Connect(id, -1, wxEVT_MENU_HIGHLIGHT
, func
)
101 def EVT_MENU_HIGHLIGHT_ALL(win
, func
):
102 win
.Connect(-1, -1, wxEVT_MENU_HIGHLIGHT
, func
)
104 def EVT_SET_FOCUS(win
, func
):
105 win
.Connect(-1, -1, wxEVT_SET_FOCUS
, func
)
107 def EVT_KILL_FOCUS(win
, func
):
108 win
.Connect(-1, -1, wxEVT_KILL_FOCUS
, func
)
110 def EVT_ACTIVATE(win
, func
):
111 win
.Connect(-1, -1, wxEVT_ACTIVATE
, func
)
113 def EVT_ACTIVATE_APP(win
, func
):
114 win
.Connect(-1, -1, wxEVT_ACTIVATE_APP
, func
)
116 def EVT_END_SESSION(win
, func
):
117 win
.Connect(-1, -1, wxEVT_END_SESSION
, func
)
119 def EVT_QUERY_END_SESSION(win
, func
):
120 win
.Connect(-1, -1, wxEVT_QUERY_END_SESSION
, func
)
122 def EVT_DROP_FILES(win
, func
):
123 win
.Connect(-1, -1, wxEVT_DROP_FILES
, func
)
125 def EVT_INIT_DIALOG(win
, func
):
126 win
.Connect(-1, -1, wxEVT_INIT_DIALOG
, func
)
128 def EVT_SYS_COLOUR_CHANGED(win
, func
):
129 win
.Connect(-1, -1, wxEVT_SYS_COLOUR_CHANGED
, func
)
131 def EVT_SHOW(win
, func
):
132 win
.Connect(-1, -1, wxEVT_SHOW
, func
)
134 def EVT_MAXIMIZE(win
, func
):
135 win
.Connect(-1, -1, wxEVT_MAXIMIZE
, func
)
137 def EVT_ICONIZE(win
, func
):
138 win
.Connect(-1, -1, wxEVT_ICONIZE
, func
)
140 def EVT_NAVIGATION_KEY(win
, func
):
141 win
.Connect(-1, -1, wxEVT_NAVIGATION_KEY
, func
)
143 def EVT_PALETTE_CHANGED(win
, func
):
144 win
.Connect(-1, -1, wxEVT_PALETTE_CHANGED
, func
)
146 def EVT_QUERY_NEW_PALETTE(win
, func
):
147 win
.Connect(-1, -1, wxEVT_QUERY_NEW_PALETTE
, func
)
149 def EVT_WINDOW_CREATE(win
, func
):
150 win
.Connect(-1, -1, wxEVT_CREATE
, func
)
152 def EVT_WINDOW_DESTROY(win
, func
):
153 win
.Connect(-1, -1, wxEVT_DESTROY
, func
)
157 def EVT_IDLE(win
, func
):
158 win
.Connect(-1, -1, wxEVT_IDLE
, func
)
160 def EVT_UPDATE_UI(win
, id, func
):
161 win
.Connect(id, -1, wxEVT_UPDATE_UI
, func
)
163 def EVT_UPDATE_UI_RANGE(win
, id, id2
, func
):
164 win
.Connect(id, id2
, wxEVT_UPDATE_UI
, func
)
168 def EVT_LEFT_DOWN(win
, func
):
169 win
.Connect(-1, -1, wxEVT_LEFT_DOWN
, func
)
171 def EVT_LEFT_UP(win
, func
):
172 win
.Connect(-1, -1, wxEVT_LEFT_UP
, func
)
174 def EVT_MIDDLE_DOWN(win
, func
):
175 win
.Connect(-1, -1, wxEVT_MIDDLE_DOWN
, func
)
177 def EVT_MIDDLE_UP(win
, func
):
178 win
.Connect(-1, -1, wxEVT_MIDDLE_UP
, func
)
180 def EVT_RIGHT_DOWN(win
, func
):
181 win
.Connect(-1, -1, wxEVT_RIGHT_DOWN
, func
)
183 def EVT_RIGHT_UP(win
, func
):
184 win
.Connect(-1, -1, wxEVT_RIGHT_UP
, func
)
186 def EVT_MOTION(win
, func
):
187 win
.Connect(-1, -1, wxEVT_MOTION
, func
)
189 def EVT_LEFT_DCLICK(win
, func
):
190 win
.Connect(-1, -1, wxEVT_LEFT_DCLICK
, func
)
192 def EVT_MIDDLE_DCLICK(win
, func
):
193 win
.Connect(-1, -1, wxEVT_MIDDLE_DCLICK
, func
)
195 def EVT_RIGHT_DCLICK(win
, func
):
196 win
.Connect(-1, -1, wxEVT_RIGHT_DCLICK
, func
)
198 def EVT_LEAVE_WINDOW(win
, func
):
199 win
.Connect(-1, -1, wxEVT_LEAVE_WINDOW
, func
)
201 def EVT_ENTER_WINDOW(win
, func
):
202 win
.Connect(-1, -1, wxEVT_ENTER_WINDOW
, func
)
206 def EVT_MOUSE_EVENTS(win
, func
):
207 win
.Connect(-1, -1, wxEVT_LEFT_DOWN
, func
)
208 win
.Connect(-1, -1, wxEVT_LEFT_UP
, func
)
209 win
.Connect(-1, -1, wxEVT_MIDDLE_DOWN
, func
)
210 win
.Connect(-1, -1, wxEVT_MIDDLE_UP
, func
)
211 win
.Connect(-1, -1, wxEVT_RIGHT_DOWN
, func
)
212 win
.Connect(-1, -1, wxEVT_RIGHT_UP
, func
)
213 win
.Connect(-1, -1, wxEVT_MOTION
, func
)
214 win
.Connect(-1, -1, wxEVT_LEFT_DCLICK
, func
)
215 win
.Connect(-1, -1, wxEVT_MIDDLE_DCLICK
, func
)
216 win
.Connect(-1, -1, wxEVT_RIGHT_DCLICK
, func
)
217 win
.Connect(-1, -1, wxEVT_LEAVE_WINDOW
, func
)
218 win
.Connect(-1, -1, wxEVT_ENTER_WINDOW
, func
)
221 def EVT_COMMAND(win
, id, cmd
, func
):
222 win
.Connect(id, -1, cmd
, func
)
224 def EVT_COMMAND_RANGE(win
, id1
, id2
, cmd
, func
):
225 win
.Connect(id1
, id2
, cmd
, func
)
228 def EVT_SCROLL(win
, func
):
229 win
.Connect(-1, -1, wxEVT_SCROLL_TOP
, func
)
230 win
.Connect(-1, -1, wxEVT_SCROLL_BOTTOM
, func
)
231 win
.Connect(-1, -1, wxEVT_SCROLL_LINEUP
, func
)
232 win
.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN
, func
)
233 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEUP
, func
)
234 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
235 win
.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK
,func
)
237 def EVT_SCROLL_TOP(win
, func
):
238 win
.Connect(-1, -1, wxEVT_SCROLL_TOP
, func
)
240 def EVT_SCROLL_BOTTOM(win
, func
):
241 win
.Connect(-1, -1, wxEVT_SCROLL_BOTTOM
, func
)
243 def EVT_SCROLL_LINEUP(win
, func
):
244 win
.Connect(-1, -1, wxEVT_SCROLL_LINEUP
, func
)
246 def EVT_SCROLL_LINEDOWN(win
, func
):
247 win
.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN
, func
)
249 def EVT_SCROLL_PAGEUP(win
, func
):
250 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEUP
, func
)
252 def EVT_SCROLL_PAGEDOWN(win
, func
):
253 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
255 def EVT_SCROLL_THUMBTRACK(win
, func
):
256 win
.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK
, func
)
260 # Scrolling, with an id
261 def EVT_COMMAND_SCROLL(win
, id, func
):
262 win
.Connect(id, -1, wxEVT_SCROLL_TOP
, func
)
263 win
.Connect(id, -1, wxEVT_SCROLL_BOTTOM
, func
)
264 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
265 win
.Connect(id, -1, wxEVT_SCROLL_LINEDOWN
, func
)
266 win
.Connect(id, -1, wxEVT_SCROLL_PAGEUP
, func
)
267 win
.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
268 win
.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK
,func
)
270 def EVT_COMMAND_SCROLL_TOP(win
, id, func
):
271 win
.Connect(id, -1, wxEVT_SCROLL_TOP
, func
)
273 def EVT_COMMAND_SCROLL_BOTTOM(win
, id, func
):
274 win
.Connect(id, -1, wxEVT_SCROLL_BOTTOM
, func
)
276 def EVT_COMMAND_SCROLL_LINEUP(win
, id, func
):
277 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
279 def EVT_COMMAND_SCROLL_LINEDOWN(win
, id, func
):
280 win
.Connect(id, -1, wxEVT_SCROLL_LINEDOWN
, func
)
282 def EVT_COMMAND_SCROLL_PAGEUP(win
, id, func
):
283 win
.Connect(id, -1, wxEVT_SCROLL_PAGEUP
, func
)
285 def EVT_COMMAND_SCROLL_PAGEDOWN(win
, id, func
):
286 win
.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
288 def EVT_COMMAND_SCROLL_THUMBTRACK(win
, id, func
):
289 win
.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK
, func
)
292 def EVT_SCROLLWIN(win
, func
):
293 win
.Connect(-1, -1, wxEVT_SCROLLWIN_TOP
, func
)
294 win
.Connect(-1, -1, wxEVT_SCROLLWIN_BOTTOM
, func
)
295 win
.Connect(-1, -1, wxEVT_SCROLLWIN_LINEUP
, func
)
296 win
.Connect(-1, -1, wxEVT_SCROLLWIN_LINEDOWN
, func
)
297 win
.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEUP
, func
)
298 win
.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEDOWN
, func
)
299 win
.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBTRACK
,func
)
301 def EVT_SCROLLWIN_TOP(win
, func
):
302 win
.Connect(-1, -1, wxEVT_SCROLLWIN_TOP
, func
)
304 def EVT_SCROLLWIN_BOTTOM(win
, func
):
305 win
.Connect(-1, -1, wxEVT_SCROLLWIN_BOTTOM
, func
)
307 def EVT_SCROLLWIN_LINEUP(win
, func
):
308 win
.Connect(-1, -1, wxEVT_SCROLLWIN_LINEUP
, func
)
310 def EVT_SCROLLWIN_LINEDOWN(win
, func
):
311 win
.Connect(-1, -1, wxEVT_SCROLLWIN_LINEDOWN
, func
)
313 def EVT_SCROLLWIN_PAGEUP(win
, func
):
314 win
.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEUP
, func
)
316 def EVT_SCROLLWIN_PAGEDOWN(win
, func
):
317 win
.Connect(-1, -1, wxEVT_SCROLLWIN_PAGEDOWN
, func
)
319 def EVT_SCROLLWIN_THUMBTRACK(win
, func
):
320 win
.Connect(-1, -1, wxEVT_SCROLLWIN_THUMBTRACK
, func
)
324 # Scrolling, with an id
325 def EVT_COMMAND_SCROLLWIN(win
, id, func
):
326 win
.Connect(id, -1, wxEVT_SCROLLWIN_TOP
, func
)
327 win
.Connect(id, -1, wxEVT_SCROLLWIN_BOTTOM
, func
)
328 win
.Connect(id, -1, wxEVT_SCROLLWIN_LINEUP
, func
)
329 win
.Connect(id, -1, wxEVT_SCROLLWIN_LINEDOWN
, func
)
330 win
.Connect(id, -1, wxEVT_SCROLLWIN_PAGEUP
, func
)
331 win
.Connect(id, -1, wxEVT_SCROLLWIN_PAGEDOWN
, func
)
332 win
.Connect(id, -1, wxEVT_SCROLLWIN_THUMBTRACK
,func
)
334 def EVT_COMMAND_SCROLLWIN_TOP(win
, id, func
):
335 win
.Connect(id, -1, wxEVT_SCROLLWIN_TOP
, func
)
337 def EVT_COMMAND_SCROLLWIN_BOTTOM(win
, id, func
):
338 win
.Connect(id, -1, wxEVT_SCROLLWIN_BOTTOM
, func
)
340 def EVT_COMMAND_SCROLLWIN_LINEUP(win
, id, func
):
341 win
.Connect(id, -1, wxEVT_SCROLLWIN_LINEUP
, func
)
343 def EVT_COMMAND_SCROLLWIN_LINEDOWN(win
, id, func
):
344 win
.Connect(id, -1, wxEVT_SCROLLWIN_LINEDOWN
, func
)
346 def EVT_COMMAND_SCROLLWIN_PAGEUP(win
, id, func
):
347 win
.Connect(id, -1, wxEVT_SCROLLWIN_PAGEUP
, func
)
349 def EVT_COMMAND_SCROLLWIN_PAGEDOWN(win
, id, func
):
350 win
.Connect(id, -1, wxEVT_SCROLLWIN_PAGEDOWN
, func
)
352 def EVT_COMMAND_SCROLLWIN_THUMBTRACK(win
, id, func
):
353 win
.Connect(id, -1, wxEVT_SCROLLWIN_THUMBTRACK
, func
)
355 # Convenience commands
356 def EVT_BUTTON(win
, id, func
):
357 win
.Connect(id, -1, wxEVT_COMMAND_BUTTON_CLICKED
, func
)
359 def EVT_CHECKBOX(win
, id, func
):
360 win
.Connect(id, -1, wxEVT_COMMAND_CHECKBOX_CLICKED
, func
)
362 def EVT_CHOICE(win
, id, func
):
363 win
.Connect(id, -1, wxEVT_COMMAND_CHOICE_SELECTED
, func
)
365 def EVT_LISTBOX(win
, id, func
):
366 win
.Connect(id, -1, wxEVT_COMMAND_LISTBOX_SELECTED
, func
)
368 def EVT_LISTBOX_DCLICK(win
, id, func
):
369 win
.Connect(id, -1, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
, func
)
371 def EVT_TEXT(win
, id, func
):
372 win
.Connect(id, -1, wxEVT_COMMAND_TEXT_UPDATED
, func
)
374 def EVT_TEXT_ENTER(win
, id, func
):
375 win
.Connect(id, -1, wxEVT_COMMAND_TEXT_ENTER
, func
)
377 def EVT_MENU(win
, id, func
):
378 win
.Connect(id, -1, wxEVT_COMMAND_MENU_SELECTED
, func
)
380 def EVT_MENU_RANGE(win
, id1
, id2
, func
):
381 win
.Connect(id1
, id2
, wxEVT_COMMAND_MENU_SELECTED
, func
)
383 def EVT_SLIDER(win
, id, func
):
384 win
.Connect(id, -1, wxEVT_COMMAND_SLIDER_UPDATED
, func
)
386 def EVT_RADIOBOX(win
, id, func
):
387 win
.Connect(id, -1, wxEVT_COMMAND_RADIOBOX_SELECTED
, func
)
389 def EVT_RADIOBUTTON(win
, id, func
):
390 win
.Connect(id, -1, wxEVT_COMMAND_RADIOBUTTON_SELECTED
, func
)
392 def EVT_VLBOX(win
, id, func
):
393 win
.Connect(id, -1, wxEVT_COMMAND_VLBOX_SELECTED
, func
)
395 def EVT_COMBOBOX(win
, id, func
):
396 win
.Connect(id, -1, wxEVT_COMMAND_COMBOBOX_SELECTED
, func
)
398 def EVT_TOOL(win
, id, func
):
399 win
.Connect(id, -1, wxEVT_COMMAND_TOOL_CLICKED
, func
)
401 def EVT_TOOL_RANGE(win
, id, id2
, func
):
402 win
.Connect(id, id2
, wxEVT_COMMAND_TOOL_CLICKED
, func
)
404 def EVT_TOOL_RCLICKED(win
, id, func
):
405 win
.Connect(id, -1, wxEVT_COMMAND_TOOL_RCLICKED
, func
)
407 def EVT_TOOL_RCLICKED_RANGE(win
, id, id2
, func
):
408 win
.Connect(id, id2
, wxEVT_COMMAND_TOOL_RCLICKED
, func
)
410 def EVT_TOOL_ENTER(win
, id, func
):
411 win
.Connect(id, -1, wxEVT_COMMAND_TOOL_ENTER
, func
)
413 def EVT_CHECKLISTBOX(win
, id, func
):
414 win
.Connect(id, -1, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
, func
)
416 def EVT_SPINCTRL(win
, id, func
):
417 win
.Connect(id, -1, wxEVT_COMMAND_SPINCTRL_UPDATED
, func
)
421 # Generic command events
423 def EVT_COMMAND_LEFT_CLICK(win
, id, func
):
424 win
.Connect(id, -1, wxEVT_COMMAND_LEFT_CLICK
, func
)
426 def EVT_COMMAND_LEFT_DCLICK(win
, id, func
):
427 win
.Connect(id, -1, wxEVT_COMMAND_LEFT_DCLICK
, func
)
429 def EVT_COMMAND_RIGHT_CLICK(win
, id, func
):
430 win
.Connect(id, -1, wxEVT_COMMAND_RIGHT_CLICK
, func
)
432 def EVT_COMMAND_RIGHT_DCLICK(win
, id, func
):
433 win
.Connect(id, -1, wxEVT_COMMAND_RIGHT_DCLICK
, func
)
435 def EVT_COMMAND_SET_FOCUS(win
, id, func
):
436 win
.Connect(id, -1, wxEVT_COMMAND_SET_FOCUS
, func
)
438 def EVT_COMMAND_KILL_FOCUS(win
, id, func
):
439 win
.Connect(id, -1, wxEVT_COMMAND_KILL_FOCUS
, func
)
441 def EVT_COMMAND_ENTER(win
, id, func
):
442 win
.Connect(id, -1, wxEVT_COMMAND_ENTER
, func
)
446 def EVT_NOTEBOOK_PAGE_CHANGED(win
, id, func
):
447 win
.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
, func
)
449 def EVT_NOTEBOOK_PAGE_CHANGING(win
, id, func
):
450 win
.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
, func
)
454 def EVT_TREE_BEGIN_DRAG(win
, id, func
):
455 win
.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_DRAG
, func
)
457 def EVT_TREE_BEGIN_RDRAG(win
, id, func
):
458 win
.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_RDRAG
, func
)
460 def EVT_TREE_BEGIN_LABEL_EDIT(win
, id, func
):
461 win
.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT
, func
)
463 def EVT_TREE_END_LABEL_EDIT(win
, id, func
):
464 win
.Connect(id, -1, wxEVT_COMMAND_TREE_END_LABEL_EDIT
, func
)
466 def EVT_TREE_GET_INFO(win
, id, func
):
467 win
.Connect(id, -1, wxEVT_COMMAND_TREE_GET_INFO
, func
)
469 def EVT_TREE_SET_INFO(win
, id, func
):
470 win
.Connect(id, -1, wxEVT_COMMAND_TREE_SET_INFO
, func
)
472 def EVT_TREE_ITEM_EXPANDED(win
, id, func
):
473 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDED
, func
)
475 def EVT_TREE_ITEM_EXPANDING(win
, id, func
):
476 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDING
, func
)
478 def EVT_TREE_ITEM_COLLAPSED(win
, id, func
):
479 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSED
, func
)
481 def EVT_TREE_ITEM_COLLAPSING(win
, id, func
):
482 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSING
, func
)
484 def EVT_TREE_SEL_CHANGED(win
, id, func
):
485 win
.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGED
, func
)
487 def EVT_TREE_SEL_CHANGING(win
, id, func
):
488 win
.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGING
, func
)
490 def EVT_TREE_KEY_DOWN(win
, id, func
):
491 win
.Connect(id, -1, wxEVT_COMMAND_TREE_KEY_DOWN
, func
)
493 def EVT_TREE_DELETE_ITEM(win
, id, func
):
494 win
.Connect(id, -1, wxEVT_COMMAND_TREE_DELETE_ITEM
, func
)
496 def EVT_TREE_ITEM_ACTIVATED(win
, id, func
):
497 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_ACTIVATED
, func
)
499 def EVT_TREE_ITEM_RIGHT_CLICK(win
, id, func
):
500 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK
, func
)
502 def EVT_TREE_ITEM_MIDDLE_CLICK(win
, id, func
):
503 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK
, func
)
507 def EVT_SPIN_UP(win
, id, func
):
508 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
510 def EVT_SPIN_DOWN(win
, id, func
):
511 win
.Connect(id, -1,wxEVT_SCROLL_LINEDOWN
, func
)
513 def EVT_SPIN(win
, id, func
):
514 win
.Connect(id, -1, wxEVT_SCROLL_TOP
, func
)
515 win
.Connect(id, -1, wxEVT_SCROLL_BOTTOM
, func
)
516 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
517 win
.Connect(id, -1, wxEVT_SCROLL_LINEDOWN
, func
)
518 win
.Connect(id, -1, wxEVT_SCROLL_PAGEUP
, func
)
519 win
.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
520 win
.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK
,func
)
526 def EVT_TASKBAR_MOVE(win
, func
):
527 win
.Connect(-1, -1, wxEVT_TASKBAR_MOVE
, func
)
529 def EVT_TASKBAR_LEFT_DOWN(win
, func
):
530 win
.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DOWN
, func
)
532 def EVT_TASKBAR_LEFT_UP(win
, func
):
533 win
.Connect(-1, -1, wxEVT_TASKBAR_LEFT_UP
, func
)
535 def EVT_TASKBAR_RIGHT_DOWN(win
, func
):
536 win
.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DOWN
, func
)
538 def EVT_TASKBAR_RIGHT_UP(win
, func
):
539 win
.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_UP
, func
)
541 def EVT_TASKBAR_LEFT_DCLICK(win
, func
):
542 win
.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DCLICK
, func
)
544 def EVT_TASKBAR_RIGHT_DCLICK(win
, func
):
545 win
.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DCLICK
, func
)
549 def EVT_GRID_SELECT_CELL(win
, fn
):
550 win
.Connect(-1, -1, wxEVT_GRID_SELECT_CELL
, fn
)
552 def EVT_GRID_CREATE_CELL(win
, fn
):
553 win
.Connect(-1, -1, wxEVT_GRID_CREATE_CELL
, fn
)
555 def EVT_GRID_CHANGE_LABELS(win
, fn
):
556 win
.Connect(-1, -1, wxEVT_GRID_CHANGE_LABELS
, fn
)
558 def EVT_GRID_CHANGE_SEL_LABEL(win
, fn
):
559 win
.Connect(-1, -1, wxEVT_GRID_CHANGE_SEL_LABEL
, fn
)
561 def EVT_GRID_CELL_CHANGE(win
, fn
):
562 win
.Connect(-1, -1, wxEVT_GRID_CELL_CHANGE
, fn
)
564 def EVT_GRID_CELL_LCLICK(win
, fn
):
565 win
.Connect(-1, -1, wxEVT_GRID_CELL_LCLICK
, fn
)
567 def EVT_GRID_CELL_RCLICK(win
, fn
):
568 win
.Connect(-1, -1, wxEVT_GRID_CELL_RCLICK
, fn
)
570 def EVT_GRID_LABEL_LCLICK(win
, fn
):
571 win
.Connect(-1, -1, wxEVT_GRID_LABEL_LCLICK
, fn
)
573 def EVT_GRID_LABEL_RCLICK(win
, fn
):
574 win
.Connect(-1, -1, wxEVT_GRID_LABEL_RCLICK
, fn
)
578 def EVT_SASH_DRAGGED(win
, id, func
):
579 win
.Connect(id, -1, wxEVT_SASH_DRAGGED
, func
)
581 def EVT_SASH_DRAGGED_RANGE(win
, id1
, id2
, func
):
582 win
.Connect(id1
, id2
, wxEVT_SASH_DRAGGED
, func
)
584 def EVT_QUERY_LAYOUT_INFO(win
, func
):
585 win
.Connect(-1, -1, wxEVT_EVT_QUERY_LAYOUT_INFO
, func
)
587 def EVT_CALCULATE_LAYOUT(win
, func
):
588 win
.Connect(-1, -1, wxEVT_EVT_CALCULATE_LAYOUT
, func
)
592 def EVT_LIST_BEGIN_DRAG(win
, id, func
):
593 win
.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_DRAG
, func
)
595 def EVT_LIST_BEGIN_RDRAG(win
, id, func
):
596 win
.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_RDRAG
, func
)
598 def EVT_LIST_BEGIN_LABEL_EDIT(win
, id, func
):
599 win
.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT
, func
)
601 def EVT_LIST_END_LABEL_EDIT(win
, id, func
):
602 win
.Connect(id, -1, wxEVT_COMMAND_LIST_END_LABEL_EDIT
, func
)
604 def EVT_LIST_DELETE_ITEM(win
, id, func
):
605 win
.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ITEM
, func
)
607 def EVT_LIST_DELETE_ALL_ITEMS(win
, id, func
):
608 win
.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS
, func
)
610 def EVT_LIST_GET_INFO(win
, id, func
):
611 win
.Connect(id, -1, wxEVT_COMMAND_LIST_GET_INFO
, func
)
613 def EVT_LIST_SET_INFO(win
, id, func
):
614 win
.Connect(id, -1, wxEVT_COMMAND_LIST_SET_INFO
, func
)
616 def EVT_LIST_ITEM_SELECTED(win
, id, func
):
617 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED
, func
)
619 def EVT_LIST_ITEM_ACTIVATED(win
, id, func
):
620 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED
, func
)
622 def EVT_LIST_ITEM_DESELECTED(win
, id, func
):
623 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_DESELECTED
, func
)
625 def EVT_LIST_KEY_DOWN(win
, id, func
):
626 win
.Connect(id, -1, wxEVT_COMMAND_LIST_KEY_DOWN
, func
)
628 def EVT_LIST_INSERT_ITEM(win
, id, func
):
629 win
.Connect(id, -1, wxEVT_COMMAND_LIST_INSERT_ITEM
, func
)
631 def EVT_LIST_COL_CLICK(win
, id, func
):
632 win
.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK
, func
)
634 def EVT_LIST_ITEM_RIGHT_CLICK(win
, id, func
):
635 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK
, func
)
637 def EVT_LIST_ITEM_MIDDLE_CLICK(win
, id, func
):
638 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK
, func
)
643 def EVT_SPLITTER_SASH_POS_CHANGING(win
, id, func
):
644 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING
, func
)
646 def EVT_SPLITTER_SASH_POS_CHANGED(win
, id, func
):
647 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED
, func
)
649 def EVT_SPLITTER_UNSPLIT(win
, id, func
):
650 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_UNSPLIT
, func
)
652 def EVT_SPLITTER_DOUBLECLICKED(win
, id, func
):
653 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_DOUBLECLICKED
, func
)
656 #----------------------------------------------------------------------
658 class wxTimer(wxPyTimer
):
660 wxPyTimer
.__init
__(self
, self
.Notify
) # derived class must provide
661 # Notify(self) method.
663 #----------------------------------------------------------------------
664 # Some wxWin methods can take "NULL" as parameters, but the shadow classes
665 # expect an object with the SWIG pointer as a 'this' member. This class
666 # and instance fools the shadow into passing the NULL pointer.
669 this
= 'NULL' # SWIG converts this to (void*)0
674 #----------------------------------------------------------------------
678 wxNamedColor
= wxNamedColour
680 wxPyDefaultPosition
.Set(-1,-1)
681 wxPyDefaultSize
.Set(-1,-1)
683 # aliases so that C++ documentation applies:
684 wxDefaultPosition
= wxPyDefaultPosition
685 wxDefaultSize
= wxPyDefaultSize
687 # backwards compatibility
688 wxNoRefBitmap
= wxBitmap
690 #----------------------------------------------------------------------
691 # This helper function will take a wxPython object and convert it to
692 # another wxPython object type. This will not be able to create objects
693 # that are derived from wxPython classes by the user, only those that are
694 # actually part of wxPython and directly corespond to C++ objects.
696 # This is useful in situations where some method returns a generic
697 # type such as wxWindow, but you know that it is actually some
698 # derived type such as a wxTextCtrl. You can't call wxTextCtrl specific
699 # methods on a wxWindow object, but you can use this function to
700 # create a wxTextCtrl object that will pass the same pointer to
701 # the C++ code. You use it like this:
703 # textCtrl = wxPyTypeCast(window, "wxTextCtrl")
706 # WARNING: Using this function to type cast objects into types that
707 # they are not is not recommended and is likely to cause your
708 # program to crash... Hard.
711 def wxPyTypeCast(obj
, typeStr
):
712 if hasattr(obj
, "this"):
713 newPtr
= ptrcast(obj
.this
, typeStr
+"_p")
715 newPtr
= ptrcast(obj
, typeStr
+"_p")
716 theClass
= globals()[typeStr
+"Ptr"]
717 theObj
= theClass(newPtr
)
718 if hasattr(obj
, "this"):
719 theObj
.thisown
= obj
.thisown
723 #----------------------------------------------------------------------
725 class wxPyOnDemandOutputWindow
:
726 def __init__(self
, title
= "wxPython: stdout/stderr"):
731 def SetParent(self
, parent
):
735 def OnCloseWindow(self
, event
):
736 if self
.frame
!= None:
742 # this provides the file-like behaviour
743 def write(self
, str):
745 self
.frame
= wxFrame(self
.parent
, -1, self
.title
)
746 self
.text
= wxTextCtrl(self
.frame
, -1, "",
747 style
= wxTE_MULTILINE|wxTE_READONLY
)
748 self
.frame
.SetSize(wxSize(450, 300))
749 self
.frame
.Show(true
)
750 EVT_CLOSE(self
.frame
, self
.OnCloseWindow
)
751 self
.text
.AppendText(str)
755 if self
.frame
!= None:
762 _defRedirect
= (wxPlatform
== '__WXMSW__')
764 #----------------------------------------------------------------------
765 # The main application class. Derive from this and implement an OnInit
766 # method that creates a frame and then calls self.SetTopWindow(frame)
768 class wxApp(wxPyApp
):
769 error
= 'wxApp.error'
770 outputWindowClass
= wxPyOnDemandOutputWindow
772 def __init__(self
, redirect
=_defRedirect
, filename
=None):
773 wxPyApp
.__init
__(self
)
775 self
.saveStdio
= (sys
.stdout
, sys
.stderr
)
777 self
.RedirectStdio(filename
)
778 # this initializes wxWindows and then calls our OnInit
779 _wxStart(self
.OnInit
)
789 def SetTopWindow(self
, frame
):
791 self
.stdioWin
.SetParent(frame
)
792 sys
.stderr
= sys
.stdout
= self
.stdioWin
793 wxPyApp
.SetTopWindow(self
, frame
)
797 wxPyApp
.MainLoop(self
)
801 def RedirectStdio(self
, filename
):
803 sys
.stdout
= sys
.stderr
= open(filename
, 'a')
805 self
.stdioWin
= self
.outputWindowClass() # wxPyOnDemandOutputWindow
808 def RestoreStdio(self
):
809 sys
.stdout
, sys
.stderr
= self
.saveStdio
810 if self
.stdioWin
!= None:
811 self
.stdioWin
.close()
813 #----------------------------------------------------------------------------
815 class wxPySimpleApp(wxApp
):
817 wxApp
.__init
__(self
, 0)
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 #----------------------------------------------------------------------------