]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/misc2.i
added wxWindows shared library to link of OpenGL wxWindows shared library
[wxWidgets.git] / wxPython / src / misc2.i
CommitLineData
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>
493f1553
RD
25
26#if wxUSE_JOYSTICK || defined(__WXMSW__)
185d7c3e 27#include <wx/joystick.h>
4662be59 28#endif
493f1553
RD
29
30#if wxUSE_WAVE || defined(__WXMSW__)
31#include <wx/wave.h>
32#endif
bb0054cd
RD
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
f0261a72 43%import misc.i
06c0fba4 44%import gdi.i
b1462dfa 45%import events.i
c368d904 46%import streams.i
06c0fba4 47
b68dc582
RD
48%{
49 static wxString wxPyEmptyStr("");
50%}
51
06c0fba4
RD
52//---------------------------------------------------------------------------
53// Dialog Functions
54
55wxString 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
64wxString 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
1b62f00d
RD
71wxString wxGetPasswordFromUser(const wxString& message,
72 const wxString& caption = wxPyEmptyStr,
73 const wxString& default_value = wxPyEmptyStr,
74 wxWindow *parent = NULL);
75
06c0fba4
RD
76
77// TODO: Need to custom wrap this one...
78// int wxGetMultipleChoice(char* message, char* caption,
eec92d76 79// int LCOUNT, char** choices,
06c0fba4
RD
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
85wxString wxGetSingleChoice(const wxString& message, const wxString& caption,
eec92d76 86 int LCOUNT, wxString* choices,
06c0fba4
RD
87 wxWindow *parent = NULL,
88 int x = -1, int y = -1,
89 bool centre = TRUE,
90 int width=150, int height=200);
91
92int wxGetSingleChoiceIndex(const wxString& message, const wxString& caption,
eec92d76 93 int LCOUNT, wxString* choices,
06c0fba4
RD
94 wxWindow *parent = NULL,
95 int x = -1, int y = -1,
96 bool centre = TRUE,
97 int width=150, int height=200);
98
99
100int 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
106long 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,
b68dc582 112 const wxPoint& pos = wxDefaultPosition);
06c0fba4
RD
113
114//---------------------------------------------------------------------------
115// GDI Functions
116
117bool wxColourDisplay();
1e7ecb7b 118
06c0fba4 119int wxDisplayDepth();
1e7ecb7b
RD
120int wxGetDisplayDepth();
121
ec5d7799 122void wxDisplaySize(int* OUTPUT, int* OUTPUT);
1e7ecb7b 123wxSize wxGetDisplaySize();
1b62f00d 124
ec5d7799 125void wxDisplaySizeMM(int* OUTPUT, int* OUTPUT);
1e7ecb7b
RD
126wxSize wxGetDisplaySizeMM();
127
ec5d7799
RD
128void wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT);
129wxRect wxGetClientDisplayRect();
130
06c0fba4 131void wxSetCursor(wxCursor& cursor);
bb0054cd
RD
132
133//----------------------------------------------------------------------
06c0fba4 134// Miscellaneous functions
bb0054cd
RD
135
136wxWindow * wxFindWindowByLabel(const wxString& label, wxWindow *parent=NULL);
137wxWindow * wxFindWindowByName(const wxString& name, wxWindow *parent=NULL);
138
06c0fba4
RD
139void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR);
140wxWindow * wxGetActiveWindow();
141
493f1553
RD
142wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
143wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
4dfaa61e
RD
144
145#ifdef __WXMSW__
493f1553 146bool wxCheckForInterrupt(wxWindow *wnd);
4dfaa61e
RD
147void wxFlushEvents();
148#endif
06c0fba4
RD
149
150//---------------------------------------------------------------------------
151// Resource System
152
153bool wxResourceAddIdentifier(char *name, int value);
154void wxResourceClear(void);
155wxBitmap wxResourceCreateBitmap(char *resource);
156wxIcon wxResourceCreateIcon(char *resource);
157wxMenuBar * wxResourceCreateMenuBar(char *resource);
158int wxResourceGetIdentifier(char *name);
159bool wxResourceParseData(char *resource, wxResourceTable *table = NULL);
160bool wxResourceParseFile(char *filename, wxResourceTable *table = NULL);
161bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
bb0054cd 162
06c0fba4
RD
163//---------------------------------------------------------------------------
164// System Settings
165
166enum {
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%}
bb0054cd
RD
275
276//---------------------------------------------------------------------------
277// wxToolTip
278
9416aa89 279class wxToolTip : public wxObject {
bb0054cd
RD
280public:
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();
bb0054cd 287
edf2f43e
RD
288 static void Enable(bool flag);
289 static void SetDelay(long milliseconds);
290};
bb0054cd
RD
291
292//----------------------------------------------------------------------
f0261a72
RD
293
294class wxCaret {
295public:
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);
a1df7a95
RD
308 %name(SetSizeWH) void SetSize(int width, int height);
309 void SetSize(const wxSize& size);
f0261a72
RD
310 void Show(int show = TRUE);
311 void Hide();
f0261a72
RD
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
bb0054cd 324//----------------------------------------------------------------------
f0261a72
RD
325
326%{
327class wxPyFontEnumerator : public wxFontEnumerator {
328public:
329 wxPyFontEnumerator() {}
330 ~wxPyFontEnumerator() {}
331
b1462dfa 332 DEC_PYCALLBACK_BOOL_STRING(OnFacename);
f0261a72
RD
333 DEC_PYCALLBACK_BOOL_STRINGSTRING(OnFontEncoding);
334
335 PYPRIVATE;
336};
337
b1462dfa 338IMP_PYCALLBACK_BOOL_STRING(wxPyFontEnumerator, wxFontEnumerator, OnFacename);
f0261a72
RD
339IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEncoding);
340
341%}
342
343%name(wxFontEnumerator) class wxPyFontEnumerator {
344public:
b1462dfa
RD
345 wxPyFontEnumerator();
346 ~wxPyFontEnumerator();
f6bcfd97
BP
347 void _setSelf(PyObject* self, PyObject* _class);
348 %pragma(python) addtomethod = "__init__:self._setSelf(self, wxFontEnumerator)"
f0261a72 349
b1462dfa
RD
350 bool EnumerateFacenames(
351 wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
352 bool fixedWidthOnly = FALSE);
353 bool EnumerateEncodings(const char* facename = "");
65dd82cb
RD
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 }
f0261a72 374};
2abc0a0f
RD
375
376//----------------------------------------------------------------------
377
378class wxBusyCursor {
379public:
380 wxBusyCursor(wxCursor* cursor = wxHOURGLASS_CURSOR);
381 ~wxBusyCursor();
382};
383
b1462dfa 384//----------------------------------------------------------------------
2abc0a0f 385
c368d904
RD
386class wxWindowDisabler {
387public:
388 wxWindowDisabler(wxWindow *winToSkip = NULL);
389 ~wxWindowDisabler();
390};
391
392//----------------------------------------------------------------------
393
6e18ca6c 394bool wxSafeYield(wxWindow* win=NULL);
b1462dfa 395void wxPostEvent(wxEvtHandler *dest, wxEvent& event);
694759cf 396void wxWakeUpIdle();
2abc0a0f 397
6e18ca6c 398
4662be59 399#ifdef __WXMSW__
6e18ca6c 400void wxWakeUpMainThread();
4662be59
RD
401#endif
402
6e18ca6c
RD
403void wxMutexGuiEnter();
404void wxMutexGuiLeave();
405
406
407class wxMutexGuiLocker {
408public:
409 wxMutexGuiLocker();
410 ~wxMutexGuiLocker();
411};
412
413
414%inline %{
415 bool wxThread_IsMain() {
416 return wxThread::IsMain();
417 }
418%}
c368d904 419
2abc0a0f 420//----------------------------------------------------------------------
f6bcfd97
BP
421
422
423class wxTipProvider
424{
425public:
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%{
437class wxPyTipProvider : public wxTipProvider {
438public:
439 wxPyTipProvider(size_t currentTip)
440 : wxTipProvider(currentTip) {}
441
442 DEC_PYCALLBACK_STRING__pure(GetTip);
443
444 PYPRIVATE;
445};
446
447IMP_PYCALLBACK_STRING__pure( wxPyTipProvider, wxTipProvider, GetTip);
448
449%}
450
451
452// Now let SWIG know about it
453class wxPyTipProvider : public wxTipProvider {
454public:
455 wxPyTipProvider(size_t currentTip);
456};
457
458
459
460bool 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>
f6bcfd97
BP
468%}
469
9416aa89 470%name (wxDragImage) class wxGenericDragImage : public wxObject
f6bcfd97
BP
471{
472public:
473
474 wxGenericDragImage(const wxBitmap& image,
10e07c70 475 const wxCursor& cursor = wxNullCursor);
f6bcfd97
BP
476 ~wxGenericDragImage();
477
10e07c70 478 void SetBackingBitmap(wxBitmap* bitmap);
f6bcfd97
BP
479 bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
480 bool fullScreen = FALSE, wxRect* rect = NULL);
481
482 %name(BeginDrag2) bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
483 wxWindow* fullScreenRect);
484
485 bool EndDrag();
486 bool Move(const wxPoint& pt);
487 bool Show();
488 bool Hide();
489
490 wxRect GetImageRect(const wxPoint& pos) const;
491 bool RedrawImage(const wxPoint& oldPos, const wxPoint& newPos,
492 bool eraseOld, bool drawNew);
493};
494
495
496// Alternate Constructors
497%new wxGenericDragImage* wxDragIcon(const wxIcon& image,
10e07c70 498 const wxCursor& cursor = wxNullCursor);
f6bcfd97
BP
499
500%new wxGenericDragImage* wxDragString(const wxString& str,
10e07c70 501 const wxCursor& cursor = wxNullCursor);
f6bcfd97
BP
502
503%new wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
504
505%new wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id);
506
507
508%{
509
510wxGenericDragImage* wxDragIcon(const wxIcon& image,
10e07c70
RD
511 const wxCursor& cursor) {
512 return new wxGenericDragImage(image, cursor);
f6bcfd97
BP
513}
514
515wxGenericDragImage* wxDragString(const wxString& str,
10e07c70
RD
516 const wxCursor& cursor) {
517 return new wxGenericDragImage(str, cursor);
f6bcfd97
BP
518}
519
520wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) {
521 return new wxGenericDragImage(treeCtrl, id);
522}
523
524wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id) {
525 return new wxGenericDragImage(listCtrl, id);
526}
527
528%}
529
530
531
532//----------------------------------------------------------------------
533
9416aa89 534class wxPyTimer : public wxObject {
f6bcfd97
BP
535public:
536 wxPyTimer(PyObject* notify);
537 ~wxPyTimer();
538 int GetInterval();
539 bool IsOneShot();
540 bool IsRunning();
541 void SetOwner(wxEvtHandler *owner, int id = -1);
542 void Start(int milliseconds=-1, int oneShot=FALSE);
543 void Stop();
544};
545
546//----------------------------------------------------------------------
547//----------------------------------------------------------------------
548
549
550enum
551{
552 wxLOG_FatalError, // program can't continue, abort immediately
553 wxLOG_Error, // a serious error, user must be informed about it
554 wxLOG_Warning, // user is normally informed about it but may be ignored
555 wxLOG_Message, // normal message (i.e. normal output of a non GUI app)
556 wxLOG_Info, // informational message (a.k.a. 'Verbose')
557 wxLOG_Status, // informational: might go to the status line of GUI app
558 wxLOG_Debug, // never shown to the user, disabled in release mode
559 wxLOG_Trace, // trace messages are also only enabled in debug mode
560 wxLOG_Progress, // used for progress indicator (not yet)
561 wxLOG_User = 100 // user defined levels start here
562};
563
564
565class wxLog
566{
567public:
568 wxLog();
569
570 static bool IsEnabled();
571 static bool EnableLogging(bool doIt = TRUE);
572 static void OnLog(wxLogLevel level, const char *szString, int t=0);
573
574 virtual void Flush();
575 bool HasPendingMessages() const;
576
577 static void FlushActive();
578 static wxLog *GetActiveTarget();
579 static wxLog *SetActiveTarget(wxLog *pLogger);
580
581 static void Suspend();
582 static void Resume();
583
584 void SetVerbose(bool bVerbose = TRUE);
585
586 static void DontCreateOnDemand();
587 static void SetTraceMask(wxTraceMask ulMask);
588 static void AddTraceMask(const wxString& str);
589 static void RemoveTraceMask(const wxString& str);
590
591 bool GetVerbose() const { return m_bVerbose; }
592
593 static wxTraceMask GetTraceMask();
594 static bool IsAllowedTraceMask(const char *mask);
595
596};
597
598
599class wxLogStderr : public wxLog
600{
601public:
602 wxLogStderr(/* TODO: FILE *fp = (FILE *) NULL*/);
603};
604
605
606class wxLogTextCtrl : public wxLog
607{
608public:
609 wxLogTextCtrl(wxTextCtrl *pTextCtrl);
610};
611
612
613class wxLogGui : public wxLog
614{
615public:
616 wxLogGui();
617};
618
619class wxLogWindow : public wxLog
620{
621public:
622 wxLogWindow(wxFrame *pParent, // the parent frame (can be NULL)
623 const char *szTitle, // the title of the frame
624 bool bShow = TRUE, // show window immediately?
625 bool bPassToOld = TRUE); // pass log messages to the old target?
626
627 void Show(bool bShow = TRUE);
628 wxFrame *GetFrame() const;
629 wxLog *GetOldLog() const;
630 bool IsPassingMessages() const;
631 void PassMessages(bool bDoPass) { m_bPassMessages = bDoPass; }
632};
633
634
635class wxLogNull
636{
637public:
638 wxLogNull();
639 ~wxLogNull();
640};
641
642
643unsigned long wxSysErrorCode();
644const char* wxSysErrorMsg(unsigned long nErrCode = 0);
645void wxLogFatalError(const char *szFormat);
646void wxLogError(const char *szFormat);
647void wxLogWarning(const char *szFormat);
648void wxLogMessage(const char *szFormat);
649void wxLogInfo(const char *szFormat);
650void wxLogVerbose(const char *szFormat);
651void wxLogStatus(const char *szFormat);
652%name(wxLogStatusFrame)void wxLogStatus(wxFrame *pFrame, const char *szFormat);
653void wxLogSysError(const char *szFormat);
654
655
c368d904
RD
656
657//----------------------------------------------------------------------
658
1b62f00d
RD
659
660enum {
661 /* event type */
662 wxEVT_END_PROCESS
663};
664
665
c368d904
RD
666class wxProcessEvent : public wxEvent {
667public:
668 wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0);
669 int GetPid();
670 int GetExitCode();
671 int m_pid, m_exitcode;
672};
673
674
675
676
677%{ // C++ version of wxProcess derived class
678
679class wxPyProcess : public wxProcess {
680public:
681 wxPyProcess(wxEvtHandler *parent = NULL, int id = -1)
682 : wxProcess(parent, id)
683 {}
684
685 DEC_PYCALLBACK_VOID_INTINT(OnTerminate);
686
687 PYPRIVATE;
688};
689
690IMP_PYCALLBACK_VOID_INTINT( wxPyProcess, wxProcess, OnTerminate);
691%}
692
693
694%name(wxProcess)class wxPyProcess : public wxEvtHandler {
695public:
696 wxPyProcess(wxEvtHandler *parent = NULL, int id = -1);
697 %addmethods { void Destroy() { delete self; } }
698
699 void _setSelf(PyObject* self, PyObject* _class);
700 %pragma(python) addtomethod = "__init__:self._setSelf(self, wxProcess)"
701
702 void base_OnTerminate(int pid, int status);
703
704 void Redirect();
705 bool IsRedirected();
706 void Detach();
707
708 wxInputStream *GetInputStream();
709 wxInputStream *GetErrorStream();
710 wxOutputStream *GetOutputStream();
711
712 void CloseOutput();
713};
714
715
716
717long wxExecute(const wxString& command,
718 int sync = FALSE,
719 wxPyProcess *process = NULL);
720
185d7c3e
RD
721//----------------------------------------------------------------------
722
493f1553
RD
723%{
724#if !wxUSE_JOYSTICK && !defined(__WXMSW__)
725// A C++ stub class for wxJoystick for platforms that don't have it.
726class wxJoystick : public wxObject {
727public:
728 wxJoystick(int joystick = wxJOYSTICK1) {
729 bool doSave = wxPyRestoreThread();
730 PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform.");
731 wxPySaveThread(doSave);
732 }
733 wxPoint GetPosition() { return wxPoint(-1,-1); }
734 int GetZPosition() { return -1; }
735 int GetButtonState() { return -1; }
736 int GetPOVPosition() { return -1; }
737 int GetPOVCTSPosition() { return -1; }
738 int GetRudderPosition() { return -1; }
739 int GetUPosition() { return -1; }
740 int GetVPosition() { return -1; }
741 int GetMovementThreshold() { return -1; }
d56cebe7 742 void SetMovementThreshold(int threshold) {}
493f1553
RD
743
744 bool IsOk(void) { return FALSE; }
745 int GetNumberJoysticks() { return -1; }
746 int GetManufacturerId() { return -1; }
747 int GetProductId() { return -1; }
748 wxString GetProductName() { return ""; }
749 int GetXMin() { return -1; }
750 int GetYMin() { return -1; }
751 int GetZMin() { return -1; }
752 int GetXMax() { return -1; }
753 int GetYMax() { return -1; }
754 int GetZMax() { return -1; }
755 int GetNumberButtons() { return -1; }
756 int GetNumberAxes() { return -1; }
757 int GetMaxButtons() { return -1; }
758 int GetMaxAxes() { return -1; }
759 int GetPollingMin() { return -1; }
760 int GetPollingMax() { return -1; }
761 int GetRudderMin() { return -1; }
762 int GetRudderMax() { return -1; }
763 int GetUMin() { return -1; }
764 int GetUMax() { return -1; }
765 int GetVMin() { return -1; }
766 int GetVMax() { return -1; }
767
768 bool HasRudder() { return FALSE; }
769 bool HasZ() { return FALSE; }
770 bool HasU() { return FALSE; }
771 bool HasV() { return FALSE; }
772 bool HasPOV() { return FALSE; }
773 bool HasPOV4Dir() { return FALSE; }
774 bool HasPOVCTS() { return FALSE; }
775
776 bool SetCapture(wxWindow* win, int pollingFreq = 0) { return FALSE; }
777 bool ReleaseCapture() { return FALSE; }
778};
779#endif
780%}
781
782
9416aa89 783class wxJoystick : public wxObject {
185d7c3e
RD
784public:
785 wxJoystick(int joystick = wxJOYSTICK1);
ac346f50
RD
786 ~wxJoystick();
787
185d7c3e
RD
788 wxPoint GetPosition();
789 int GetZPosition();
790 int GetButtonState();
791 int GetPOVPosition();
792 int GetPOVCTSPosition();
793 int GetRudderPosition();
794 int GetUPosition();
795 int GetVPosition();
796 int GetMovementThreshold();
797 void SetMovementThreshold(int threshold) ;
798
799 bool IsOk(void);
800 int GetNumberJoysticks();
801 int GetManufacturerId();
802 int GetProductId();
803 wxString GetProductName();
804 int GetXMin();
805 int GetYMin();
806 int GetZMin();
807 int GetXMax();
808 int GetYMax();
809 int GetZMax();
810 int GetNumberButtons();
811 int GetNumberAxes();
812 int GetMaxButtons();
813 int GetMaxAxes();
814 int GetPollingMin();
815 int GetPollingMax();
816 int GetRudderMin();
817 int GetRudderMax();
818 int GetUMin();
819 int GetUMax();
820 int GetVMin();
821 int GetVMax();
822
823 bool HasRudder();
824 bool HasZ();
825 bool HasU();
826 bool HasV();
827 bool HasPOV();
828 bool HasPOV4Dir();
829 bool HasPOVCTS();
830
831 bool SetCapture(wxWindow* win, int pollingFreq = 0);
832 bool ReleaseCapture();
833};
493f1553
RD
834
835//----------------------------------------------------------------------
836
837%{
0adbc166 838#if !wxUSE_WAVE
493f1553
RD
839// A C++ stub class for wxWave for platforms that don't have it.
840class wxWave : public wxObject
841{
842public:
843 wxWave(const wxString& fileName, bool isResource = FALSE) {
844 bool doSave = wxPyRestoreThread();
845 PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
846 wxPySaveThread(doSave);
847 }
848 wxWave(int size, const wxByte* data) {
849 bool doSave = wxPyRestoreThread();
850 PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
851 wxPySaveThread(doSave);
852 }
853
854 ~wxWave() {}
855
856 bool IsOk() const { return FALSE; }
857 bool Play(bool async = TRUE, bool looped = FALSE) const { return FALSE; }
858};
859
2cd2fac8 860#endif
493f1553
RD
861%}
862
863class wxWave : public wxObject
864{
865public:
866 wxWave(const wxString& fileName, bool isResource = FALSE);
867 ~wxWave();
868
869 bool IsOk() const;
870 bool Play(bool async = TRUE, bool looped = FALSE) const;
871};
872
873%new wxWave* wxWaveData(const wxString& data);
874%{ // Implementations of some alternate "constructors"
875 wxWave* wxWaveData(const wxString& data) {
876 return new wxWave(data.Len(), (wxByte*)data.c_str());
877 }
878%}
185d7c3e 879
f0261a72 880//----------------------------------------------------------------------
9416aa89 881
493f1553 882
9416aa89
RD
883%init %{
884 wxPyPtrTypeMap_Add("wxFontEnumerator", "wxPyFontEnumerator");
885 wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage");
886 wxPyPtrTypeMap_Add("wxProcess", "wxPyProcess");
887%}
888
f0261a72
RD
889//----------------------------------------------------------------------
890