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