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 _checkClassCallback(obj, name):
33 ## try: cb = getattr(obj, name)
35 ## else: obj._addCallback(name, cb)
38 def _StdWindowCallbacks(win
):
39 _checkForCallback(win
, "OnChar", wxEVT_CHAR
)
40 _checkForCallback(win
, "OnSize", wxEVT_SIZE
)
41 _checkForCallback(win
, "OnEraseBackground", wxEVT_ERASE_BACKGROUND
)
42 _checkForCallback(win
, "OnSysColourChanged", wxEVT_SYS_COLOUR_CHANGED
)
43 _checkForCallback(win
, "OnInitDialog", wxEVT_INIT_DIALOG
)
44 _checkForCallback(win
, "OnPaint", wxEVT_PAINT
)
45 _checkForCallback(win
, "OnIdle", wxEVT_IDLE
)
48 def _StdFrameCallbacks(win
):
49 _StdWindowCallbacks(win
)
50 _checkForCallback(win
, "OnActivate", wxEVT_ACTIVATE
)
51 _checkForCallback(win
, "OnMenuHighlight", wxEVT_MENU_HIGHLIGHT
)
52 _checkForCallback(win
, "OnCloseWindow", wxEVT_CLOSE_WINDOW
)
55 def _StdDialogCallbacks(win
):
56 _StdWindowCallbacks(win
)
57 _checkForCallback(win
, "OnOk", wxEVT_COMMAND_BUTTON_CLICKED
, wxID_OK
)
58 _checkForCallback(win
, "OnApply", wxEVT_COMMAND_BUTTON_CLICKED
, wxID_APPLY
)
59 _checkForCallback(win
, "OnCancel", wxEVT_COMMAND_BUTTON_CLICKED
, wxID_CANCEL
)
60 _checkForCallback(win
, "OnCloseWindow", wxEVT_CLOSE_WINDOW
)
61 _checkForCallback(win
, "OnCharHook", wxEVT_CHAR_HOOK
)
64 def _StdOnScrollCallbacks(win
):
65 try: cb
= getattr(win
, "OnScroll")
67 else: EVT_SCROLL(win
, cb
)
71 #----------------------------------------------------------------------
72 #----------------------------------------------------------------------
73 # functions that look and act like the C++ Macros of the same name
77 def EVT_SIZE(win
, func
):
78 win
.Connect(-1, -1, wxEVT_SIZE
, func
)
80 def EVT_MOVE(win
, func
):
81 win
.Connect(-1, -1, wxEVT_MOVE
, func
)
83 def EVT_CLOSE(win
, func
):
84 win
.Connect(-1, -1, wxEVT_CLOSE_WINDOW
, func
)
86 def EVT_PAINT(win
, func
):
87 win
.Connect(-1, -1, wxEVT_PAINT
, func
)
89 def EVT_ERASE_BACKGROUND(win
, func
):
90 win
.Connect(-1, -1, wxEVT_ERASE_BACKGROUND
, func
)
92 def EVT_CHAR(win
, func
):
93 win
.Connect(-1, -1, wxEVT_CHAR
, func
)
95 def EVT_CHAR_HOOK(win
, func
):
96 win
.Connect(-1, -1, wxEVT_CHAR_HOOK
, func
)
98 def EVT_KEY_DOWN(win
, func
):
99 win
.Connect(-1, -1, wxEVT_KEY_DOWN
, func
)
101 def EVT_KEY_UP(win
, func
):
102 win
.Connect(-1, -1, wxEVT_KEY_UP
, func
)
104 def EVT_MENU_HIGHLIGHT(win
, id, func
):
105 win
.Connect(id, -1, wxEVT_MENU_HIGHLIGHT
, func
)
107 def EVT_MENU_HIGHLIGHT_ALL(win
, func
):
108 win
.Connect(-1, -1, wxEVT_MENU_HIGHLIGHT
, func
)
110 def EVT_SET_FOCUS(win
, func
):
111 win
.Connect(-1, -1, wxEVT_SET_FOCUS
, func
)
113 def EVT_KILL_FOCUS(win
, func
):
114 win
.Connect(-1, -1, wxEVT_KILL_FOCUS
, func
)
116 def EVT_ACTIVATE(win
, func
):
117 win
.Connect(-1, -1, wxEVT_ACTIVATE
, func
)
119 def EVT_ACTIVATE_APP(win
, func
):
120 win
.Connect(-1, -1, wxEVT_ACTIVATE_APP
, func
)
122 def EVT_END_SESSION(win
, func
):
123 win
.Connect(-1, -1, wxEVT_END_SESSION
, func
)
125 def EVT_QUERY_END_SESSION(win
, func
):
126 win
.Connect(-1, -1, wxEVT_QUERY_END_SESSION
, func
)
128 def EVT_DROP_FILES(win
, func
):
129 win
.Connect(-1, -1, wxEVT_DROP_FILES
, func
)
131 def EVT_INIT_DIALOG(win
, func
):
132 win
.Connect(-1, -1, wxEVT_INIT_DIALOG
, func
)
134 def EVT_SYS_COLOUR_CHANGED(win
, func
):
135 win
.Connect(-1, -1, wxEVT_SYS_COLOUR_CHANGED
, func
)
137 def EVT_SHOW(win
, func
):
138 win
.Connect(-1, -1, wxEVT_SHOW
, func
)
140 def EVT_MAXIMIZE(win
, func
):
141 win
.Connect(-1, -1, wxEVT_MAXIMIZE
, func
)
143 def EVT_ICONIZE(win
, func
):
144 win
.Connect(-1, -1, wxEVT_ICONIZE
, func
)
146 def EVT_NAVIGATION_KEY(win
, func
):
147 win
.Connect(-1, -1, wxEVT_NAVIGATION_KEY
, func
)
149 def EVT_IDLE(win
, func
):
150 win
.Connect(-1, -1, wxEVT_IDLE
, func
)
152 def EVT_UPDATE_UI(win
, id, func
):
153 win
.Connect(id, -1, wxEVT_UPDATE_UI
, func
)
157 def EVT_LEFT_DOWN(win
, func
):
158 win
.Connect(-1, -1, wxEVT_LEFT_DOWN
, func
)
160 def EVT_LEFT_UP(win
, func
):
161 win
.Connect(-1, -1, wxEVT_LEFT_UP
, func
)
163 def EVT_MIDDLE_DOWN(win
, func
):
164 win
.Connect(-1, -1, wxEVT_MIDDLE_DOWN
, func
)
166 def EVT_MIDDLE_UP(win
, func
):
167 win
.Connect(-1, -1, wxEVT_MIDDLE_UP
, func
)
169 def EVT_RIGHT_DOWN(win
, func
):
170 win
.Connect(-1, -1, wxEVT_RIGHT_DOWN
, func
)
172 def EVT_RIGHT_UP(win
, func
):
173 win
.Connect(-1, -1, wxEVT_RIGHT_UP
, func
)
175 def EVT_MOTION(win
, func
):
176 win
.Connect(-1, -1, wxEVT_MOTION
, func
)
178 def EVT_LEFT_DCLICK(win
, func
):
179 win
.Connect(-1, -1, wxEVT_LEFT_DCLICK
, func
)
181 def EVT_MIDDLE_DCLICK(win
, func
):
182 win
.Connect(-1, -1, wxEVT_MIDDLE_DCLICK
, func
)
184 def EVT_RIGHT_DCLICK(win
, func
):
185 win
.Connect(-1, -1, wxEVT_RIGHT_DCLICK
, func
)
187 def EVT_LEAVE_WINDOW(win
, func
):
188 win
.Connect(-1, -1, wxEVT_LEAVE_WINDOW
, func
)
190 def EVT_ENTER_WINDOW(win
, func
):
191 win
.Connect(-1, -1, wxEVT_ENTER_WINDOW
, func
)
195 def EVT_MOUSE_EVENTS(win
, func
):
196 win
.Connect(-1, -1, wxEVT_LEFT_DOWN
, func
)
197 win
.Connect(-1, -1, wxEVT_LEFT_UP
, func
)
198 win
.Connect(-1, -1, wxEVT_MIDDLE_DOWN
, func
)
199 win
.Connect(-1, -1, wxEVT_MIDDLE_UP
, func
)
200 win
.Connect(-1, -1, wxEVT_RIGHT_DOWN
, func
)
201 win
.Connect(-1, -1, wxEVT_RIGHT_UP
, func
)
202 win
.Connect(-1, -1, wxEVT_MOTION
, func
)
203 win
.Connect(-1, -1, wxEVT_LEFT_DCLICK
, func
)
204 win
.Connect(-1, -1, wxEVT_MIDDLE_DCLICK
, func
)
205 win
.Connect(-1, -1, wxEVT_RIGHT_DCLICK
, func
)
206 win
.Connect(-1, -1, wxEVT_LEAVE_WINDOW
, func
)
207 win
.Connect(-1, -1, wxEVT_ENTER_WINDOW
, func
)
210 def EVT_COMMAND(win
, id, cmd
, func
):
211 win
.Connect(id, -1, cmd
, func
)
213 def EVT_COMMAND_RANGE(win
, id1
, id2
, cmd
, func
):
214 win
.Connect(id1
, id2
, cmd
, func
)
217 def EVT_SCROLL(win
, func
):
218 win
.Connect(-1, -1, wxEVT_SCROLL_TOP
, func
)
219 win
.Connect(-1, -1, wxEVT_SCROLL_BOTTOM
, func
)
220 win
.Connect(-1, -1, wxEVT_SCROLL_LINEUP
, func
)
221 win
.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN
, func
)
222 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEUP
, func
)
223 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
224 win
.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK
,func
)
226 def EVT_SCROLL_TOP(win
, func
):
227 win
.Connect(-1, -1, wxEVT_SCROLL_TOP
, func
)
229 def EVT_SCROLL_BOTTOM(win
, func
):
230 win
.Connect(-1, -1, wxEVT_SCROLL_BOTTOM
, func
)
232 def EVT_SCROLL_LINEUP(win
, func
):
233 win
.Connect(-1, -1, wxEVT_SCROLL_LINEUP
, func
)
235 def EVT_SCROLL_LINEDOWN(win
, func
):
236 win
.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN
, func
)
238 def EVT_SCROLL_PAGEUP(win
, func
):
239 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEUP
, func
)
241 def EVT_SCROLL_PAGEDOWN(win
, func
):
242 win
.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
244 def EVT_SCROLL_THUMBTRACK(win
, func
):
245 win
.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK
, func
)
249 # Scrolling, with an id
250 def EVT_COMMAND_SCROLL(win
, id, func
):
251 win
.Connect(id, -1, wxEVT_SCROLL_TOP
, func
)
252 win
.Connect(id, -1, wxEVT_SCROLL_BOTTOM
, func
)
253 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
254 win
.Connect(id, -1, wxEVT_SCROLL_LINEDOWN
, func
)
255 win
.Connect(id, -1, wxEVT_SCROLL_PAGEUP
, func
)
256 win
.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
257 win
.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK
,func
)
259 def EVT_COMMAND_SCROLL_TOP(win
, id, func
):
260 win
.Connect(id, -1, wxEVT_SCROLL_TOP
, func
)
262 def EVT_COMMAND_SCROLL_BOTTOM(win
, id, func
):
263 win
.Connect(id, -1, wxEVT_SCROLL_BOTTOM
, func
)
265 def EVT_COMMAND_SCROLL_LINEUP(win
, id, func
):
266 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
268 def EVT_COMMAND_SCROLL_LINEDOWN(win
, id, func
):
269 win
.Connect(id, -1, wxEVT_SCROLL_LINEDOWN
, func
)
271 def EVT_COMMAND_SCROLL_PAGEUP(win
, id, func
):
272 win
.Connect(id, -1, wxEVT_SCROLL_PAGEUP
, func
)
274 def EVT_COMMAND_SCROLL_PAGEDOWN(win
, id, func
):
275 win
.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
277 def EVT_COMMAND_SCROLL_THUMBTRACK(win
, id, func
):
278 win
.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK
, func
)
281 # Convenience commands
282 def EVT_BUTTON(win
, id, func
):
283 win
.Connect(id, -1, wxEVT_COMMAND_BUTTON_CLICKED
, func
)
285 def EVT_CHECKBOX(win
, id, func
):
286 win
.Connect(id, -1, wxEVT_COMMAND_CHECKBOX_CLICKED
, func
)
288 def EVT_CHOICE(win
, id, func
):
289 win
.Connect(id, -1, wxEVT_COMMAND_CHOICE_SELECTED
, func
)
291 def EVT_LISTBOX(win
, id, func
):
292 win
.Connect(id, -1, wxEVT_COMMAND_LISTBOX_SELECTED
, func
)
294 def EVT_LISTBOX_DCLICK(win
, id, func
):
295 win
.Connect(id, -1, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
, func
)
297 def EVT_TEXT(win
, id, func
):
298 win
.Connect(id, -1, wxEVT_COMMAND_TEXT_UPDATED
, func
)
300 def EVT_TEXT_ENTER(win
, id, func
):
301 win
.Connect(id, -1, wxEVT_COMMAND_TEXT_ENTER
, func
)
303 def EVT_MENU(win
, id, func
):
304 win
.Connect(id, -1, wxEVT_COMMAND_MENU_SELECTED
, func
)
306 def EVT_MENU_RANGE(win
, id1
, id2
, func
):
307 win
.Connect(id1
, id2
, wxEVT_COMMAND_MENU_SELECTED
, func
)
309 def EVT_SLIDER(win
, id, func
):
310 win
.Connect(id, -1, wxEVT_COMMAND_SLIDER_UPDATED
, func
)
312 def EVT_RADIOBOX(win
, id, func
):
313 win
.Connect(id, -1, wxEVT_COMMAND_RADIOBOX_SELECTED
, func
)
315 def EVT_RADIOBUTTON(win
, id, func
):
316 win
.Connect(id, -1, wxEVT_COMMAND_RADIOBUTTON_SELECTED
, func
)
318 def EVT_VLBOX(win
, id, func
):
319 win
.Connect(id, -1, wxEVT_COMMAND_VLBOX_SELECTED
, func
)
321 def EVT_COMBOBOX(win
, id, func
):
322 win
.Connect(id, -1, wxEVT_COMMAND_COMBOBOX_SELECTED
, func
)
324 def EVT_TOOL(win
, id, func
):
325 win
.Connect(id, -1, wxEVT_COMMAND_TOOL_CLICKED
, func
)
327 def EVT_TOOL_RCLICKED(win
, id, func
):
328 win
.Connect(id, -1, wxEVT_COMMAND_TOOL_RCLICKED
, func
)
330 def EVT_TOOL_ENTER(win
, id, func
):
331 win
.Connect(id, -1, wxEVT_COMMAND_TOOL_ENTER
, func
)
333 def EVT_CHECKLISTBOX(win
, id, func
):
334 win
.Connect(id, -1, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED
, func
)
337 # Generic command events
339 def EVT_COMMAND_LEFT_CLICK(win
, id, func
):
340 win
.Connect(id, -1, wxEVT_COMMAND_LEFT_CLICK
, func
)
342 def EVT_COMMAND_LEFT_DCLICK(win
, id, func
):
343 win
.Connect(id, -1, wxEVT_COMMAND_LEFT_DCLICK
, func
)
345 def EVT_COMMAND_RIGHT_CLICK(win
, id, func
):
346 win
.Connect(id, -1, wxEVT_COMMAND_RIGHT_CLICK
, func
)
348 def EVT_COMMAND_RIGHT_DCLICK(win
, id, func
):
349 win
.Connect(id, -1, wxEVT_COMMAND_RIGHT_DCLICK
, func
)
351 def EVT_COMMAND_SET_FOCUS(win
, id, func
):
352 win
.Connect(id, -1, wxEVT_COMMAND_SET_FOCUS
, func
)
354 def EVT_COMMAND_KILL_FOCUS(win
, id, func
):
355 win
.Connect(id, -1, wxEVT_COMMAND_KILL_FOCUS
, func
)
357 def EVT_COMMAND_ENTER(win
, id, func
):
358 win
.Connect(id, -1, wxEVT_COMMAND_ENTER
, func
)
362 def EVT_NOTEBOOK_PAGE_CHANGED(win
, id, func
):
363 win
.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED
, func
)
365 def EVT_NOTEBOOK_PAGE_CHANGING(win
, id, func
):
366 win
.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING
, func
)
370 def EVT_TREE_BEGIN_DRAG(win
, id, func
):
371 win
.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_DRAG
, func
)
373 def EVT_TREE_BEGIN_RDRAG(win
, id, func
):
374 win
.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_RDRAG
, func
)
376 def EVT_TREE_BEGIN_LABEL_EDIT(win
, id, func
):
377 win
.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT
, func
)
379 def EVT_TREE_END_LABEL_EDIT(win
, id, func
):
380 win
.Connect(id, -1, wxEVT_COMMAND_TREE_END_LABEL_EDIT
, func
)
382 def EVT_TREE_GET_INFO(win
, id, func
):
383 win
.Connect(id, -1, wxEVT_COMMAND_TREE_GET_INFO
, func
)
385 def EVT_TREE_SET_INFO(win
, id, func
):
386 win
.Connect(id, -1, wxEVT_COMMAND_TREE_SET_INFO
, func
)
388 def EVT_TREE_ITEM_EXPANDED(win
, id, func
):
389 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDED
, func
)
391 def EVT_TREE_ITEM_EXPANDING(win
, id, func
):
392 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDING
, func
)
394 def EVT_TREE_ITEM_COLLAPSED(win
, id, func
):
395 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSED
, func
)
397 def EVT_TREE_ITEM_COLLAPSING(win
, id, func
):
398 win
.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSING
, func
)
400 def EVT_TREE_SEL_CHANGED(win
, id, func
):
401 win
.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGED
, func
)
403 def EVT_TREE_SEL_CHANGING(win
, id, func
):
404 win
.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGING
, func
)
406 def EVT_TREE_KEY_DOWN(win
, id, func
):
407 win
.Connect(id, -1, wxEVT_COMMAND_TREE_KEY_DOWN
, func
)
409 def EVT_TREE_DELETE_ITEM(win
, id, func
):
410 win
.Connect(id, -1, wxEVT_COMMAND_TREE_DELETE_ITEM
, func
)
414 def EVT_SPIN_UP(win
, id, func
):
415 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
417 def EVT_SPIN_DOWN(win
, id, func
):
418 win
.Connect(id, -1,wxEVT_SCROLL_LINEDOWN
, func
)
420 def EVT_SPIN(win
, id, func
):
421 win
.Connect(id, -1, wxEVT_SCROLL_TOP
, func
)
422 win
.Connect(id, -1, wxEVT_SCROLL_BOTTOM
, func
)
423 win
.Connect(id, -1, wxEVT_SCROLL_LINEUP
, func
)
424 win
.Connect(id, -1, wxEVT_SCROLL_LINEDOWN
, func
)
425 win
.Connect(id, -1, wxEVT_SCROLL_PAGEUP
, func
)
426 win
.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN
, func
)
427 win
.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK
,func
)
433 def EVT_TASKBAR_MOVE(win
, func
):
434 win
.Connect(-1, -1, wxEVT_TASKBAR_MOVE
, func
)
436 def EVT_TASKBAR_LEFT_DOWN(win
, func
):
437 win
.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DOWN
, func
)
439 def EVT_TASKBAR_LEFT_UP(win
, func
):
440 win
.Connect(-1, -1, wxEVT_TASKBAR_LEFT_UP
, func
)
442 def EVT_TASKBAR_RIGHT_DOWN(win
, func
):
443 win
.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DOWN
, func
)
445 def EVT_TASKBAR_RIGHT_UP(win
, func
):
446 win
.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_UP
, func
)
448 def EVT_TASKBAR_LEFT_DCLICK(win
, func
):
449 win
.Connect(-1, -1, wxEVT_TASKBAR_LEFT_DCLICK
, func
)
451 def EVT_TASKBAR_RIGHT_DCLICK(win
, func
):
452 win
.Connect(-1, -1, wxEVT_TASKBAR_RIGHT_DCLICK
, func
)
456 def EVT_GRID_SELECT_CELL(win
, fn
):
457 win
.Connect(-1, -1, wxEVT_GRID_SELECT_CELL
, fn
)
459 def EVT_GRID_CREATE_CELL(win
, fn
):
460 win
.Connect(-1, -1, wxEVT_GRID_CREATE_CELL
, fn
)
462 def EVT_GRID_CHANGE_LABELS(win
, fn
):
463 win
.Connect(-1, -1, wxEVT_GRID_CHANGE_LABELS
, fn
)
465 def EVT_GRID_CHANGE_SEL_LABEL(win
, fn
):
466 win
.Connect(-1, -1, wxEVT_GRID_CHANGE_SEL_LABEL
, fn
)
468 def EVT_GRID_CELL_CHANGE(win
, fn
):
469 win
.Connect(-1, -1, wxEVT_GRID_CELL_CHANGE
, fn
)
471 def EVT_GRID_CELL_LCLICK(win
, fn
):
472 win
.Connect(-1, -1, wxEVT_GRID_CELL_LCLICK
, fn
)
474 def EVT_GRID_CELL_RCLICK(win
, fn
):
475 win
.Connect(-1, -1, wxEVT_GRID_CELL_RCLICK
, fn
)
477 def EVT_GRID_LABEL_LCLICK(win
, fn
):
478 win
.Connect(-1, -1, wxEVT_GRID_LABEL_LCLICK
, fn
)
480 def EVT_GRID_LABEL_RCLICK(win
, fn
):
481 win
.Connect(-1, -1, wxEVT_GRID_LABEL_RCLICK
, fn
)
485 def EVT_SASH_DRAGGED(win
, id, func
):
486 win
.Connect(id, -1, wxEVT_SASH_DRAGGED
, func
)
488 def EVT_SASH_DRAGGED_RANGE(win
, id1
, id2
, func
):
489 win
.Connect(id1
, id2
, wxEVT_SASH_DRAGGED
, func
)
491 def EVT_QUERY_LAYOUT_INFO(win
, func
):
492 win
.Connect(-1, -1, wxEVT_EVT_QUERY_LAYOUT_INFO
, func
)
494 def EVT_CALCULATE_LAYOUT(win
, func
):
495 win
.Connect(-1, -1, wxEVT_EVT_CALCULATE_LAYOUT
, func
)
499 def EVT_LIST_BEGIN_DRAG(win
, id, func
):
500 win
.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_DRAG
, func
)
502 def EVT_LIST_BEGIN_RDRAG(win
, id, func
):
503 win
.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_RDRAG
, func
)
505 def EVT_LIST_BEGIN_LABEL_EDIT(win
, id, func
):
506 win
.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT
, func
)
508 def EVT_LIST_END_LABEL_EDIT(win
, id, func
):
509 win
.Connect(id, -1, wxEVT_COMMAND_LIST_END_LABEL_EDIT
, func
)
511 def EVT_LIST_DELETE_ITEM(win
, id, func
):
512 win
.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ITEM
, func
)
514 def EVT_LIST_DELETE_ALL_ITEMS(win
, id, func
):
515 win
.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS
, func
)
517 def EVT_LIST_GET_INFO(win
, id, func
):
518 win
.Connect(id, -1, wxEVT_COMMAND_LIST_GET_INFO
, func
)
520 def EVT_LIST_SET_INFO(win
, id, func
):
521 win
.Connect(id, -1, wxEVT_COMMAND_LIST_SET_INFO
, func
)
523 def EVT_LIST_ITEM_SELECTED(win
, id, func
):
524 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED
, func
)
526 def EVT_LIST_ITEM_ACTIVATED(win
, id, func
):
527 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED
, func
)
529 def EVT_LIST_ITEM_DESELECTED(win
, id, func
):
530 win
.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_DESELECTED
, func
)
532 def EVT_LIST_KEY_DOWN(win
, id, func
):
533 win
.Connect(id, -1, wxEVT_COMMAND_LIST_KEY_DOWN
, func
)
535 def EVT_LIST_INSERT_ITEM(win
, id, func
):
536 win
.Connect(id, -1, wxEVT_COMMAND_LIST_INSERT_ITEM
, func
)
538 def EVT_LIST_COL_CLICK(win
, id, func
):
539 win
.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK
, func
)
542 def EVT_SPLITTER_SASH_POS_CHANGING(win
, id, func
):
543 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING
, func
)
545 def EVT_SPLITTER_SASH_POS_CHANGED(win
, id, func
):
546 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED
, func
)
548 def EVT_SPLITTER_UNSPLIT(win
, id, func
):
549 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_UNSPLIT
, func
)
551 def EVT_SPLITTER_DOUBLECLICKED(win
, id, func
):
552 win
.Connect(id, -1, wxEVT_COMMAND_SPLITTER_DOUBLECLICKED
, func
)
555 #----------------------------------------------------------------------
557 class wxTimer(wxPyTimer
):
559 wxPyTimer
.__init
__(self
, self
.Notify
) # derived class must provide
560 # Notify(self) method.
562 #----------------------------------------------------------------------
563 # Some wxWin methods can take "NULL" as parameters, but the shadow classes
564 # expect an object with the SWIG pointer as a 'this' member. This class
565 # and instance fools the shadow into passing the NULL pointer.
568 this
= 'NULL' # SWIG converts this to (void*)0
573 #----------------------------------------------------------------------
577 wxNamedColor
= wxNamedColour
579 wxPyDefaultPosition
.Set(-1,-1)
580 wxPyDefaultSize
.Set(-1,-1)
582 # aliases so that C++ documentation applies:
583 wxDefaultPosition
= wxPyDefaultPosition
584 wxDefaultSize
= wxPyDefaultSize
587 # This is to cover up a bug in SWIG. We are redefining
588 # the shadow class that is generated for wxAcceleratorTable
589 # because SWIG incorrectly uses "arg0.this"
590 class wxAcceleratorTable(wxAcceleratorTablePtr
):
591 def __init__(self
,arg0
) :
592 self
.this
= miscc
.new_wxAcceleratorTable(arg0
)
595 #----------------------------------------------------------------------
596 # This helper function will take a wxPython object and convert it to
597 # another wxPython object type. This will not be able to create objects
598 # that are derived from wxPython classes by the user, only those that are
599 # actually part of wxPython and directly corespond to C++ objects.
601 # This is useful in situations where some method returns a generic
602 # type such as wxWindow, but you know that it is actually some
603 # derived type such as a wxTextCtrl. You can't call wxTextCtrl specific
604 # methods on a wxWindow object, but you can use this function to
605 # create a wxTextCtrl object that will pass the same pointer to
606 # the C++ code. You use it like this:
608 # textCtrl = wxPyTypeCast(window, "wxTextCtrl")
611 # WARNING: Using this function to type cast objects into types that
612 # they are not is not recommended and is likely to cause your
613 # program to crash... Hard.
616 def wxPyTypeCast(obj
, typeStr
):
617 if hasattr(obj
, "this"):
618 newPtr
= ptrcast(obj
.this
, typeStr
+"_p")
620 newPtr
= ptrcast(obj
, typeStr
+"_p")
621 theClass
= globals()[typeStr
+"Ptr"]
622 theObj
= theClass(newPtr
)
623 theObj
.thisown
= obj
.thisown
627 #----------------------------------------------------------------------
629 ## class wxPyStdOutWindow:
630 ## def __init__(self, title = "wxPython: stdout/stderr"):
632 ## self.title = title
634 ## def write(self, str):
635 ## if not self.frame:
636 ## self.frame = wxFrame(NULL, -1, self.title)
637 ## self.text = wxTextCtrl(self.frame, -1, "", wxPoint(0,0), wxDefaultSize,
638 ## wxTE_MULTILINE|wxTE_READONLY)
639 ## self.frame.SetSize(wxSize(450, 300))
640 ## self.frame.Show(true)
641 ## EVT_CLOSE(self.frame, self.OnCloseWindow)
642 ## self.text.AppendText(str)
644 ## def OnCloseWindow(self, event):
646 ## self.frame.Destroy()
653 ## self.frame.Close(true)
655 _defRedirect
= (wxPlatform
== '__WXMSW__')
657 #----------------------------------------------------------------------
658 # The main application class. Derive from this and implement an OnInit
659 # method that creates a frame and then calls self.SetTopWindow(frame)
661 class wxApp(wxPyApp
):
662 error
= 'wxApp.error'
664 def __init__(self
, redirect
=_defRedirect
, filename
=None):
665 wxPyApp
.__init
__(self
)
667 self
.saveStdio
= (sys
.stdout
, sys
.stderr
)
669 self
.RedirectStdio(filename
)
671 # this initializes wxWindows and then calls our OnInit
672 _wxStart(self
.OnInit
)
681 def RedirectStdio(self
, filename
):
683 sys
.stdout
= sys
.stderr
= open(filename
, 'a')
685 raise self
.error
, 'wxPyStdOutWindow not yet implemented.'
686 #self.stdioWin = sys.stdout = sys.stderr = wxPyStdOutWindow()
688 def RestoreStdio(self
):
689 sys
.stdout
, sys
.stderr
= self
.saveStdio
690 if self
.stdioWin
!= None:
691 self
.stdioWin
.close()
694 #----------------------------------------------------------------------------
695 # DO NOT hold any other references to this object. This is how we know when
696 # to cleanup system resources that wxWin is holding...
697 __cleanMeUp
= __wxPyCleanup()
698 #----------------------------------------------------------------------------