X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b68dc582b8c6dd32ef9f0a4ec91573bd5cc0296a..442d08ce743780b40895848a7d07c083e327aa2f:/wxPython/src/misc2.i?ds=inline diff --git a/wxPython/src/misc2.i b/wxPython/src/misc2.i index e594ee49c6..08d074c5c5 100644 --- a/wxPython/src/misc2.i +++ b/wxPython/src/misc2.i @@ -22,7 +22,14 @@ #include #include #include + +#if wxUSE_JOYSTICK || defined(__WXMSW__) #include +#endif + +#if wxUSE_WAVE || defined(__WXMSW__) +#include +#endif %} //---------------------------------------------------------------------- @@ -61,6 +68,11 @@ wxString wxGetTextFromUser(const wxString& message, int x = -1, int y = -1, bool centre = TRUE); +wxString wxGetPasswordFromUser(const wxString& message, + const wxString& caption = wxPyEmptyStr, + const wxString& default_value = wxPyEmptyStr, + wxWindow *parent = NULL); + // TODO: Need to custom wrap this one... // int wxGetMultipleChoice(char* message, char* caption, @@ -107,11 +119,15 @@ bool wxColourDisplay(); int wxDisplayDepth(); int wxGetDisplayDepth(); -void wxDisplaySize(int* OUTPUT, int* OUTPUT); +void wxDisplaySize(int* OUTPUT, int* OUTPUT); wxSize wxGetDisplaySize(); -void wxDisplaySizeMM(int* OUTPUT, int* OUTPUT); + +void wxDisplaySizeMM(int* OUTPUT, int* OUTPUT); wxSize wxGetDisplaySizeMM(); +void wxClientDisplayRect(int *OUTPUT, int *OUTPUT, int *OUTPUT, int *OUTPUT); +wxRect wxGetClientDisplayRect(); + void wxSetCursor(wxCursor& cursor); //---------------------------------------------------------------------- @@ -123,6 +139,9 @@ wxWindow * wxFindWindowByName(const wxString& name, wxWindow *parent=NULL); void wxBeginBusyCursor(wxCursor *cursor = wxHOURGLASS_CURSOR); wxWindow * wxGetActiveWindow(); +wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt); +wxWindow* wxFindWindowAtPoint(const wxPoint& pt); +bool wxCheckForInterrupt(wxWindow *wnd); //--------------------------------------------------------------------------- // Resource System @@ -253,7 +272,7 @@ enum { //--------------------------------------------------------------------------- // wxToolTip -class wxToolTip { +class wxToolTip : public wxObject { public: wxToolTip(const wxString &tip); @@ -376,10 +395,31 @@ public: //---------------------------------------------------------------------- +bool wxSafeYield(wxWindow* win=NULL); void wxPostEvent(wxEvtHandler *dest, wxEvent& event); void wxWakeUpIdle(); -bool wxSafeYield(wxWindow* win=NULL); + +#ifdef __WXMSW__ +void wxWakeUpMainThread(); +#endif + +void wxMutexGuiEnter(); +void wxMutexGuiLeave(); + + +class wxMutexGuiLocker { +public: + wxMutexGuiLocker(); + ~wxMutexGuiLocker(); +}; + + +%inline %{ + bool wxThread_IsMain() { + return wxThread::IsMain(); + } +%} //---------------------------------------------------------------------- @@ -429,18 +469,17 @@ bool wxShowTip(wxWindow *parent, wxTipProvider *tipProvider, bool showAtStartup %{ #include -static wxPoint wxPyNullPoint; %} -%name (wxDragImage) class wxGenericDragImage +%name (wxDragImage) class wxGenericDragImage : public wxObject { public: wxGenericDragImage(const wxBitmap& image, - const wxCursor& cursor = wxNullCursor, - const wxPoint& hotspot = wxPyNullPoint); + const wxCursor& cursor = wxNullCursor); ~wxGenericDragImage(); + void SetBackingBitmap(wxBitmap* bitmap); bool BeginDrag(const wxPoint& hotspot, wxWindow* window, bool fullScreen = FALSE, wxRect* rect = NULL); @@ -460,12 +499,10 @@ public: // Alternate Constructors %new wxGenericDragImage* wxDragIcon(const wxIcon& image, - const wxCursor& cursor = wxNullCursor, - const wxPoint& hotspot = wxPyNullPoint); + const wxCursor& cursor = wxNullCursor); %new wxGenericDragImage* wxDragString(const wxString& str, - const wxCursor& cursor = wxNullCursor, - const wxPoint& hotspot = wxPyNullPoint); + const wxCursor& cursor = wxNullCursor); %new wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id); @@ -475,15 +512,13 @@ public: %{ wxGenericDragImage* wxDragIcon(const wxIcon& image, - const wxCursor& cursor, - const wxPoint& hotspot) { - return new wxGenericDragImage(image, cursor, hotspot); + const wxCursor& cursor) { + return new wxGenericDragImage(image, cursor); } wxGenericDragImage* wxDragString(const wxString& str, - const wxCursor& cursor, - const wxPoint& hotspot) { - return new wxGenericDragImage(str, cursor, hotspot); + const wxCursor& cursor) { + return new wxGenericDragImage(str, cursor); } wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) { @@ -500,7 +535,7 @@ wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id) { //---------------------------------------------------------------------- -class wxPyTimer { +class wxPyTimer : public wxObject { public: wxPyTimer(PyObject* notify); ~wxPyTimer(); @@ -625,6 +660,13 @@ void wxLogSysError(const char *szFormat); //---------------------------------------------------------------------- + +enum { + /* event type */ + wxEVT_END_PROCESS +}; + + class wxProcessEvent : public wxEvent { public: wxProcessEvent(int id = 0, int pid = 0, int exitcode = 0); @@ -682,8 +724,67 @@ long wxExecute(const wxString& command, //---------------------------------------------------------------------- -#ifdef __WXMSW__ -class wxJoystick { +%{ +#if !wxUSE_JOYSTICK && !defined(__WXMSW__) +// A C++ stub class for wxJoystick for platforms that don't have it. +class wxJoystick : public wxObject { +public: + wxJoystick(int joystick = wxJOYSTICK1) { + bool doSave = wxPyRestoreThread(); + PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform."); + wxPySaveThread(doSave); + } + wxPoint GetPosition() { return wxPoint(-1,-1); } + int GetZPosition() { return -1; } + int GetButtonState() { return -1; } + int GetPOVPosition() { return -1; } + int GetPOVCTSPosition() { return -1; } + int GetRudderPosition() { return -1; } + int GetUPosition() { return -1; } + int GetVPosition() { return -1; } + int GetMovementThreshold() { return -1; } + void SetMovementThreshold(int threshold) ; + + bool IsOk(void) { return FALSE; } + int GetNumberJoysticks() { return -1; } + int GetManufacturerId() { return -1; } + int GetProductId() { return -1; } + wxString GetProductName() { return ""; } + int GetXMin() { return -1; } + int GetYMin() { return -1; } + int GetZMin() { return -1; } + int GetXMax() { return -1; } + int GetYMax() { return -1; } + int GetZMax() { return -1; } + int GetNumberButtons() { return -1; } + int GetNumberAxes() { return -1; } + int GetMaxButtons() { return -1; } + int GetMaxAxes() { return -1; } + int GetPollingMin() { return -1; } + int GetPollingMax() { return -1; } + int GetRudderMin() { return -1; } + int GetRudderMax() { return -1; } + int GetUMin() { return -1; } + int GetUMax() { return -1; } + int GetVMin() { return -1; } + int GetVMax() { return -1; } + + bool HasRudder() { return FALSE; } + bool HasZ() { return FALSE; } + bool HasU() { return FALSE; } + bool HasV() { return FALSE; } + bool HasPOV() { return FALSE; } + bool HasPOV4Dir() { return FALSE; } + bool HasPOVCTS() { return FALSE; } + + bool SetCapture(wxWindow* win, int pollingFreq = 0) { return FALSE; } + bool ReleaseCapture() { return FALSE; } +}; +#endif +%} + + +class wxJoystick : public wxObject { public: wxJoystick(int joystick = wxJOYSTICK1); wxPoint GetPosition(); @@ -732,8 +833,60 @@ public: bool SetCapture(wxWindow* win, int pollingFreq = 0); bool ReleaseCapture(); }; + +//---------------------------------------------------------------------- + +%{ +#if !wxUSE_WAVE && !defined(__WXMSW__) +// A C++ stub class for wxWave for platforms that don't have it. +class wxWave : public wxObject +{ +public: + wxWave(const wxString& fileName, bool isResource = FALSE) { + bool doSave = wxPyRestoreThread(); + PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform."); + wxPySaveThread(doSave); + } + wxWave(int size, const wxByte* data) { + bool doSave = wxPyRestoreThread(); + PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform."); + wxPySaveThread(doSave); + } + + ~wxWave() {} + + bool IsOk() const { return FALSE; } + bool Play(bool async = TRUE, bool looped = FALSE) const { return FALSE; } +}; + #endif +%} + +class wxWave : public wxObject +{ +public: + wxWave(const wxString& fileName, bool isResource = FALSE); + ~wxWave(); + + bool IsOk() const; + bool Play(bool async = TRUE, bool looped = FALSE) const; +}; + +%new wxWave* wxWaveData(const wxString& data); +%{ // Implementations of some alternate "constructors" + wxWave* wxWaveData(const wxString& data) { + return new wxWave(data.Len(), (wxByte*)data.c_str()); + } +%} //---------------------------------------------------------------------- + + +%init %{ + wxPyPtrTypeMap_Add("wxFontEnumerator", "wxPyFontEnumerator"); + wxPyPtrTypeMap_Add("wxDragImage", "wxGenericDragImage"); + wxPyPtrTypeMap_Add("wxProcess", "wxPyProcess"); +%} + //----------------------------------------------------------------------