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