]>
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 | ||
b1462dfa | 385 | void wxPostEvent(wxEvtHandler *dest, wxEvent& event); |
694759cf | 386 | void wxWakeUpIdle(); |
2abc0a0f | 387 | |
c368d904 RD |
388 | bool wxSafeYield(wxWindow* win=NULL); |
389 | ||
2abc0a0f | 390 | //---------------------------------------------------------------------- |
f6bcfd97 BP |
391 | |
392 | ||
393 | class wxTipProvider | |
394 | { | |
395 | public: | |
396 | // wxTipProvider(size_t currentTip); **** Abstract base class | |
397 | ~wxTipProvider(); | |
398 | ||
399 | virtual wxString GetTip() = 0; | |
400 | size_t GetCurrentTip(); | |
401 | ||
402 | }; | |
403 | ||
404 | ||
405 | // The C++ version of wxPyTipProvider | |
406 | %{ | |
407 | class wxPyTipProvider : public wxTipProvider { | |
408 | public: | |
409 | wxPyTipProvider(size_t currentTip) | |
410 | : wxTipProvider(currentTip) {} | |
411 | ||
412 | DEC_PYCALLBACK_STRING__pure(GetTip); | |
413 | ||
414 | PYPRIVATE; | |
415 | }; | |
416 | ||
417 | IMP_PYCALLBACK_STRING__pure( wxPyTipProvider, wxTipProvider, GetTip); | |
418 | ||
419 | %} | |
420 | ||
421 | ||
422 | // Now let SWIG know about it | |
423 | class wxPyTipProvider : public wxTipProvider { | |
424 | public: | |
425 | wxPyTipProvider(size_t currentTip); | |
426 | }; | |
427 | ||
428 | ||
429 | ||
430 | bool wxShowTip(wxWindow *parent, wxTipProvider *tipProvider, bool showAtStartup = TRUE); | |
431 | %new wxTipProvider * wxCreateFileTipProvider(const wxString& filename, size_t currentTip); | |
432 | ||
433 | ||
434 | //---------------------------------------------------------------------- | |
435 | ||
436 | %{ | |
437 | #include <wx/generic/dragimgg.h> | |
438 | static wxPoint wxPyNullPoint; | |
439 | %} | |
440 | ||
441 | %name (wxDragImage) class wxGenericDragImage | |
442 | { | |
443 | public: | |
444 | ||
445 | wxGenericDragImage(const wxBitmap& image, | |
446 | const wxCursor& cursor = wxNullCursor, | |
447 | const wxPoint& hotspot = wxPyNullPoint); | |
448 | ~wxGenericDragImage(); | |
449 | ||
450 | bool BeginDrag(const wxPoint& hotspot, wxWindow* window, | |
451 | bool fullScreen = FALSE, wxRect* rect = NULL); | |
452 | ||
453 | %name(BeginDrag2) bool BeginDrag(const wxPoint& hotspot, wxWindow* window, | |
454 | wxWindow* fullScreenRect); | |
455 | ||
456 | bool EndDrag(); | |
457 | bool Move(const wxPoint& pt); | |
458 | bool Show(); | |
459 | bool Hide(); | |
460 | ||
461 | wxRect GetImageRect(const wxPoint& pos) const; | |
462 | bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos, | |
463 | bool eraseOld, bool drawNew); | |
464 | }; | |
465 | ||
466 | ||
467 | // Alternate Constructors | |
468 | %new wxGenericDragImage* wxDragIcon(const wxIcon& image, | |
469 | const wxCursor& cursor = wxNullCursor, | |
470 | const wxPoint& hotspot = wxPyNullPoint); | |
471 | ||
472 | %new wxGenericDragImage* wxDragString(const wxString& str, | |
473 | const wxCursor& cursor = wxNullCursor, | |
474 | const wxPoint& hotspot = wxPyNullPoint); | |
475 | ||
476 | %new wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id); | |
477 | ||
478 | %new wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id); | |
479 | ||
480 | ||
481 | %{ | |
482 | ||
483 | wxGenericDragImage* wxDragIcon(const wxIcon& image, | |
484 | const wxCursor& cursor, | |
485 | const wxPoint& hotspot) { | |
486 | return new wxGenericDragImage(image, cursor, hotspot); | |
487 | } | |
488 | ||
489 | wxGenericDragImage* wxDragString(const wxString& str, | |
490 | const wxCursor& cursor, | |
491 | const wxPoint& hotspot) { | |
492 | return new wxGenericDragImage(str, cursor, hotspot); | |
493 | } | |
494 | ||
495 | wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) { | |
496 | return new wxGenericDragImage(treeCtrl, id); | |
497 | } | |
498 | ||
499 | wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id) { | |
500 | return new wxGenericDragImage(listCtrl, id); | |
501 | } | |
502 | ||
503 | %} | |
504 | ||
505 | ||
506 | ||
507 | //---------------------------------------------------------------------- | |
508 | ||
509 | class wxPyTimer { | |
510 | public: | |
511 | wxPyTimer(PyObject* notify); | |
512 | ~wxPyTimer(); | |
513 | int GetInterval(); | |
514 | bool IsOneShot(); | |
515 | bool IsRunning(); | |
516 | void SetOwner(wxEvtHandler *owner, int id = -1); | |
517 | void Start(int milliseconds=-1, int oneShot=FALSE); | |
518 | void Stop(); | |
519 | }; | |
520 | ||
521 | //---------------------------------------------------------------------- | |
522 | //---------------------------------------------------------------------- | |
523 | ||
524 | ||
525 | enum | |
526 | { | |
527 | wxLOG_FatalError, // program can't continue, abort immediately | |
528 | wxLOG_Error, // a serious error, user must be informed about it | |
529 | wxLOG_Warning, // user is normally informed about it but may be ignored | |
530 | wxLOG_Message, // normal message (i.e. normal output of a non GUI app) | |
531 | wxLOG_Info, // informational message (a.k.a. 'Verbose') | |
532 | wxLOG_Status, // informational: might go to the status line of GUI app | |
533 | wxLOG_Debug, // never shown to the user, disabled in release mode | |
534 | wxLOG_Trace, // trace messages are also only enabled in debug mode | |
535 | wxLOG_Progress, // used for progress indicator (not yet) | |
536 | wxLOG_User = 100 // user defined levels start here | |
537 | }; | |
538 | ||
539 | ||
540 | class wxLog | |
541 | { | |
542 | public: | |
543 | wxLog(); | |
544 | ||
545 | static bool IsEnabled(); | |
546 | static bool EnableLogging(bool doIt = TRUE); | |
547 | static void OnLog(wxLogLevel level, const char *szString, int t=0); | |
548 | ||
549 | virtual void Flush(); | |
550 | bool HasPendingMessages() const; | |
551 | ||
552 | static void FlushActive(); | |
553 | static wxLog *GetActiveTarget(); | |
554 | static wxLog *SetActiveTarget(wxLog *pLogger); | |
555 | ||
556 | static void Suspend(); | |
557 | static void Resume(); | |
558 | ||
559 | void SetVerbose(bool bVerbose = TRUE); | |
560 | ||
561 | static void DontCreateOnDemand(); | |
562 | static void SetTraceMask(wxTraceMask ulMask); | |
563 | static void AddTraceMask(const wxString& str); | |
564 | static void RemoveTraceMask(const wxString& str); | |
565 | ||
566 | bool GetVerbose() const { return m_bVerbose; } | |
567 | ||
568 | static wxTraceMask GetTraceMask(); | |
569 | static bool IsAllowedTraceMask(const char *mask); | |
570 | ||
571 | }; | |
572 | ||
573 | ||
574 | class wxLogStderr : public wxLog | |
575 | { | |
576 | public: | |
577 | wxLogStderr(/* TODO: FILE *fp = (FILE *) NULL*/); | |
578 | }; | |
579 | ||
580 | ||
581 | class wxLogTextCtrl : public wxLog | |
582 | { | |
583 | public: | |
584 | wxLogTextCtrl(wxTextCtrl *pTextCtrl); | |
585 | }; | |
586 | ||
587 | ||
588 | class wxLogGui : public wxLog | |
589 | { | |
590 | public: | |
591 | wxLogGui(); | |
592 | }; | |
593 | ||
594 | class wxLogWindow : public wxLog | |
595 | { | |
596 | public: | |
597 | wxLogWindow(wxFrame *pParent, // the parent frame (can be NULL) | |
598 | const char *szTitle, // the title of the frame | |
599 | bool bShow = TRUE, // show window immediately? | |
600 | bool bPassToOld = TRUE); // pass log messages to the old target? | |
601 | ||
602 | void Show(bool bShow = TRUE); | |
603 | wxFrame *GetFrame() const; | |
604 | wxLog *GetOldLog() const; | |
605 | bool IsPassingMessages() const; | |
606 | void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; } | |
607 | }; | |
608 | ||
609 | ||
610 | class wxLogNull | |
611 | { | |
612 | public: | |
613 | wxLogNull(); | |
614 | ~wxLogNull(); | |
615 | }; | |
616 | ||
617 | ||
618 | unsigned long wxSysErrorCode(); | |
619 | const char* wxSysErrorMsg(unsigned long nErrCode = 0); | |
620 | void wxLogFatalError(const char *szFormat); | |
621 | void wxLogError(const char *szFormat); | |
622 | void wxLogWarning(const char *szFormat); | |
623 | void wxLogMessage(const char *szFormat); | |
624 | void wxLogInfo(const char *szFormat); | |
625 | void wxLogVerbose(const char *szFormat); | |
626 | void wxLogStatus(const char *szFormat); | |
627 | %name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const char *szFormat); | |
628 | void wxLogSysError(const char *szFormat); | |
629 | ||
630 | ||
c368d904 RD |
631 | |
632 | //---------------------------------------------------------------------- | |
633 | ||
1b62f00d RD |
634 | |
635 | enum { | |
636 | /* event type */ | |
637 | wxEVT_END_PROCESS | |
638 | }; | |
639 | ||
640 | ||
c368d904 RD |
641 | class wxProcessEvent : public wxEvent { |
642 | public: | |
643 | wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0); | |
644 | int GetPid(); | |
645 | int GetExitCode(); | |
646 | int m_pid, m_exitcode; | |
647 | }; | |
648 | ||
649 | ||
650 | ||
651 | ||
652 | %{ // C++ version of wxProcess derived class | |
653 | ||
654 | class wxPyProcess : public wxProcess { | |
655 | public: | |
656 | wxPyProcess(wxEvtHandler *parent = NULL, int id = -1) | |
657 | : wxProcess(parent, id) | |
658 | {} | |
659 | ||
660 | DEC_PYCALLBACK_VOID_INTINT(OnTerminate); | |
661 | ||
662 | PYPRIVATE; | |
663 | }; | |
664 | ||
665 | IMP_PYCALLBACK_VOID_INTINT( wxPyProcess, wxProcess, OnTerminate); | |
666 | %} | |
667 | ||
668 | ||
669 | %name(wxProcess)class wxPyProcess : public wxEvtHandler { | |
670 | public: | |
671 | wxPyProcess(wxEvtHandler *parent = NULL, int id = -1); | |
672 | %addmethods { void Destroy() { delete self; } } | |
673 | ||
674 | void _setSelf(PyObject* self, PyObject* _class); | |
675 | %pragma(python) addtomethod = "__init__:self._setSelf(self, wxProcess)" | |
676 | ||
677 | void base_OnTerminate(int pid, int status); | |
678 | ||
679 | void Redirect(); | |
680 | bool IsRedirected(); | |
681 | void Detach(); | |
682 | ||
683 | wxInputStream *GetInputStream(); | |
684 | wxInputStream *GetErrorStream(); | |
685 | wxOutputStream *GetOutputStream(); | |
686 | ||
687 | void CloseOutput(); | |
688 | }; | |
689 | ||
690 | ||
691 | ||
692 | long wxExecute(const wxString& command, | |
693 | int sync = FALSE, | |
694 | wxPyProcess *process = NULL); | |
695 | ||
185d7c3e RD |
696 | //---------------------------------------------------------------------- |
697 | ||
2cd2fac8 | 698 | #ifdef __WXMSW__ |
185d7c3e RD |
699 | class wxJoystick { |
700 | public: | |
701 | wxJoystick(int joystick = wxJOYSTICK1); | |
702 | wxPoint GetPosition(); | |
703 | int GetZPosition(); | |
704 | int GetButtonState(); | |
705 | int GetPOVPosition(); | |
706 | int GetPOVCTSPosition(); | |
707 | int GetRudderPosition(); | |
708 | int GetUPosition(); | |
709 | int GetVPosition(); | |
710 | int GetMovementThreshold(); | |
711 | void SetMovementThreshold(int threshold) ; | |
712 | ||
713 | bool IsOk(void); | |
714 | int GetNumberJoysticks(); | |
715 | int GetManufacturerId(); | |
716 | int GetProductId(); | |
717 | wxString GetProductName(); | |
718 | int GetXMin(); | |
719 | int GetYMin(); | |
720 | int GetZMin(); | |
721 | int GetXMax(); | |
722 | int GetYMax(); | |
723 | int GetZMax(); | |
724 | int GetNumberButtons(); | |
725 | int GetNumberAxes(); | |
726 | int GetMaxButtons(); | |
727 | int GetMaxAxes(); | |
728 | int GetPollingMin(); | |
729 | int GetPollingMax(); | |
730 | int GetRudderMin(); | |
731 | int GetRudderMax(); | |
732 | int GetUMin(); | |
733 | int GetUMax(); | |
734 | int GetVMin(); | |
735 | int GetVMax(); | |
736 | ||
737 | bool HasRudder(); | |
738 | bool HasZ(); | |
739 | bool HasU(); | |
740 | bool HasV(); | |
741 | bool HasPOV(); | |
742 | bool HasPOV4Dir(); | |
743 | bool HasPOVCTS(); | |
744 | ||
745 | bool SetCapture(wxWindow* win, int pollingFreq = 0); | |
746 | bool ReleaseCapture(); | |
747 | }; | |
2cd2fac8 | 748 | #endif |
185d7c3e | 749 | |
f0261a72 RD |
750 | //---------------------------------------------------------------------- |
751 | //---------------------------------------------------------------------- | |
752 |