]>
Commit | Line | Data |
---|---|---|
bb0054cd RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: misc2.i | |
3 | // Purpose: Definitions of miscelaneous functions and classes that need | |
4 | // to know about wxWindow. (So they can't be in misc.i or an | |
5 | // import loop will happen.) | |
6 | // | |
7 | // Author: Robin Dunn | |
8 | // | |
9 | // Created: 18-June-1999 | |
10 | // RCS-ID: $Id$ | |
11 | // Copyright: (c) 1998 by Total Control Software | |
12 | // Licence: wxWindows license | |
13 | ///////////////////////////////////////////////////////////////////////////// | |
14 | ||
15 | %module misc2 | |
16 | ||
17 | %{ | |
18 | #include "helpers.h" | |
19 | #include <wx/resource.h> | |
20 | #include <wx/tooltip.h> | |
f0261a72 RD |
21 | #include <wx/caret.h> |
22 | #include <wx/fontenum.h> | |
f6bcfd97 | 23 | #include <wx/tipdlg.h> |
c368d904 | 24 | #include <wx/process.h> |
4662be59 | 25 | #ifdef __WXMSW__ |
185d7c3e | 26 | #include <wx/joystick.h> |
4662be59 | 27 | #endif |
bb0054cd RD |
28 | %} |
29 | ||
30 | //---------------------------------------------------------------------- | |
31 | ||
32 | %include typemaps.i | |
33 | %include my_typemaps.i | |
34 | ||
35 | // Import some definitions of other classes, etc. | |
36 | %import _defs.i | |
37 | %import windows.i | |
f0261a72 | 38 | %import misc.i |
06c0fba4 | 39 | %import gdi.i |
b1462dfa | 40 | %import events.i |
c368d904 | 41 | %import streams.i |
06c0fba4 | 42 | |
b68dc582 RD |
43 | %{ |
44 | static wxString wxPyEmptyStr(""); | |
45 | %} | |
46 | ||
06c0fba4 RD |
47 | //--------------------------------------------------------------------------- |
48 | // Dialog Functions | |
49 | ||
50 | wxString wxFileSelector(char* message, | |
51 | char* default_path = NULL, | |
52 | char* default_filename = NULL, | |
53 | char* default_extension = NULL, | |
54 | char* wildcard = "*.*", | |
55 | int flags = 0, | |
56 | wxWindow *parent = NULL, | |
57 | int x = -1, int y = -1); | |
58 | ||
59 | wxString wxGetTextFromUser(const wxString& message, | |
60 | const wxString& caption = wxPyEmptyStr, | |
61 | const wxString& default_value = wxPyEmptyStr, | |
62 | wxWindow *parent = NULL, | |
63 | int x = -1, int y = -1, | |
64 | bool centre = TRUE); | |
65 | ||
1b62f00d RD |
66 | wxString wxGetPasswordFromUser(const wxString& message, |
67 | const wxString& caption = wxPyEmptyStr, | |
68 | const wxString& default_value = wxPyEmptyStr, | |
69 | wxWindow *parent = NULL); | |
70 | ||
06c0fba4 RD |
71 | |
72 | // TODO: Need to custom wrap this one... | |
73 | // int wxGetMultipleChoice(char* message, char* caption, | |
eec92d76 | 74 | // int LCOUNT, char** choices, |
06c0fba4 RD |
75 | // int nsel, int *selection, |
76 | // wxWindow *parent = NULL, int x = -1, int y = -1, | |
77 | // bool centre = TRUE, int width=150, int height=200); | |
78 | ||
79 | ||
80 | wxString wxGetSingleChoice(const wxString& message, const wxString& caption, | |
eec92d76 | 81 | int LCOUNT, wxString* choices, |
06c0fba4 RD |
82 | wxWindow *parent = NULL, |
83 | int x = -1, int y = -1, | |
84 | bool centre = TRUE, | |
85 | int width=150, int height=200); | |
86 | ||
87 | int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption, | |
eec92d76 | 88 | int LCOUNT, wxString* choices, |
06c0fba4 RD |
89 | wxWindow *parent = NULL, |
90 | int x = -1, int y = -1, | |
91 | bool centre = TRUE, | |
92 | int width=150, int height=200); | |
93 | ||
94 | ||
95 | int wxMessageBox(const wxString& message, | |
96 | const wxString& caption = wxPyEmptyStr, | |
97 | int style = wxOK | wxCENTRE, | |
98 | wxWindow *parent = NULL, | |
99 | int x = -1, int y = -1); | |
100 | ||
101 | long wxGetNumberFromUser(const wxString& message, | |
102 | const wxString& prompt, | |
103 | const wxString& caption, | |
104 | long value, | |
105 | long min = 0, long max = 100, | |
106 | wxWindow *parent = NULL, | |
b68dc582 | 107 | const wxPoint& pos = wxDefaultPosition); |
06c0fba4 RD |
108 | |
109 | //--------------------------------------------------------------------------- | |
110 | // GDI Functions | |
111 | ||
112 | bool wxColourDisplay(); | |
1e7ecb7b | 113 | |
06c0fba4 | 114 | int wxDisplayDepth(); |
1e7ecb7b RD |
115 | int wxGetDisplayDepth(); |
116 | ||
ec5d7799 | 117 | void wxDisplaySize(int* OUTPUT, int* OUTPUT); |
1e7ecb7b | 118 | wxSize wxGetDisplaySize(); |
1b62f00d | 119 | |
ec5d7799 | 120 | void wxDisplaySizeMM(int* OUTPUT, int* OUTPUT); |
1e7ecb7b RD |
121 | wxSize wxGetDisplaySizeMM(); |
122 | ||
ec5d7799 RD |
123 | void wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT); |
124 | wxRect wxGetClientDisplayRect(); | |
125 | ||
06c0fba4 | 126 | void wxSetCursor(wxCursor& cursor); |
bb0054cd RD |
127 | |
128 | //---------------------------------------------------------------------- | |
06c0fba4 | 129 | // Miscellaneous functions |
bb0054cd RD |
130 | |
131 | wxWindow * wxFindWindowByLabel(const wxString& label, wxWindow *parent=NULL); | |
132 | wxWindow * wxFindWindowByName(const wxString& name, wxWindow *parent=NULL); | |
133 | ||
06c0fba4 RD |
134 | void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR); |
135 | wxWindow * wxGetActiveWindow(); | |
136 | ||
137 | ||
138 | //--------------------------------------------------------------------------- | |
139 | // Resource System | |
140 | ||
141 | bool wxResourceAddIdentifier(char *name, int value); | |
142 | void wxResourceClear(void); | |
143 | wxBitmap wxResourceCreateBitmap(char *resource); | |
144 | wxIcon wxResourceCreateIcon(char *resource); | |
145 | wxMenuBar * wxResourceCreateMenuBar(char *resource); | |
146 | int wxResourceGetIdentifier(char *name); | |
147 | bool wxResourceParseData(char *resource, wxResourceTable *table = NULL); | |
148 | bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL); | |
149 | bool wxResourceParseString(char *resource, wxResourceTable *table = NULL); | |
bb0054cd | 150 | |
06c0fba4 RD |
151 | //--------------------------------------------------------------------------- |
152 | // System Settings | |
153 | ||
154 | enum { | |
155 | wxSYS_WHITE_BRUSH, | |
156 | wxSYS_LTGRAY_BRUSH, | |
157 | wxSYS_GRAY_BRUSH, | |
158 | wxSYS_DKGRAY_BRUSH, | |
159 | wxSYS_BLACK_BRUSH, | |
160 | wxSYS_NULL_BRUSH, | |
161 | wxSYS_HOLLOW_BRUSH, | |
162 | wxSYS_WHITE_PEN, | |
163 | wxSYS_BLACK_PEN, | |
164 | wxSYS_NULL_PEN, | |
165 | wxSYS_OEM_FIXED_FONT, | |
166 | wxSYS_ANSI_FIXED_FONT, | |
167 | wxSYS_ANSI_VAR_FONT, | |
168 | wxSYS_SYSTEM_FONT, | |
169 | wxSYS_DEVICE_DEFAULT_FONT, | |
170 | wxSYS_DEFAULT_PALETTE, | |
171 | wxSYS_SYSTEM_FIXED_FONT, | |
172 | wxSYS_DEFAULT_GUI_FONT, | |
173 | ||
174 | wxSYS_COLOUR_SCROLLBAR, | |
175 | wxSYS_COLOUR_BACKGROUND, | |
176 | wxSYS_COLOUR_ACTIVECAPTION, | |
177 | wxSYS_COLOUR_INACTIVECAPTION, | |
178 | wxSYS_COLOUR_MENU, | |
179 | wxSYS_COLOUR_WINDOW, | |
180 | wxSYS_COLOUR_WINDOWFRAME, | |
181 | wxSYS_COLOUR_MENUTEXT, | |
182 | wxSYS_COLOUR_WINDOWTEXT, | |
183 | wxSYS_COLOUR_CAPTIONTEXT, | |
184 | wxSYS_COLOUR_ACTIVEBORDER, | |
185 | wxSYS_COLOUR_INACTIVEBORDER, | |
186 | wxSYS_COLOUR_APPWORKSPACE, | |
187 | wxSYS_COLOUR_HIGHLIGHT, | |
188 | wxSYS_COLOUR_HIGHLIGHTTEXT, | |
189 | wxSYS_COLOUR_BTNFACE, | |
190 | wxSYS_COLOUR_BTNSHADOW, | |
191 | wxSYS_COLOUR_GRAYTEXT, | |
192 | wxSYS_COLOUR_BTNTEXT, | |
193 | wxSYS_COLOUR_INACTIVECAPTIONTEXT, | |
194 | wxSYS_COLOUR_BTNHIGHLIGHT, | |
195 | ||
196 | wxSYS_COLOUR_3DDKSHADOW, | |
197 | wxSYS_COLOUR_3DLIGHT, | |
198 | wxSYS_COLOUR_INFOTEXT, | |
199 | wxSYS_COLOUR_INFOBK, | |
200 | ||
201 | wxSYS_COLOUR_DESKTOP, | |
202 | wxSYS_COLOUR_3DFACE, | |
203 | wxSYS_COLOUR_3DSHADOW, | |
204 | wxSYS_COLOUR_3DHIGHLIGHT, | |
205 | wxSYS_COLOUR_3DHILIGHT, | |
206 | wxSYS_COLOUR_BTNHILIGHT, | |
207 | ||
208 | wxSYS_MOUSE_BUTTONS, | |
209 | wxSYS_BORDER_X, | |
210 | wxSYS_BORDER_Y, | |
211 | wxSYS_CURSOR_X, | |
212 | wxSYS_CURSOR_Y, | |
213 | wxSYS_DCLICK_X, | |
214 | wxSYS_DCLICK_Y, | |
215 | wxSYS_DRAG_X, | |
216 | wxSYS_DRAG_Y, | |
217 | wxSYS_EDGE_X, | |
218 | wxSYS_EDGE_Y, | |
219 | wxSYS_HSCROLL_ARROW_X, | |
220 | wxSYS_HSCROLL_ARROW_Y, | |
221 | wxSYS_HTHUMB_X, | |
222 | wxSYS_ICON_X, | |
223 | wxSYS_ICON_Y, | |
224 | wxSYS_ICONSPACING_X, | |
225 | wxSYS_ICONSPACING_Y, | |
226 | wxSYS_WINDOWMIN_X, | |
227 | wxSYS_WINDOWMIN_Y, | |
228 | wxSYS_SCREEN_X, | |
229 | wxSYS_SCREEN_Y, | |
230 | wxSYS_FRAMESIZE_X, | |
231 | wxSYS_FRAMESIZE_Y, | |
232 | wxSYS_SMALLICON_X, | |
233 | wxSYS_SMALLICON_Y, | |
234 | wxSYS_HSCROLL_Y, | |
235 | wxSYS_VSCROLL_X, | |
236 | wxSYS_VSCROLL_ARROW_X, | |
237 | wxSYS_VSCROLL_ARROW_Y, | |
238 | wxSYS_VTHUMB_Y, | |
239 | wxSYS_CAPTION_Y, | |
240 | wxSYS_MENU_Y, | |
241 | wxSYS_NETWORK_PRESENT, | |
242 | wxSYS_PENWINDOWS_PRESENT, | |
243 | wxSYS_SHOW_SOUNDS, | |
244 | wxSYS_SWAP_BUTTONS, | |
245 | }; | |
246 | ||
247 | ||
248 | ||
249 | %inline %{ | |
250 | ||
251 | wxColour wxSystemSettings_GetSystemColour(int index) { | |
252 | return wxSystemSettings::GetSystemColour(index); | |
253 | } | |
254 | ||
255 | wxFont wxSystemSettings_GetSystemFont(int index) { | |
256 | return wxSystemSettings::GetSystemFont(index); | |
257 | } | |
258 | ||
259 | int wxSystemSettings_GetSystemMetric(int index) { | |
260 | return wxSystemSettings::GetSystemMetric(index); | |
261 | } | |
262 | %} | |
bb0054cd RD |
263 | |
264 | //--------------------------------------------------------------------------- | |
265 | // wxToolTip | |
266 | ||
267 | class wxToolTip { | |
268 | public: | |
269 | wxToolTip(const wxString &tip); | |
270 | ||
271 | void SetTip(const wxString& tip); | |
272 | wxString GetTip(); | |
273 | // *** Not in the "public" interface void SetWindow(wxWindow *win); | |
274 | wxWindow *GetWindow(); | |
275 | }; | |
276 | ||
277 | ||
278 | %inline %{ | |
279 | void wxToolTip_Enable(bool flag) { | |
280 | wxToolTip::Enable(flag); | |
281 | } | |
282 | ||
283 | void wxToolTip_SetDelay(long milliseconds) { | |
284 | wxToolTip::SetDelay(milliseconds); | |
285 | } | |
286 | %} | |
287 | ||
288 | //---------------------------------------------------------------------- | |
f0261a72 RD |
289 | |
290 | class wxCaret { | |
291 | public: | |
292 | wxCaret(wxWindow* window, const wxSize& size); | |
293 | ~wxCaret(); | |
294 | ||
295 | bool IsOk(); | |
296 | bool IsVisible(); | |
297 | %name(GetPositionTuple)void GetPosition(int *OUTPUT, int *OUTPUT); | |
298 | wxPoint GetPosition(); | |
299 | %name(GetSizeTuple)void GetSize(int *OUTPUT, int *OUTPUT); | |
300 | wxSize GetSize(); | |
301 | wxWindow *GetWindow(); | |
302 | %name(MoveXY)void Move(int x, int y); | |
303 | void Move(const wxPoint& pt); | |
a1df7a95 RD |
304 | %name(SetSizeWH) void SetSize(int width, int height); |
305 | void SetSize(const wxSize& size); | |
f0261a72 RD |
306 | void Show(int show = TRUE); |
307 | void Hide(); | |
f0261a72 RD |
308 | }; |
309 | ||
310 | %inline %{ | |
311 | int wxCaret_GetBlinkTime() { | |
312 | return wxCaret::GetBlinkTime(); | |
313 | } | |
314 | ||
315 | void wxCaret_SetBlinkTime(int milliseconds) { | |
316 | wxCaret::SetBlinkTime(milliseconds); | |
317 | } | |
318 | %} | |
319 | ||
bb0054cd | 320 | //---------------------------------------------------------------------- |
f0261a72 RD |
321 | |
322 | %{ | |
323 | class wxPyFontEnumerator : public wxFontEnumerator { | |
324 | public: | |
325 | wxPyFontEnumerator() {} | |
326 | ~wxPyFontEnumerator() {} | |
327 | ||
b1462dfa | 328 | DEC_PYCALLBACK_BOOL_STRING(OnFacename); |
f0261a72 RD |
329 | DEC_PYCALLBACK_BOOL_STRINGSTRING(OnFontEncoding); |
330 | ||
331 | PYPRIVATE; | |
332 | }; | |
333 | ||
b1462dfa | 334 | IMP_PYCALLBACK_BOOL_STRING(wxPyFontEnumerator, wxFontEnumerator, OnFacename); |
f0261a72 RD |
335 | IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEncoding); |
336 | ||
337 | %} | |
338 | ||
339 | %name(wxFontEnumerator) class wxPyFontEnumerator { | |
340 | public: | |
b1462dfa RD |
341 | wxPyFontEnumerator(); |
342 | ~wxPyFontEnumerator(); | |
f6bcfd97 BP |
343 | void _setSelf(PyObject* self, PyObject* _class); |
344 | %pragma(python) addtomethod = "__init__:self._setSelf(self, wxFontEnumerator)" | |
f0261a72 | 345 | |
b1462dfa RD |
346 | bool EnumerateFacenames( |
347 | wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all | |
348 | bool fixedWidthOnly = FALSE); | |
349 | bool EnumerateEncodings(const char* facename = ""); | |
65dd82cb RD |
350 | |
351 | //wxArrayString* GetEncodings(); | |
352 | //wxArrayString* GetFacenames(); | |
353 | %addmethods { | |
354 | PyObject* GetEncodings() { | |
355 | wxArrayString* arr = self->GetEncodings(); | |
356 | PyObject* list = PyList_New(0); | |
357 | for (size_t x=0; x<arr->GetCount(); x++) | |
358 | PyList_Append(list, PyString_FromString((*arr)[x])); | |
359 | return list; | |
360 | } | |
361 | ||
362 | PyObject* GetFacenames() { | |
363 | wxArrayString* arr = self->GetFacenames(); | |
364 | PyObject* list = PyList_New(0); | |
365 | for (size_t x=0; x<arr->GetCount(); x++) | |
366 | PyList_Append(list, PyString_FromString((*arr)[x])); | |
367 | return list; | |
368 | } | |
369 | } | |
f0261a72 | 370 | }; |
2abc0a0f RD |
371 | |
372 | //---------------------------------------------------------------------- | |
373 | ||
374 | class wxBusyCursor { | |
375 | public: | |
376 | wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR); | |
377 | ~wxBusyCursor(); | |
378 | }; | |
379 | ||
b1462dfa | 380 | //---------------------------------------------------------------------- |
2abc0a0f | 381 | |
c368d904 RD |
382 | class wxWindowDisabler { |
383 | public: | |
384 | wxWindowDisabler(wxWindow *winToSkip = NULL); | |
385 | ~wxWindowDisabler(); | |
386 | }; | |
387 | ||
388 | //---------------------------------------------------------------------- | |
389 | ||
6e18ca6c | 390 | bool wxSafeYield(wxWindow* win=NULL); |
b1462dfa | 391 | void wxPostEvent(wxEvtHandler *dest, wxEvent& event); |
694759cf | 392 | void wxWakeUpIdle(); |
2abc0a0f | 393 | |
6e18ca6c | 394 | |
4662be59 | 395 | #ifdef __WXMSW__ |
6e18ca6c | 396 | void wxWakeUpMainThread(); |
4662be59 RD |
397 | #endif |
398 | ||
6e18ca6c RD |
399 | void wxMutexGuiEnter(); |
400 | void wxMutexGuiLeave(); | |
401 | ||
402 | ||
403 | class wxMutexGuiLocker { | |
404 | public: | |
405 | wxMutexGuiLocker(); | |
406 | ~wxMutexGuiLocker(); | |
407 | }; | |
408 | ||
409 | ||
410 | %inline %{ | |
411 | bool wxThread_IsMain() { | |
412 | return wxThread::IsMain(); | |
413 | } | |
414 | %} | |
c368d904 | 415 | |
2abc0a0f | 416 | //---------------------------------------------------------------------- |
f6bcfd97 BP |
417 | |
418 | ||
419 | class wxTipProvider | |
420 | { | |
421 | public: | |
422 | // wxTipProvider(size_t currentTip); **** Abstract base class | |
423 | ~wxTipProvider(); | |
424 | ||
425 | virtual wxString GetTip() = 0; | |
426 | size_t GetCurrentTip(); | |
427 | ||
428 | }; | |
429 | ||
430 | ||
431 | // The C++ version of wxPyTipProvider | |
432 | %{ | |
433 | class wxPyTipProvider : public wxTipProvider { | |
434 | public: | |
435 | wxPyTipProvider(size_t currentTip) | |
436 | : wxTipProvider(currentTip) {} | |
437 | ||
438 | DEC_PYCALLBACK_STRING__pure(GetTip); | |
439 | ||
440 | PYPRIVATE; | |
441 | }; | |
442 | ||
443 | IMP_PYCALLBACK_STRING__pure( wxPyTipProvider, wxTipProvider, GetTip); | |
444 | ||
445 | %} | |
446 | ||
447 | ||
448 | // Now let SWIG know about it | |
449 | class wxPyTipProvider : public wxTipProvider { | |
450 | public: | |
451 | wxPyTipProvider(size_t currentTip); | |
452 | }; | |
453 | ||
454 | ||
455 | ||
456 | bool wxShowTip(wxWindow *parent, wxTipProvider *tipProvider, bool showAtStartup = TRUE); | |
457 | %new wxTipProvider * wxCreateFileTipProvider(const wxString& filename, size_t currentTip); | |
458 | ||
459 | ||
460 | //---------------------------------------------------------------------- | |
461 | ||
462 | %{ | |
463 | #include <wx/generic/dragimgg.h> | |
464 | static wxPoint wxPyNullPoint; | |
465 | %} | |
466 | ||
467 | %name (wxDragImage) class wxGenericDragImage | |
468 | { | |
469 | public: | |
470 | ||
471 | wxGenericDragImage(const wxBitmap& image, | |
472 | const wxCursor& cursor = wxNullCursor, | |
473 | const wxPoint& hotspot = wxPyNullPoint); | |
474 | ~wxGenericDragImage(); | |
475 | ||
476 | bool BeginDrag(const wxPoint& hotspot, wxWindow* window, | |
477 | bool fullScreen = FALSE, wxRect* rect = NULL); | |
478 | ||
479 | %name(BeginDrag2) bool BeginDrag(const wxPoint& hotspot, wxWindow* window, | |
480 | wxWindow* fullScreenRect); | |
481 | ||
482 | bool EndDrag(); | |
483 | bool Move(const wxPoint& pt); | |
484 | bool Show(); | |
485 | bool Hide(); | |
486 | ||
487 | wxRect GetImageRect(const wxPoint& pos) const; | |
488 | bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, | |
489 | bool eraseOld, bool drawNew); | |
490 | }; | |
491 | ||
492 | ||
493 | // Alternate Constructors | |
494 | %new wxGenericDragImage* wxDragIcon(const wxIcon& image, | |
495 | const wxCursor& cursor = wxNullCursor, | |
496 | const wxPoint& hotspot = wxPyNullPoint); | |
497 | ||
498 | %new wxGenericDragImage* wxDragString(const wxString& str, | |
499 | const wxCursor& cursor = wxNullCursor, | |
500 | const wxPoint& hotspot = wxPyNullPoint); | |
501 | ||
502 | %new wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id); | |
503 | ||
504 | %new wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id); | |
505 | ||
506 | ||
507 | %{ | |
508 | ||
509 | wxGenericDragImage* wxDragIcon(const wxIcon& image, | |
510 | const wxCursor& cursor, | |
511 | const wxPoint& hotspot) { | |
512 | return new wxGenericDragImage(image, cursor, hotspot); | |
513 | } | |
514 | ||
515 | wxGenericDragImage* wxDragString(const wxString& str, | |
516 | const wxCursor& cursor, | |
517 | const wxPoint& hotspot) { | |
518 | return new wxGenericDragImage(str, cursor, hotspot); | |
519 | } | |
520 | ||
521 | wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) { | |
522 | return new wxGenericDragImage(treeCtrl, id); | |
523 | } | |
524 | ||
525 | wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id) { | |
526 | return new wxGenericDragImage(listCtrl, id); | |
527 | } | |
528 | ||
529 | %} | |
530 | ||
531 | ||
532 | ||
533 | //---------------------------------------------------------------------- | |
534 | ||
535 | class wxPyTimer { | |
536 | public: | |
537 | wxPyTimer(PyObject* notify); | |
538 | ~wxPyTimer(); | |
539 | int GetInterval(); | |
540 | bool IsOneShot(); | |
541 | bool IsRunning(); | |
542 | void SetOwner(wxEvtHandler *owner, int id = -1); | |
543 | void Start(int milliseconds=-1, int oneShot=FALSE); | |
544 | void Stop(); | |
545 | }; | |
546 | ||
547 | //---------------------------------------------------------------------- | |
548 | //---------------------------------------------------------------------- | |
549 | ||
550 | ||
551 | enum | |
552 | { | |
553 | wxLOG_FatalError, // program can't continue, abort immediately | |
554 | wxLOG_Error, // a serious error, user must be informed about it | |
555 | wxLOG_Warning, // user is normally informed about it but may be ignored | |
556 | wxLOG_Message, // normal message (i.e. normal output of a non GUI app) | |
557 | wxLOG_Info, // informational message (a.k.a. 'Verbose') | |
558 | wxLOG_Status, // informational: might go to the status line of GUI app | |
559 | wxLOG_Debug, // never shown to the user, disabled in release mode | |
560 | wxLOG_Trace, // trace messages are also only enabled in debug mode | |
561 | wxLOG_Progress, // used for progress indicator (not yet) | |
562 | wxLOG_User = 100 // user defined levels start here | |
563 | }; | |
564 | ||
565 | ||
566 | class wxLog | |
567 | { | |
568 | public: | |
569 | wxLog(); | |
570 | ||
571 | static bool IsEnabled(); | |
572 | static bool EnableLogging(bool doIt = TRUE); | |
573 | static void OnLog(wxLogLevel level, const char *szString, int t=0); | |
574 | ||
575 | virtual void Flush(); | |
576 | bool HasPendingMessages() const; | |
577 | ||
578 | static void FlushActive(); | |
579 | static wxLog *GetActiveTarget(); | |
580 | static wxLog *SetActiveTarget(wxLog *pLogger); | |
581 | ||
582 | static void Suspend(); | |
583 | static void Resume(); | |
584 | ||
585 | void SetVerbose(bool bVerbose = TRUE); | |
586 | ||
587 | static void DontCreateOnDemand(); | |
588 | static void SetTraceMask(wxTraceMask ulMask); | |
589 | static void AddTraceMask(const wxString& str); | |
590 | static void RemoveTraceMask(const wxString& str); | |
591 | ||
592 | bool GetVerbose() const { return m_bVerbose; } | |
593 | ||
594 | static wxTraceMask GetTraceMask(); | |
595 | static bool IsAllowedTraceMask(const char *mask); | |
596 | ||
597 | }; | |
598 | ||
599 | ||
600 | class wxLogStderr : public wxLog | |
601 | { | |
602 | public: | |
603 | wxLogStderr(/* TODO: FILE *fp = (FILE *) NULL*/); | |
604 | }; | |
605 | ||
606 | ||
607 | class wxLogTextCtrl : public wxLog | |
608 | { | |
609 | public: | |
610 | wxLogTextCtrl(wxTextCtrl *pTextCtrl); | |
611 | }; | |
612 | ||
613 | ||
614 | class wxLogGui : public wxLog | |
615 | { | |
616 | public: | |
617 | wxLogGui(); | |
618 | }; | |
619 | ||
620 | class wxLogWindow : public wxLog | |
621 | { | |
622 | public: | |
623 | wxLogWindow(wxFrame *pParent, // the parent frame (can be NULL) | |
624 | const char *szTitle, // the title of the frame | |
625 | bool bShow = TRUE, // show window immediately? | |
626 | bool bPassToOld = TRUE); // pass log messages to the old target? | |
627 | ||
628 | void Show(bool bShow = TRUE); | |
629 | wxFrame *GetFrame() const; | |
630 | wxLog *GetOldLog() const; | |
631 | bool IsPassingMessages() const; | |
632 | void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; } | |
633 | }; | |
634 | ||
635 | ||
636 | class wxLogNull | |
637 | { | |
638 | public: | |
639 | wxLogNull(); | |
640 | ~wxLogNull(); | |
641 | }; | |
642 | ||
643 | ||
644 | unsigned long wxSysErrorCode(); | |
645 | const char* wxSysErrorMsg(unsigned long nErrCode = 0); | |
646 | void wxLogFatalError(const char *szFormat); | |
647 | void wxLogError(const char *szFormat); | |
648 | void wxLogWarning(const char *szFormat); | |
649 | void wxLogMessage(const char *szFormat); | |
650 | void wxLogInfo(const char *szFormat); | |
651 | void wxLogVerbose(const char *szFormat); | |
652 | void wxLogStatus(const char *szFormat); | |
653 | %name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const char *szFormat); | |
654 | void wxLogSysError(const char *szFormat); | |
655 | ||
656 | ||
c368d904 RD |
657 | |
658 | //---------------------------------------------------------------------- | |
659 | ||
1b62f00d RD |
660 | |
661 | enum { | |
662 | /* event type */ | |
663 | wxEVT_END_PROCESS | |
664 | }; | |
665 | ||
666 | ||
c368d904 RD |
667 | class wxProcessEvent : public wxEvent { |
668 | public: | |
669 | wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0); | |
670 | int GetPid(); | |
671 | int GetExitCode(); | |
672 | int m_pid, m_exitcode; | |
673 | }; | |
674 | ||
675 | ||
676 | ||
677 | ||
678 | %{ // C++ version of wxProcess derived class | |
679 | ||
680 | class wxPyProcess : public wxProcess { | |
681 | public: | |
682 | wxPyProcess(wxEvtHandler *parent = NULL, int id = -1) | |
683 | : wxProcess(parent, id) | |
684 | {} | |
685 | ||
686 | DEC_PYCALLBACK_VOID_INTINT(OnTerminate); | |
687 | ||
688 | PYPRIVATE; | |
689 | }; | |
690 | ||
691 | IMP_PYCALLBACK_VOID_INTINT( wxPyProcess, wxProcess, OnTerminate); | |
692 | %} | |
693 | ||
694 | ||
695 | %name(wxProcess)class wxPyProcess : public wxEvtHandler { | |
696 | public: | |
697 | wxPyProcess(wxEvtHandler *parent = NULL, int id = -1); | |
698 | %addmethods { void Destroy() { delete self; } } | |
699 | ||
700 | void _setSelf(PyObject* self, PyObject* _class); | |
701 | %pragma(python) addtomethod = "__init__:self._setSelf(self, wxProcess)" | |
702 | ||
703 | void base_OnTerminate(int pid, int status); | |
704 | ||
705 | void Redirect(); | |
706 | bool IsRedirected(); | |
707 | void Detach(); | |
708 | ||
709 | wxInputStream *GetInputStream(); | |
710 | wxInputStream *GetErrorStream(); | |
711 | wxOutputStream *GetOutputStream(); | |
712 | ||
713 | void CloseOutput(); | |
714 | }; | |
715 | ||
716 | ||
717 | ||
718 | long wxExecute(const wxString& command, | |
719 | int sync = FALSE, | |
720 | wxPyProcess *process = NULL); | |
721 | ||
185d7c3e RD |
722 | //---------------------------------------------------------------------- |
723 | ||
2cd2fac8 | 724 | #ifdef __WXMSW__ |
185d7c3e RD |
725 | class wxJoystick { |
726 | public: | |
727 | wxJoystick(int joystick = wxJOYSTICK1); | |
728 | wxPoint GetPosition(); | |
729 | int GetZPosition(); | |
730 | int GetButtonState(); | |
731 | int GetPOVPosition(); | |
732 | int GetPOVCTSPosition(); | |
733 | int GetRudderPosition(); | |
734 | int GetUPosition(); | |
735 | int GetVPosition(); | |
736 | int GetMovementThreshold(); | |
737 | void SetMovementThreshold(int threshold) ; | |
738 | ||
739 | bool IsOk(void); | |
740 | int GetNumberJoysticks(); | |
741 | int GetManufacturerId(); | |
742 | int GetProductId(); | |
743 | wxString GetProductName(); | |
744 | int GetXMin(); | |
745 | int GetYMin(); | |
746 | int GetZMin(); | |
747 | int GetXMax(); | |
748 | int GetYMax(); | |
749 | int GetZMax(); | |
750 | int GetNumberButtons(); | |
751 | int GetNumberAxes(); | |
752 | int GetMaxButtons(); | |
753 | int GetMaxAxes(); | |
754 | int GetPollingMin(); | |
755 | int GetPollingMax(); | |
756 | int GetRudderMin(); | |
757 | int GetRudderMax(); | |
758 | int GetUMin(); | |
759 | int GetUMax(); | |
760 | int GetVMin(); | |
761 | int GetVMax(); | |
762 | ||
763 | bool HasRudder(); | |
764 | bool HasZ(); | |
765 | bool HasU(); | |
766 | bool HasV(); | |
767 | bool HasPOV(); | |
768 | bool HasPOV4Dir(); | |
769 | bool HasPOVCTS(); | |
770 | ||
771 | bool SetCapture(wxWindow* win, int pollingFreq = 0); | |
772 | bool ReleaseCapture(); | |
773 | }; | |
2cd2fac8 | 774 | #endif |
185d7c3e | 775 | |
f0261a72 RD |
776 | //---------------------------------------------------------------------- |
777 | //---------------------------------------------------------------------- | |
778 |