]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/misc2.i
Updated version to 2.3.2 so apps can test for differences in new merged source
[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
289
290 %inline %{
291 void wxToolTip_Enable(bool flag) {
292 wxToolTip::Enable(flag);
293 }
294
295 void wxToolTip_SetDelay(long milliseconds) {
296 wxToolTip::SetDelay(milliseconds);
297 }
298 %}
299
300 //----------------------------------------------------------------------
301
302 class wxCaret {
303 public:
304 wxCaret(wxWindow* window, const wxSize& size);
305 ~wxCaret();
306
307 bool IsOk();
308 bool IsVisible();
309 %name(GetPositionTuple)void GetPosition(int *OUTPUT, int *OUTPUT);
310 wxPoint GetPosition();
311 %name(GetSizeTuple)void GetSize(int *OUTPUT, int *OUTPUT);
312 wxSize GetSize();
313 wxWindow *GetWindow();
314 %name(MoveXY)void Move(int x, int y);
315 void Move(const wxPoint& pt);
316 %name(SetSizeWH) void SetSize(int width, int height);
317 void SetSize(const wxSize& size);
318 void Show(int show = TRUE);
319 void Hide();
320 };
321
322 %inline %{
323 int wxCaret_GetBlinkTime() {
324 return wxCaret::GetBlinkTime();
325 }
326
327 void wxCaret_SetBlinkTime(int milliseconds) {
328 wxCaret::SetBlinkTime(milliseconds);
329 }
330 %}
331
332 //----------------------------------------------------------------------
333
334 %{
335 class wxPyFontEnumerator : public wxFontEnumerator {
336 public:
337 wxPyFontEnumerator() {}
338 ~wxPyFontEnumerator() {}
339
340 DEC_PYCALLBACK_BOOL_STRING(OnFacename);
341 DEC_PYCALLBACK_BOOL_STRINGSTRING(OnFontEncoding);
342
343 PYPRIVATE;
344 };
345
346 IMP_PYCALLBACK_BOOL_STRING(wxPyFontEnumerator, wxFontEnumerator, OnFacename);
347 IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEncoding);
348
349 %}
350
351 %name(wxFontEnumerator) class wxPyFontEnumerator {
352 public:
353 wxPyFontEnumerator();
354 ~wxPyFontEnumerator();
355 void _setSelf(PyObject* self, PyObject* _class);
356 %pragma(python) addtomethod = "__init__:self._setSelf(self, wxFontEnumerator)"
357
358 bool EnumerateFacenames(
359 wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
360 bool fixedWidthOnly = FALSE);
361 bool EnumerateEncodings(const char* facename = "");
362
363 //wxArrayString* GetEncodings();
364 //wxArrayString* GetFacenames();
365 %addmethods {
366 PyObject* GetEncodings() {
367 wxArrayString* arr = self->GetEncodings();
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 PyObject* GetFacenames() {
375 wxArrayString* arr = self->GetFacenames();
376 PyObject* list = PyList_New(0);
377 for (size_t x=0; x<arr->GetCount(); x++)
378 PyList_Append(list, PyString_FromString((*arr)[x]));
379 return list;
380 }
381 }
382 };
383
384 //----------------------------------------------------------------------
385
386 class wxBusyCursor {
387 public:
388 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
389 ~wxBusyCursor();
390 };
391
392 //----------------------------------------------------------------------
393
394 class wxWindowDisabler {
395 public:
396 wxWindowDisabler(wxWindow *winToSkip = NULL);
397 ~wxWindowDisabler();
398 };
399
400 //----------------------------------------------------------------------
401
402 bool wxSafeYield(wxWindow* win=NULL);
403 void wxPostEvent(wxEvtHandler *dest, wxEvent& event);
404 void wxWakeUpIdle();
405
406
407 #ifdef __WXMSW__
408 void wxWakeUpMainThread();
409 #endif
410
411 void wxMutexGuiEnter();
412 void wxMutexGuiLeave();
413
414
415 class wxMutexGuiLocker {
416 public:
417 wxMutexGuiLocker();
418 ~wxMutexGuiLocker();
419 };
420
421
422 %inline %{
423 bool wxThread_IsMain() {
424 return wxThread::IsMain();
425 }
426 %}
427
428 //----------------------------------------------------------------------
429
430
431 class wxTipProvider
432 {
433 public:
434 // wxTipProvider(size_t currentTip); **** Abstract base class
435 ~wxTipProvider();
436
437 virtual wxString GetTip() = 0;
438 size_t GetCurrentTip();
439
440 };
441
442
443 // The C++ version of wxPyTipProvider
444 %{
445 class wxPyTipProvider : public wxTipProvider {
446 public:
447 wxPyTipProvider(size_t currentTip)
448 : wxTipProvider(currentTip) {}
449
450 DEC_PYCALLBACK_STRING__pure(GetTip);
451
452 PYPRIVATE;
453 };
454
455 IMP_PYCALLBACK_STRING__pure( wxPyTipProvider, wxTipProvider, GetTip);
456
457 %}
458
459
460 // Now let SWIG know about it
461 class wxPyTipProvider : public wxTipProvider {
462 public:
463 wxPyTipProvider(size_t currentTip);
464 };
465
466
467
468 bool wxShowTip(wxWindow *parent, wxTipProvider *tipProvider, bool showAtStartup = TRUE);
469 %new wxTipProvider * wxCreateFileTipProvider(const wxString& filename, size_t currentTip);
470
471
472 //----------------------------------------------------------------------
473
474 %{
475 #include <wx/generic/dragimgg.h>
476 %}
477
478 %name (wxDragImage) class wxGenericDragImage : public wxObject
479 {
480 public:
481
482 wxGenericDragImage(const wxBitmap& image,
483 const wxCursor& cursor = wxNullCursor);
484 ~wxGenericDragImage();
485
486 void SetBackingBitmap(wxBitmap* bitmap);
487 bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
488 bool fullScreen = FALSE, wxRect* rect = NULL);
489
490 %name(BeginDrag2) bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
491 wxWindow* fullScreenRect);
492
493 bool EndDrag();
494 bool Move(const wxPoint& pt);
495 bool Show();
496 bool Hide();
497
498 wxRect GetImageRect(const wxPoint& pos) const;
499 bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos,
500 bool eraseOld, bool drawNew);
501 };
502
503
504 // Alternate Constructors
505 %new wxGenericDragImage* wxDragIcon(const wxIcon& image,
506 const wxCursor& cursor = wxNullCursor);
507
508 %new wxGenericDragImage* wxDragString(const wxString& str,
509 const wxCursor& cursor = wxNullCursor);
510
511 %new wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
512
513 %new wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id);
514
515
516 %{
517
518 wxGenericDragImage* wxDragIcon(const wxIcon& image,
519 const wxCursor& cursor) {
520 return new wxGenericDragImage(image, cursor);
521 }
522
523 wxGenericDragImage* wxDragString(const wxString& str,
524 const wxCursor& cursor) {
525 return new wxGenericDragImage(str, cursor);
526 }
527
528 wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) {
529 return new wxGenericDragImage(treeCtrl, id);
530 }
531
532 wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id) {
533 return new wxGenericDragImage(listCtrl, id);
534 }
535
536 %}
537
538
539
540 //----------------------------------------------------------------------
541
542 class wxPyTimer : public wxObject {
543 public:
544 wxPyTimer(PyObject* notify);
545 ~wxPyTimer();
546 int GetInterval();
547 bool IsOneShot();
548 bool IsRunning();
549 void SetOwner(wxEvtHandler *owner, int id = -1);
550 void Start(int milliseconds=-1, int oneShot=FALSE);
551 void Stop();
552 };
553
554 //----------------------------------------------------------------------
555 //----------------------------------------------------------------------
556
557
558 enum
559 {
560 wxLOG_FatalError, // program can't continue, abort immediately
561 wxLOG_Error, // a serious error, user must be informed about it
562 wxLOG_Warning, // user is normally informed about it but may be ignored
563 wxLOG_Message, // normal message (i.e. normal output of a non GUI app)
564 wxLOG_Info, // informational message (a.k.a. 'Verbose')
565 wxLOG_Status, // informational: might go to the status line of GUI app
566 wxLOG_Debug, // never shown to the user, disabled in release mode
567 wxLOG_Trace, // trace messages are also only enabled in debug mode
568 wxLOG_Progress, // used for progress indicator (not yet)
569 wxLOG_User = 100 // user defined levels start here
570 };
571
572
573 class wxLog
574 {
575 public:
576 wxLog();
577
578 static bool IsEnabled();
579 static bool EnableLogging(bool doIt = TRUE);
580 static void OnLog(wxLogLevel level, const char *szString, int t=0);
581
582 virtual void Flush();
583 bool HasPendingMessages() const;
584
585 static void FlushActive();
586 static wxLog *GetActiveTarget();
587 static wxLog *SetActiveTarget(wxLog *pLogger);
588
589 static void Suspend();
590 static void Resume();
591
592 void SetVerbose(bool bVerbose = TRUE);
593
594 static void DontCreateOnDemand();
595 static void SetTraceMask(wxTraceMask ulMask);
596 static void AddTraceMask(const wxString& str);
597 static void RemoveTraceMask(const wxString& str);
598
599 bool GetVerbose() const { return m_bVerbose; }
600
601 static wxTraceMask GetTraceMask();
602 static bool IsAllowedTraceMask(const char *mask);
603
604 };
605
606
607 class wxLogStderr : public wxLog
608 {
609 public:
610 wxLogStderr(/* TODO: FILE *fp = (FILE *) NULL*/);
611 };
612
613
614 class wxLogTextCtrl : public wxLog
615 {
616 public:
617 wxLogTextCtrl(wxTextCtrl *pTextCtrl);
618 };
619
620
621 class wxLogGui : public wxLog
622 {
623 public:
624 wxLogGui();
625 };
626
627 class wxLogWindow : public wxLog
628 {
629 public:
630 wxLogWindow(wxFrame *pParent, // the parent frame (can be NULL)
631 const char *szTitle, // the title of the frame
632 bool bShow = TRUE, // show window immediately?
633 bool bPassToOld = TRUE); // pass log messages to the old target?
634
635 void Show(bool bShow = TRUE);
636 wxFrame *GetFrame() const;
637 wxLog *GetOldLog() const;
638 bool IsPassingMessages() const;
639 void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; }
640 };
641
642
643 class wxLogNull
644 {
645 public:
646 wxLogNull();
647 ~wxLogNull();
648 };
649
650
651 unsigned long wxSysErrorCode();
652 const char* wxSysErrorMsg(unsigned long nErrCode = 0);
653 void wxLogFatalError(const char *szFormat);
654 void wxLogError(const char *szFormat);
655 void wxLogWarning(const char *szFormat);
656 void wxLogMessage(const char *szFormat);
657 void wxLogInfo(const char *szFormat);
658 void wxLogVerbose(const char *szFormat);
659 void wxLogStatus(const char *szFormat);
660 %name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const char *szFormat);
661 void wxLogSysError(const char *szFormat);
662
663
664
665 //----------------------------------------------------------------------
666
667
668 enum {
669 /* event type */
670 wxEVT_END_PROCESS
671 };
672
673
674 class wxProcessEvent : public wxEvent {
675 public:
676 wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0);
677 int GetPid();
678 int GetExitCode();
679 int m_pid, m_exitcode;
680 };
681
682
683
684
685 %{ // C++ version of wxProcess derived class
686
687 class wxPyProcess : public wxProcess {
688 public:
689 wxPyProcess(wxEvtHandler *parent = NULL, int id = -1)
690 : wxProcess(parent, id)
691 {}
692
693 DEC_PYCALLBACK_VOID_INTINT(OnTerminate);
694
695 PYPRIVATE;
696 };
697
698 IMP_PYCALLBACK_VOID_INTINT( wxPyProcess, wxProcess, OnTerminate);
699 %}
700
701
702 %name(wxProcess)class wxPyProcess : public wxEvtHandler {
703 public:
704 wxPyProcess(wxEvtHandler *parent = NULL, int id = -1);
705 %addmethods { void Destroy() { delete self; } }
706
707 void _setSelf(PyObject* self, PyObject* _class);
708 %pragma(python) addtomethod = "__init__:self._setSelf(self, wxProcess)"
709
710 void base_OnTerminate(int pid, int status);
711
712 void Redirect();
713 bool IsRedirected();
714 void Detach();
715
716 wxInputStream *GetInputStream();
717 wxInputStream *GetErrorStream();
718 wxOutputStream *GetOutputStream();
719
720 void CloseOutput();
721 };
722
723
724
725 long wxExecute(const wxString& command,
726 int sync = FALSE,
727 wxPyProcess *process = NULL);
728
729 //----------------------------------------------------------------------
730
731 %{
732 #if !wxUSE_JOYSTICK && !defined(__WXMSW__)
733 // A C++ stub class for wxJoystick for platforms that don't have it.
734 class wxJoystick : public wxObject {
735 public:
736 wxJoystick(int joystick = wxJOYSTICK1) {
737 bool doSave = wxPyRestoreThread();
738 PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform.");
739 wxPySaveThread(doSave);
740 }
741 wxPoint GetPosition() { return wxPoint(-1,-1); }
742 int GetZPosition() { return -1; }
743 int GetButtonState() { return -1; }
744 int GetPOVPosition() { return -1; }
745 int GetPOVCTSPosition() { return -1; }
746 int GetRudderPosition() { return -1; }
747 int GetUPosition() { return -1; }
748 int GetVPosition() { return -1; }
749 int GetMovementThreshold() { return -1; }
750 void SetMovementThreshold(int threshold) {}
751
752 bool IsOk(void) { return FALSE; }
753 int GetNumberJoysticks() { return -1; }
754 int GetManufacturerId() { return -1; }
755 int GetProductId() { return -1; }
756 wxString GetProductName() { return ""; }
757 int GetXMin() { return -1; }
758 int GetYMin() { return -1; }
759 int GetZMin() { return -1; }
760 int GetXMax() { return -1; }
761 int GetYMax() { return -1; }
762 int GetZMax() { return -1; }
763 int GetNumberButtons() { return -1; }
764 int GetNumberAxes() { return -1; }
765 int GetMaxButtons() { return -1; }
766 int GetMaxAxes() { return -1; }
767 int GetPollingMin() { return -1; }
768 int GetPollingMax() { return -1; }
769 int GetRudderMin() { return -1; }
770 int GetRudderMax() { return -1; }
771 int GetUMin() { return -1; }
772 int GetUMax() { return -1; }
773 int GetVMin() { return -1; }
774 int GetVMax() { return -1; }
775
776 bool HasRudder() { return FALSE; }
777 bool HasZ() { return FALSE; }
778 bool HasU() { return FALSE; }
779 bool HasV() { return FALSE; }
780 bool HasPOV() { return FALSE; }
781 bool HasPOV4Dir() { return FALSE; }
782 bool HasPOVCTS() { return FALSE; }
783
784 bool SetCapture(wxWindow* win, int pollingFreq = 0) { return FALSE; }
785 bool ReleaseCapture() { return FALSE; }
786 };
787 #endif
788 %}
789
790
791 class wxJoystick : public wxObject {
792 public:
793 wxJoystick(int joystick = wxJOYSTICK1);
794 ~wxJoystick();
795
796 wxPoint GetPosition();
797 int GetZPosition();
798 int GetButtonState();
799 int GetPOVPosition();
800 int GetPOVCTSPosition();
801 int GetRudderPosition();
802 int GetUPosition();
803 int GetVPosition();
804 int GetMovementThreshold();
805 void SetMovementThreshold(int threshold) ;
806
807 bool IsOk(void);
808 int GetNumberJoysticks();
809 int GetManufacturerId();
810 int GetProductId();
811 wxString GetProductName();
812 int GetXMin();
813 int GetYMin();
814 int GetZMin();
815 int GetXMax();
816 int GetYMax();
817 int GetZMax();
818 int GetNumberButtons();
819 int GetNumberAxes();
820 int GetMaxButtons();
821 int GetMaxAxes();
822 int GetPollingMin();
823 int GetPollingMax();
824 int GetRudderMin();
825 int GetRudderMax();
826 int GetUMin();
827 int GetUMax();
828 int GetVMin();
829 int GetVMax();
830
831 bool HasRudder();
832 bool HasZ();
833 bool HasU();
834 bool HasV();
835 bool HasPOV();
836 bool HasPOV4Dir();
837 bool HasPOVCTS();
838
839 bool SetCapture(wxWindow* win, int pollingFreq = 0);
840 bool ReleaseCapture();
841 };
842
843 //----------------------------------------------------------------------
844
845 %{
846 #if !wxUSE_WAVE && !defined(__WXMSW__)
847 // A C++ stub class for wxWave for platforms that don't have it.
848 class wxWave : public wxObject
849 {
850 public:
851 wxWave(const wxString& fileName, bool isResource = FALSE) {
852 bool doSave = wxPyRestoreThread();
853 PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
854 wxPySaveThread(doSave);
855 }
856 wxWave(int size, const wxByte* data) {
857 bool doSave = wxPyRestoreThread();
858 PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
859 wxPySaveThread(doSave);
860 }
861
862 ~wxWave() {}
863
864 bool IsOk() const { return FALSE; }
865 bool Play(bool async = TRUE, bool looped = FALSE) const { return FALSE; }
866 };
867
868 #endif
869 %}
870
871 class wxWave : public wxObject
872 {
873 public:
874 wxWave(const wxString& fileName, bool isResource = FALSE);
875 ~wxWave();
876
877 bool IsOk() const;
878 bool Play(bool async = TRUE, bool looped = FALSE) const;
879 };
880
881 %new wxWave* wxWaveData(const wxString& data);
882 %{ // Implementations of some alternate "constructors"
883 wxWave* wxWaveData(const wxString& data) {
884 return new wxWave(data.Len(), (wxByte*)data.c_str());
885 }
886 %}
887
888 //----------------------------------------------------------------------
889
890
891 %init %{
892 wxPyPtrTypeMap_Add("wxFontEnumerator", "wxPyFontEnumerator");
893 wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage");
894 wxPyPtrTypeMap_Add("wxProcess", "wxPyProcess");
895 %}
896
897 //----------------------------------------------------------------------
898