]>
Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | #---------------------------------------------------------------------------- |
2 | # Name: _extra.py | |
3 | # Purpose: This file is appended to the shadow class file generated | |
4 | # by SWIG. We add some unSWIGable things here. | |
5 | # | |
6 | # Author: Robin Dunn | |
7 | # | |
8 | # Created: 6/30/97 | |
9 | # RCS-ID: $Id$ | |
10 | # Copyright: (c) 1998 by Total Control Software | |
11 | # Licence: wxWindows license | |
12 | #---------------------------------------------------------------------------- | |
13 | ||
14 | import sys | |
15 | ||
16 | #---------------------------------------------------------------------- | |
17 | # This gives this module's dictionary to the C++ extension code... | |
18 | ||
19 | _wxSetDictionary(vars()) | |
20 | ||
21 | ||
22 | #---------------------------------------------------------------------- | |
23 | #---------------------------------------------------------------------- | |
24 | # Helper function to link python methods to wxWindows virtual | |
25 | # functions by name. | |
26 | ||
27 | def _checkForCallback(obj, name, event, theID=-1): | |
28 | try: cb = getattr(obj, name) | |
29 | except: pass | |
30 | else: obj.Connect(theID, -1, event, cb) | |
31 | ||
32 | def _StdWindowCallbacks(win): | |
33 | _checkForCallback(win, "OnChar", wxEVT_CHAR) | |
34 | _checkForCallback(win, "OnSize", wxEVT_SIZE) | |
35 | _checkForCallback(win, "OnEraseBackground", wxEVT_ERASE_BACKGROUND) | |
36 | _checkForCallback(win, "OnSysColourChanged", wxEVT_SYS_COLOUR_CHANGED) | |
37 | _checkForCallback(win, "OnInitDialog", wxEVT_INIT_DIALOG) | |
38 | _checkForCallback(win, "OnIdle", wxEVT_IDLE) | |
39 | _checkForCallback(win, "OnPaint", wxEVT_PAINT) | |
40 | ||
41 | def _StdFrameCallbacks(win): | |
42 | _StdWindowCallbacks(win) | |
43 | _checkForCallback(win, "OnActivate", wxEVT_ACTIVATE) | |
44 | _checkForCallback(win, "OnMenuHighlight", wxEVT_MENU_HIGHLIGHT) | |
45 | _checkForCallback(win, "OnCloseWindow", wxEVT_CLOSE_WINDOW) | |
46 | ||
47 | ||
48 | def _StdOnScrollCallback(win): | |
49 | try: cb = getattr(win, "OnScroll") | |
50 | except: pass | |
51 | else: EVT_SCROLL(win, cb) | |
52 | ||
53 | ||
54 | ||
55 | #---------------------------------------------------------------------- | |
56 | #---------------------------------------------------------------------- | |
57 | # functions that look and act like the C++ Macros of the same name | |
58 | ||
59 | ||
60 | # Miscellaneous | |
61 | def EVT_SIZE(win, func): | |
62 | win.Connect(-1, -1, wxEVT_SIZE, func) | |
63 | ||
64 | def EVT_MOVE(win, func): | |
65 | win.Connect(-1, -1, wxEVT_MOVE, func) | |
66 | ||
67 | def EVT_CLOSE(win, func): | |
68 | win.Connect(-1, -1, wxEVT_CLOSE_WINDOW, func) | |
69 | ||
70 | def EVT_PAINT(win, func): | |
71 | win.Connect(-1, -1, wxEVT_PAINT, func) | |
72 | ||
73 | def EVT_ERASE_BACKGROUND(win, func): | |
74 | win.Connect(-1, -1, wxEVT_ERASE_BACKGROUND, func) | |
75 | ||
76 | def EVT_CHAR(win, func): | |
77 | win.Connect(-1, -1, wxEVT_CHAR, func) | |
78 | ||
79 | def EVT_CHAR_HOOK(win, func): | |
80 | win.Connect(-1, -1, wxEVT_CHAR_HOOK, func) | |
81 | ||
82 | def EVT_MENU_HIGHLIGHT(win, id, func): | |
83 | win.Connect(id, -1, wxEVT_MENU_HIGHLIGHT, func) | |
84 | ||
85 | def EVT_MENU_HIGHLIGHT_ALL(win, func): | |
86 | win.Connect(-1, -1, wxEVT_MENU_HIGHLIGHT, func) | |
87 | ||
88 | def EVT_SET_FOCUS(win, func): | |
89 | win.Connect(-1, -1, wxEVT_SET_FOCUS, func) | |
90 | ||
91 | def EVT_KILL_FOCUS(win, func): | |
92 | win.Connect(-1, -1, wxEVT_KILL_FOCUS, func) | |
93 | ||
94 | def EVT_ACTIVATE(win, func): | |
95 | win.Connect(-1, -1, wxEVT_ACTIVATE, func) | |
96 | ||
97 | def EVT_ACTIVATE_APP(win, func): | |
98 | win.Connect(-1, -1, wxEVT_ACTIVATE_APP, func) | |
99 | ||
100 | def EVT_END_SESSION(win, func): | |
101 | win.Connect(-1, -1, wxEVT_END_SESSION, func) | |
102 | ||
103 | def EVT_QUERY_END_SESSION(win, func): | |
104 | win.Connect(-1, -1, wxEVT_QUERY_END_SESSION, func) | |
105 | ||
106 | def EVT_DROP_FILES(win, func): | |
107 | win.Connect(-1, -1, wxEVT_DROP_FILES, func) | |
108 | ||
109 | def EVT_INIT_DIALOG(win, func): | |
110 | win.Connect(-1, -1, wxEVT_INIT_DIALOG, func) | |
111 | ||
112 | def EVT_SYS_COLOUR_CHANGED(win, func): | |
113 | win.Connect(-1, -1, wxEVT_SYS_COLOUR_CHANGED, func) | |
114 | ||
115 | def EVT_SHOW(win, func): | |
116 | win.Connect(-1, -1, wxEVT_SHOW, func) | |
117 | ||
118 | def EVT_MAXIMIZE(win, func): | |
119 | win.Connect(-1, -1, wxEVT_MAXIMIZE, func) | |
120 | ||
121 | def EVT_ICONIZE(win, func): | |
122 | win.Connect(-1, -1, wxEVT_ICONIZE, func) | |
123 | ||
124 | def EVT_NAVIGATION_KEY(win, func): | |
125 | win.Connect(-1, -1, wxEVT_NAVIGATION_KEY, func) | |
126 | ||
127 | ||
128 | # Mouse Events | |
129 | def EVT_LEFT_DOWN(win, func): | |
130 | win.Connect(-1, -1, wxEVT_LEFT_DOWN, func) | |
131 | ||
132 | def EVT_LEFT_UP(win, func): | |
133 | win.Connect(-1, -1, wxEVT_LEFT_UP, func) | |
134 | ||
135 | def EVT_MIDDLE_DOWN(win, func): | |
136 | win.Connect(-1, -1, wxEVT_MIDDLE_DOWN, func) | |
137 | ||
138 | def EVT_MIDDLE_UP(win, func): | |
139 | win.Connect(-1, -1, wxEVT_MIDDLE_UP, func) | |
140 | ||
141 | def EVT_RIGHT_DOWN(win, func): | |
142 | win.Connect(-1, -1, wxEVT_RIGHT_DOWN, func) | |
143 | ||
144 | def EVT_RIGHT_UP(win, func): | |
145 | win.Connect(-1, -1, wxEVT_RIGHT_UP, func) | |
146 | ||
147 | def EVT_MOTION(win, func): | |
148 | win.Connect(-1, -1, wxEVT_MOTION, func) | |
149 | ||
150 | def EVT_LEFT_DCLICK(win, func): | |
151 | win.Connect(-1, -1, wxEVT_LEFT_DCLICK, func) | |
152 | ||
153 | def EVT_MIDDLE_DCLICK(win, func): | |
154 | win.Connect(-1, -1, wxEVT_MIDDLE_DCLICK, func) | |
155 | ||
156 | def EVT_RIGHT_DCLICK(win, func): | |
157 | win.Connect(-1, -1, wxEVT_RIGHT_DCLICK, func) | |
158 | ||
159 | def EVT_LEAVE_WINDOW(win, func): | |
160 | win.Connect(-1, -1, wxEVT_LEAVE_WINDOW, func) | |
161 | ||
162 | def EVT_ENTER_WINDOW(win, func): | |
163 | win.Connect(-1, -1, wxEVT_ENTER_WINDOW, func) | |
164 | ||
165 | ||
166 | # all mouse events | |
167 | def EVT_MOUSE_EVENTS(win, func): | |
168 | win.Connect(-1, -1, wxEVT_LEFT_DOWN, func) | |
169 | win.Connect(-1, -1, wxEVT_LEFT_UP, func) | |
170 | win.Connect(-1, -1, wxEVT_MIDDLE_DOWN, func) | |
171 | win.Connect(-1, -1, wxEVT_MIDDLE_UP, func) | |
172 | win.Connect(-1, -1, wxEVT_RIGHT_DOWN, func) | |
173 | win.Connect(-1, -1, wxEVT_RIGHT_UP, func) | |
174 | win.Connect(-1, -1, wxEVT_MOTION, func) | |
175 | win.Connect(-1, -1, wxEVT_LEFT_DCLICK, func) | |
176 | win.Connect(-1, -1, wxEVT_MIDDLE_DCLICK, func) | |
177 | win.Connect(-1, -1, wxEVT_RIGHT_DCLICK, func) | |
178 | win.Connect(-1, -1, wxEVT_LEAVE_WINDOW, func) | |
179 | win.Connect(-1, -1, wxEVT_ENTER_WINDOW, func) | |
180 | ||
181 | # EVT_COMMAND | |
182 | def EVT_COMMAND(win, id, cmd, func): | |
183 | win.Connect(id, -1, cmd, func) | |
184 | ||
185 | def EVT_COMMAND_RANGE(win, id1, id2, cmd, func): | |
186 | win.Connect(id1, id2, cmd, func) | |
187 | ||
188 | # Scrolling | |
189 | def EVT_SCROLL(win, func): | |
190 | win.Connect(-1, -1, wxEVT_SCROLL_TOP, func) | |
191 | win.Connect(-1, -1, wxEVT_SCROLL_BOTTOM, func) | |
192 | win.Connect(-1, -1, wxEVT_SCROLL_LINEUP, func) | |
193 | win.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN, func) | |
194 | win.Connect(-1, -1, wxEVT_SCROLL_PAGEUP, func) | |
195 | win.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN, func) | |
196 | win.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK,func) | |
197 | ||
198 | def EVT_SCROLL_TOP(win, func): | |
199 | win.Connect(-1, -1, wxEVT_SCROLL_TOP, func) | |
200 | ||
201 | def EVT_SCROLL_BOTTOM(win, func): | |
202 | win.Connect(-1, -1, wxEVT_SCROLL_BOTTOM, func) | |
203 | ||
204 | def EVT_SCROLL_LINEUP(win, func): | |
205 | win.Connect(-1, -1, wxEVT_SCROLL_LINEUP, func) | |
206 | ||
207 | def EVT_SCROLL_LINEDOWN(win, func): | |
208 | win.Connect(-1, -1, wxEVT_SCROLL_LINEDOWN, func) | |
209 | ||
210 | def EVT_SCROLL_PAGEUP(win, func): | |
211 | win.Connect(-1, -1, wxEVT_SCROLL_PAGEUP, func) | |
212 | ||
213 | def EVT_SCROLL_PAGEDOWN(win, func): | |
214 | win.Connect(-1, -1, wxEVT_SCROLL_PAGEDOWN, func) | |
215 | ||
216 | def EVT_SCROLL_THUMBTRACK(win, func): | |
217 | win.Connect(-1, -1, wxEVT_SCROLL_THUMBTRACK, func) | |
218 | ||
219 | ||
220 | ||
221 | # Scrolling, with an id | |
222 | def EVT_COMMAND_SCROLL(win, id, func): | |
223 | win.Connect(id, -1, wxEVT_SCROLL_TOP, func) | |
224 | win.Connect(id, -1, wxEVT_SCROLL_BOTTOM, func) | |
225 | win.Connect(id, -1, wxEVT_SCROLL_LINEUP, func) | |
226 | win.Connect(id, -1, wxEVT_SCROLL_LINEDOWN, func) | |
227 | win.Connect(id, -1, wxEVT_SCROLL_PAGEUP, func) | |
228 | win.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN, func) | |
229 | win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK,func) | |
230 | ||
231 | def EVT_COMMAND_SCROLL_TOP(win, id, func): | |
232 | win.Connect(id, -1, wxEVT_SCROLL_TOP, func) | |
233 | ||
234 | def EVT_COMMAND_SCROLL_BOTTOM(win, id, func): | |
235 | win.Connect(id, -1, wxEVT_SCROLL_BOTTOM, func) | |
236 | ||
237 | def EVT_COMMAND_SCROLL_LINEUP(win, id, func): | |
238 | win.Connect(id, -1, wxEVT_SCROLL_LINEUP, func) | |
239 | ||
240 | def EVT_COMMAND_SCROLL_LINEDOWN(win, id, func): | |
241 | win.Connect(id, -1, wxEVT_SCROLL_LINEDOWN, func) | |
242 | ||
243 | def EVT_COMMAND_SCROLL_PAGEUP(win, id, func): | |
244 | win.Connect(id, -1, wxEVT_SCROLL_PAGEUP, func) | |
245 | ||
246 | def EVT_COMMAND_SCROLL_PAGEDOWN(win, id, func): | |
247 | win.Connect(id, -1, wxEVT_SCROLL_PAGEDOWN, func) | |
248 | ||
249 | def EVT_COMMAND_SCROLL_THUMBTRACK(win, id, func): | |
250 | win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK, func) | |
251 | ||
252 | ||
253 | # Convenience commands | |
254 | def EVT_BUTTON(win, id, func): | |
255 | win.Connect(id, -1, wxEVT_COMMAND_BUTTON_CLICKED, func) | |
256 | ||
257 | def EVT_CHECKBOX(win, id, func): | |
258 | win.Connect(id, -1, wxEVT_COMMAND_CHECKBOX_CLICKED, func) | |
259 | ||
260 | def EVT_CHOICE(win, id, func): | |
261 | win.Connect(id, -1, wxEVT_COMMAND_CHOICE_SELECTED, func) | |
262 | ||
263 | def EVT_LISTBOX(win, id, func): | |
264 | win.Connect(id, -1, wxEVT_COMMAND_LISTBOX_SELECTED, func) | |
265 | ||
266 | def EVT_LISTBOX_DCLICK(win, id, func): | |
267 | win.Connect(id, -1, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, func) | |
268 | ||
269 | def EVT_TEXT(win, id, func): | |
270 | win.Connect(id, -1, wxEVT_COMMAND_TEXT_UPDATED, func) | |
271 | ||
272 | def EVT_TEXT_ENTER(win, id, func): | |
273 | win.Connect(id, -1, wxEVT_COMMAND_TEXT_ENTER, func) | |
274 | ||
275 | def EVT_MENU(win, id, func): | |
276 | win.Connect(id, -1, wxEVT_COMMAND_MENU_SELECTED, func) | |
277 | ||
278 | def EVT_MENU_RANGE(win, id1, id2, func): | |
279 | win.Connect(id1, id2, wxEVT_COMMAND_MENU_SELECTED, func) | |
280 | ||
281 | def EVT_SLIDER(win, id, func): | |
282 | win.Connect(id, -1, wxEVT_COMMAND_SLIDER_UPDATED, func) | |
283 | ||
284 | def EVT_RADIOBOX(win, id, func): | |
285 | win.Connect(id, -1, wxEVT_COMMAND_RADIOBOX_SELECTED, func) | |
286 | ||
287 | def EVT_RADIOBUTTON(win, id, func): | |
288 | win.Connect(id, -1, wxEVT_COMMAND_RADIOBUTTON_SELECTED, func) | |
289 | ||
290 | def EVT_VLBOX(win, id, func): | |
291 | win.Connect(id, -1, wxEVT_COMMAND_VLBOX_SELECTED, func) | |
292 | ||
293 | def EVT_COMBOBOX(win, id, func): | |
294 | win.Connect(id, -1, wxEVT_COMMAND_COMBOBOX_SELECTED, func) | |
295 | ||
296 | def EVT_TOOL(win, id, func): | |
297 | win.Connect(id, -1, wxEVT_COMMAND_TOOL_CLICKED, func) | |
298 | ||
299 | def EVT_TOOL_RCLICKED(win, id, func): | |
300 | win.Connect(id, -1, wxEVT_COMMAND_TOOL_RCLICKED, func) | |
301 | ||
302 | def EVT_TOOL_ENTER(win, id, func): | |
303 | win.Connect(id, -1, wxEVT_COMMAND_TOOL_ENTER, func) | |
304 | ||
305 | def EVT_CHECKLISTBOX(win, id, func): | |
306 | win.Connect(id, -1, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, func) | |
307 | ||
308 | ||
309 | # Generic command events | |
310 | ||
311 | def EVT_COMMAND_LEFT_CLICK(win, id, func): | |
312 | win.Connect(id, -1, wxEVT_COMMAND_LEFT_CLICK, func) | |
313 | ||
314 | def EVT_COMMAND_LEFT_DCLICK(win, id, func): | |
315 | win.Connect(id, -1, wxEVT_COMMAND_LEFT_DCLICK, func) | |
316 | ||
317 | def EVT_COMMAND_RIGHT_CLICK(win, id, func): | |
318 | win.Connect(id, -1, wxEVT_COMMAND_RIGHT_CLICK, func) | |
319 | ||
320 | def EVT_COMMAND_RIGHT_DCLICK(win, id, func): | |
321 | win.Connect(id, -1, wxEVT_COMMAND_RIGHT_DCLICK, func) | |
322 | ||
323 | def EVT_COMMAND_SET_FOCUS(win, id, func): | |
324 | win.Connect(id, -1, wxEVT_COMMAND_SET_FOCUS, func) | |
325 | ||
326 | def EVT_COMMAND_KILL_FOCUS(win, id, func): | |
327 | win.Connect(id, -1, wxEVT_COMMAND_KILL_FOCUS, func) | |
328 | ||
329 | def EVT_COMMAND_ENTER(win, id, func): | |
330 | win.Connect(id, -1, wxEVT_COMMAND_ENTER, func) | |
331 | ||
332 | ||
333 | ||
334 | def EVT_NOTEBOOK_PAGE_CHANGED(win, id, func): | |
335 | win.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, func) | |
336 | ||
337 | def EVT_NOTEBOOK_PAGE_CHANGING(win, id, func): | |
338 | win.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, func) | |
339 | ||
340 | ||
341 | ||
342 | #---------------------------------------------------------------------- | |
343 | #---------------------------------------------------------------------- | |
344 | # We need to add to the shadow classes a bit to facilitate callbacks via | |
345 | # virtual functions. These classes replace the shadows generated by SWIG. | |
346 | ||
347 | class wxWindow(wxWindowPtr): | |
348 | def __init__(self,arg0,arg1,*args) : | |
349 | argl = map(None,args) | |
350 | try: argl[0] = argl[0].this | |
351 | except: pass | |
352 | try: argl[1] = argl[1].this | |
353 | except: pass | |
354 | args = tuple(argl) | |
355 | self.this = apply(windowsc.new_wxWindow,(arg0.this,arg1,)+args) | |
356 | self.thisown = 1 | |
357 | _StdWindowCallbacks(self) | |
358 | ||
359 | ||
360 | class wxFrame(wxFramePtr): | |
361 | def __init__(self,arg0,arg1,arg2,*args) : | |
362 | argl = map(None,args) | |
363 | try: argl[0] = argl[0].this | |
364 | except: pass | |
365 | try: argl[1] = argl[1].this | |
366 | except: pass | |
367 | args = tuple(argl) | |
368 | self.this = apply(windowsc.new_wxFrame,(arg0.this,arg1,arg2,)+args) | |
369 | self.thisown = 1 | |
370 | _StdFrameCallbacks(self) | |
371 | ||
372 | ||
373 | class wxMiniFrame(wxMiniFramePtr): | |
374 | def __init__(self,arg0,arg1,arg2,*args) : | |
375 | argl = map(None,args) | |
376 | try: argl[0] = argl[0].this | |
377 | except: pass | |
378 | try: argl[1] = argl[1].this | |
379 | except: pass | |
380 | args = tuple(argl) | |
381 | self.this = apply(windowsc.new_wxMiniFrame,(arg0.this,arg1,arg2,)+args) | |
382 | self.thisown = 1 | |
383 | _StdFrameCallbacks(self) | |
384 | ||
385 | ||
386 | class wxPanel(wxPanelPtr): | |
387 | def __init__(self,arg0,arg1,*args) : | |
388 | argl = map(None,args) | |
389 | try: argl[0] = argl[0].this | |
390 | except: pass | |
391 | try: argl[1] = argl[1].this | |
392 | except: pass | |
393 | args = tuple(argl) | |
394 | self.this = apply(windowsc.new_wxPanel,(arg0.this,arg1,)+args) | |
395 | self.thisown = 1 | |
396 | _StdWindowCallbacks(self) | |
397 | ||
398 | ||
399 | class wxDialog(wxDialogPtr): | |
400 | def __init__(self,arg0,arg1,arg2,*args) : | |
401 | argl = map(None,args) | |
402 | try: argl[0] = argl[0].this | |
403 | except: pass | |
404 | try: argl[1] = argl[1].this | |
405 | except: pass | |
406 | args = tuple(argl) | |
407 | self.this = apply(windowsc.new_wxDialog,(arg0.this,arg1,arg2,)+args) | |
408 | self.thisown = 1 | |
409 | _StdWindowCallbacks(self) | |
410 | _checkForCallback(self, "OnOk", wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK) | |
411 | _checkForCallback(self, "OnApply", wxEVT_COMMAND_BUTTON_CLICKED, wxID_APPLY) | |
412 | _checkForCallback(self, "OnCancel", wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL) | |
413 | _checkForCallback(self, "OnCloseWindow", wxEVT_CLOSE_WINDOW) | |
414 | _checkForCallback(self, "OnCharHook", wxEVT_CHAR_HOOK) | |
415 | ||
416 | ||
417 | class wxScrolledWindow(wxScrolledWindowPtr): | |
418 | def __init__(self,arg0,*args) : | |
419 | argl = map(None,args) | |
420 | try: argl[1] = argl[1].this | |
421 | except: pass | |
422 | try: argl[2] = argl[2].this | |
423 | except: pass | |
424 | args = tuple(argl) | |
425 | self.this = apply(windowsc.new_wxScrolledWindow,(arg0.this,)+args) | |
426 | self.thisown = 1 | |
427 | _StdWindowCallbacks(self) | |
428 | _StdOnScrollCallback(self) | |
429 | ||
430 | ||
431 | ||
432 | class wxMDIParentFrame(wxMDIParentFramePtr): | |
433 | def __init__(self,arg0,arg1,arg2,*args) : | |
434 | argl = map(None,args) | |
435 | try: argl[0] = argl[0].this | |
436 | except: pass | |
437 | try: argl[1] = argl[1].this | |
438 | except: pass | |
439 | args = tuple(argl) | |
440 | self.this = apply(mdic.new_wxMDIParentFrame,(arg0.this,arg1,arg2,)+args) | |
441 | self.thisown = 1 | |
442 | _StdFrameCallbacks(self) | |
443 | ||
444 | ||
445 | class wxMDIChildFrame(wxMDIChildFramePtr): | |
446 | def __init__(self,arg0,arg1,arg2,*args) : | |
447 | argl = map(None,args) | |
448 | try: argl[0] = argl[0].this | |
449 | except: pass | |
450 | try: argl[1] = argl[1].this | |
451 | except: pass | |
452 | args = tuple(argl) | |
453 | self.this = apply(mdic.new_wxMDIChildFrame,(arg0.this,arg1,arg2,)+args) | |
454 | self.thisown = 1 | |
455 | _StdFrameCallbacks(self) | |
456 | ||
457 | ||
458 | class wxMDIClientWindow(wxMDIClientWindowPtr): | |
459 | def __init__(self,arg0,*args) : | |
460 | self.this = apply(mdic.new_wxMDIClientWindow,(arg0.this,)+args) | |
461 | self.thisown = 1 | |
462 | _StdWindowCallbacks(self) | |
463 | _StdOnScrollCallback(self) | |
464 | ||
465 | ||
466 | ||
467 | class wxControl(wxControlPtr): | |
468 | def __init__(self,this): | |
469 | self.this = this | |
470 | _StdWindowCallbacks(self) | |
471 | ||
472 | class wxButton(wxButtonPtr): | |
473 | def __init__(self,arg0,arg1,arg2,*args) : | |
474 | argl = map(None,args) | |
475 | try: argl[0] = argl[0].this | |
476 | except: pass | |
477 | try: argl[1] = argl[1].this | |
478 | except: pass | |
479 | args = tuple(argl) | |
480 | self.this = apply(controlsc.new_wxButton,(arg0.this,arg1,arg2,)+args) | |
481 | self.thisown = 1 | |
482 | _StdWindowCallbacks(self) | |
483 | ||
484 | class wxBitmapButton(wxBitmapButtonPtr): | |
485 | def __init__(self,arg0,arg1,arg2,*args) : | |
486 | argl = map(None,args) | |
487 | try: argl[0] = argl[0].this | |
488 | except: pass | |
489 | try: argl[1] = argl[1].this | |
490 | except: pass | |
491 | args = tuple(argl) | |
492 | self.this = apply(controlsc.new_wxBitmapButton,(arg0.this,arg1,arg2.this,)+args) | |
493 | self.thisown = 1 | |
494 | _StdWindowCallbacks(self) | |
495 | ||
496 | class wxCheckBox(wxCheckBoxPtr): | |
497 | def __init__(self,arg0,arg1,arg2,*args) : | |
498 | argl = map(None,args) | |
499 | try: argl[0] = argl[0].this | |
500 | except: pass | |
501 | try: argl[1] = argl[1].this | |
502 | except: pass | |
503 | args = tuple(argl) | |
504 | self.this = apply(controlsc.new_wxCheckBox,(arg0.this,arg1,arg2,)+args) | |
505 | self.thisown = 1 | |
506 | _StdWindowCallbacks(self) | |
507 | ||
508 | ||
509 | ||
510 | class wxChoice(wxChoicePtr): | |
511 | def __init__(self,arg0,arg1,*args) : | |
512 | argl = map(None,args) | |
513 | try: argl[0] = argl[0].this | |
514 | except: pass | |
515 | try: argl[1] = argl[1].this | |
516 | except: pass | |
517 | args = tuple(argl) | |
518 | self.this = apply(controlsc.new_wxChoice,(arg0.this,arg1,)+args) | |
519 | self.thisown = 1 | |
520 | _StdWindowCallbacks(self) | |
521 | ||
522 | class wxComboBox(wxComboBoxPtr): | |
523 | def __init__(self,arg0,arg1,*args) : | |
524 | argl = map(None,args) | |
525 | try: argl[1] = argl[1].this | |
526 | except: pass | |
527 | try: argl[2] = argl[2].this | |
528 | except: pass | |
529 | args = tuple(argl) | |
530 | self.this = apply(controlsc.new_wxComboBox,(arg0.this,arg1,)+args) | |
531 | self.thisown = 1 | |
532 | _StdWindowCallbacks(self) | |
533 | ||
534 | class wxGauge(wxGaugePtr): | |
535 | def __init__(self,arg0,arg1,arg2,*args) : | |
536 | argl = map(None,args) | |
537 | try: argl[0] = argl[0].this | |
538 | except: pass | |
539 | try: argl[1] = argl[1].this | |
540 | except: pass | |
541 | args = tuple(argl) | |
542 | self.this = apply(controlsc.new_wxGauge,(arg0.this,arg1,arg2,)+args) | |
543 | self.thisown = 1 | |
544 | _StdWindowCallbacks(self) | |
545 | ||
546 | class wxStaticBox(wxStaticBoxPtr): | |
547 | def __init__(self,arg0,arg1,arg2,*args) : | |
548 | argl = map(None,args) | |
549 | try: argl[0] = argl[0].this | |
550 | except: pass | |
551 | try: argl[1] = argl[1].this | |
552 | except: pass | |
553 | args = tuple(argl) | |
554 | self.this = apply(controlsc.new_wxStaticBox,(arg0.this,arg1,arg2,)+args) | |
555 | self.thisown = 1 | |
556 | _StdWindowCallbacks(self) | |
557 | ||
558 | class wxStaticText(wxStaticTextPtr): | |
559 | def __init__(self,arg0,arg1,arg2,*args) : | |
560 | argl = map(None,args) | |
561 | try: argl[0] = argl[0].this | |
562 | except: pass | |
563 | try: argl[1] = argl[1].this | |
564 | except: pass | |
565 | args = tuple(argl) | |
566 | self.this = apply(controlsc.new_wxStaticText,(arg0.this,arg1,arg2,)+args) | |
567 | self.thisown = 1 | |
568 | _StdWindowCallbacks(self) | |
569 | ||
570 | class wxListBox(wxListBoxPtr): | |
571 | def __init__(self,arg0,arg1,*args) : | |
572 | argl = map(None,args) | |
573 | try: argl[0] = argl[0].this | |
574 | except: pass | |
575 | try: argl[1] = argl[1].this | |
576 | except: pass | |
577 | args = tuple(argl) | |
578 | self.this = apply(controlsc.new_wxListBox,(arg0.this,arg1,)+args) | |
579 | self.thisown = 1 | |
580 | _StdWindowCallbacks(self) | |
581 | ||
582 | class wxTextCtrl(wxTextCtrlPtr): | |
583 | def __init__(self,arg0,arg1,*args) : | |
584 | argl = map(None,args) | |
585 | try: argl[1] = argl[1].this | |
586 | except: pass | |
587 | try: argl[2] = argl[2].this | |
588 | except: pass | |
589 | args = tuple(argl) | |
590 | self.this = apply(controlsc.new_wxTextCtrl,(arg0.this,arg1,)+args) | |
591 | self.thisown = 1 | |
592 | _StdWindowCallbacks(self) | |
593 | ||
594 | class wxScrollBar(wxScrollBarPtr): | |
595 | def __init__(self,arg0,*args) : | |
596 | argl = map(None,args) | |
597 | try: argl[1] = argl[1].this | |
598 | except: pass | |
599 | try: argl[2] = argl[2].this | |
600 | except: pass | |
601 | args = tuple(argl) | |
602 | self.this = apply(controlsc.new_wxScrollBar,(arg0.this,)+args) | |
603 | self.thisown = 1 | |
604 | _StdWindowCallbacks(self) | |
605 | ||
606 | class wxSpinButton(wxSpinButtonPtr): | |
607 | def __init__(self,arg0,*args) : | |
608 | argl = map(None,args) | |
609 | try: argl[1] = argl[1].this | |
610 | except: pass | |
611 | try: argl[2] = argl[2].this | |
612 | except: pass | |
613 | args = tuple(argl) | |
614 | self.this = apply(controlsc.new_wxSpinButton,(arg0.this,)+args) | |
615 | self.thisown = 1 | |
616 | _StdWindowCallbacks(self) | |
617 | ||
618 | class wxStaticBitmap(wxStaticBitmapPtr): | |
619 | def __init__(self,arg0,arg1,arg2,*args) : | |
620 | argl = map(None,args) | |
621 | try: argl[0] = argl[0].this | |
622 | except: pass | |
623 | try: argl[1] = argl[1].this | |
624 | except: pass | |
625 | args = tuple(argl) | |
626 | self.this = apply(controlsc.new_wxStaticBitmap,(arg0.this,arg1,arg2.this,)+args) | |
627 | self.thisown = 1 | |
628 | _StdWindowCallbacks(self) | |
629 | ||
630 | class wxRadioBox(wxRadioBoxPtr): | |
631 | def __init__(self,arg0,arg1,arg2,*args) : | |
632 | argl = map(None,args) | |
633 | try: argl[0] = argl[0].this | |
634 | except: pass | |
635 | try: argl[1] = argl[1].this | |
636 | except: pass | |
637 | args = tuple(argl) | |
638 | self.this = apply(controlsc.new_wxRadioBox,(arg0.this,arg1,arg2,)+args) | |
639 | self.thisown = 1 | |
640 | _StdWindowCallbacks(self) | |
641 | ||
642 | class wxRadioButton(wxRadioButtonPtr): | |
643 | def __init__(self,arg0,arg1,arg2,*args) : | |
644 | argl = map(None,args) | |
645 | try: argl[0] = argl[0].this | |
646 | except: pass | |
647 | try: argl[1] = argl[1].this | |
648 | except: pass | |
649 | args = tuple(argl) | |
650 | self.this = apply(controlsc.new_wxRadioButton,(arg0.this,arg1,arg2,)+args) | |
651 | self.thisown = 1 | |
652 | _StdWindowCallbacks(self) | |
653 | ||
654 | class wxSlider(wxSliderPtr): | |
655 | def __init__(self,arg0,arg1,arg2,arg3,arg4,*args) : | |
656 | argl = map(None,args) | |
657 | try: argl[0] = argl[0].this | |
658 | except: pass | |
659 | try: argl[1] = argl[1].this | |
660 | except: pass | |
661 | args = tuple(argl) | |
662 | self.this = apply(controlsc.new_wxSlider,(arg0.this,arg1,arg2,arg3,arg4,)+args) | |
663 | self.thisown = 1 | |
664 | _StdWindowCallbacks(self) | |
665 | ||
666 | ||
667 | ||
668 | ||
669 | ||
670 | ||
671 | class wxTimer(wxPyTimer): | |
672 | def __init__(self): | |
673 | wxPyTimer.__init__(self, self.Notify) # derived class must provide | |
674 | # Notify(self) method. | |
675 | ||
676 | #---------------------------------------------------------------------- | |
677 | # Some wxWin methods can take "NULL" as parameters, but the shadow classes | |
678 | # expect an object with the SWIG pointer as a 'this' member. This class | |
679 | # and instance fools the shadow into passing the NULL pointer. | |
680 | ||
681 | class NullObj: | |
682 | this = 'NULL' # SWIG converts this to (void*)0 | |
683 | ||
684 | NULL = NullObj() | |
685 | ||
686 | ||
687 | #---------------------------------------------------------------------- | |
688 | # aliases | |
689 | ||
690 | wxColor = wxColour | |
691 | wxNamedColor = wxNamedColour | |
692 | ||
693 | wxPyDefaultPosition.Set(-1,-1) | |
694 | wxPyDefaultSize.Set(-1,-1) | |
695 | ||
696 | #---------------------------------------------------------------------- | |
697 | ||
698 | ## class wxPyStdOutWindow(wxFrame): | |
699 | ## def __init__(self, title = "wxPython: stdout/stderr"): | |
700 | ## wxFrame.__init__(self, NULL, title) | |
701 | ## self.title = title | |
702 | ## self.text = wxTextWindow(self) | |
703 | ## self.text.SetFont(wxFont(10, wxMODERN, wxNORMAL, wxBOLD)) | |
704 | ## self.SetSize(-1,-1,400,200) | |
705 | ## self.Show(false) | |
706 | ## self.isShown = false | |
707 | ||
708 | ## def write(self, str): # with this method, | |
709 | ## if not self.isShown: | |
710 | ## self.Show(true) | |
711 | ## self.isShown = true | |
712 | ## self.text.WriteText(str) | |
713 | ||
714 | ## def OnCloseWindow(self, event): # doesn't allow the window to close, just hides it | |
715 | ## self.Show(false) | |
716 | ## self.isShown = false | |
717 | ||
718 | ||
719 | _defRedirect = (wxPlatform == '__WIN32__') | |
720 | ||
721 | #---------------------------------------------------------------------- | |
722 | # The main application class. Derive from this and implement an OnInit | |
723 | # method that creates a frame and then calls self.SetTopWindow(frame) | |
724 | ||
725 | class wxApp(wxPyApp): | |
726 | error = 'wxApp.error' | |
727 | ||
728 | def __init__(self, redirect=_defRedirect, filename=None): | |
729 | wxPyApp.__init__(self) | |
730 | self.stdioWin = None | |
731 | self.saveStdio = (sys.stdout, sys.stderr) | |
732 | if redirect: | |
733 | self.RedirectStdio(filename) | |
734 | ||
735 | # this initializes wxWindows and then calls our OnInit | |
736 | _wxStart(self.OnInit) | |
737 | ||
738 | ||
739 | def __del__(self): | |
740 | try: | |
741 | self.RestoreStdio() | |
742 | except: | |
743 | pass | |
744 | ||
745 | def RedirectStdio(self, filename): | |
746 | if filename: | |
747 | sys.stdout = sys.stderr = open(filename, 'a') | |
748 | else: | |
749 | raise self.error, 'wxPyStdOutWindow not yet implemented.' | |
750 | #self.stdioWin = sys.stdout = sys.stderr = wxPyStdOutWindow() | |
751 | ||
752 | def RestoreStdio(self): | |
753 | sys.stdout, sys.stderr = self.saveStdio | |
754 | if self.stdioWin != None: | |
755 | self.stdioWin.Show(false) | |
756 | self.stdioWin.Destroy() | |
757 | self.stdioWin = None | |
758 | ||
759 | ||
760 | #---------------------------------------------------------------------------- | |
761 | # | |
762 | # $Log$ | |
763 | # Revision 1.1 1998/08/09 08:25:49 RD | |
764 | # Initial version | |
765 | # | |
766 | # | |
767 |