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