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