X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/dd9f7fea29e3f8bb61861f52984b7943512346ac..bc119dd5069b28778899b70ceb80bbe701e6c951:/wxPython/src/_joystick.i diff --git a/wxPython/src/_joystick.i b/wxPython/src/_joystick.i index 092bc34c16..88bb207276 100644 --- a/wxPython/src/_joystick.i +++ b/wxPython/src/_joystick.i @@ -48,9 +48,10 @@ enum class wxJoystick : public wxObject { public: wxJoystick(int joystick = wxJOYSTICK1) { - wxPyBeginBlockThreads(); - PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform."); - wxPyEndBlockThreads(); + wxPyBlock_t blocked = wxPyBeginBlockThreads(); + PyErr_SetString(PyExc_NotImplementedError, + "wxJoystick is not available on this platform."); + wxPyEndBlockThreads(blocked); } wxPoint GetPosition() { return wxPoint(-1,-1); } int GetZPosition() { return -1; } @@ -63,11 +64,11 @@ public: int GetMovementThreshold() { return -1; } void SetMovementThreshold(int threshold) {} - bool IsOk(void) { return False; } + bool IsOk(void) { return false; } int GetNumberJoysticks() { return -1; } int GetManufacturerId() { return -1; } int GetProductId() { return -1; } - wxString GetProductName() { return ""; } + wxString GetProductName() { return wxEmptyString; } int GetXMin() { return -1; } int GetYMin() { return -1; } int GetZMin() { return -1; } @@ -87,21 +88,23 @@ public: 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 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; } + bool SetCapture(wxWindow* win, int pollingFreq = 0) { return false; } + bool ReleaseCapture() { return false; } }; #endif %} +MustHaveApp(wxJoystick); + class wxJoystick /* : public wxObject */ { public: @@ -155,6 +158,38 @@ public: bool ReleaseCapture(); %pythoncode { def __nonzero__(self): return self.IsOk() } + + %property(ButtonState, GetButtonState, doc="See `GetButtonState`"); + %property(ManufacturerId, GetManufacturerId, doc="See `GetManufacturerId`"); + %property(MaxAxes, GetMaxAxes, doc="See `GetMaxAxes`"); + %property(MaxButtons, GetMaxButtons, doc="See `GetMaxButtons`"); + %property(MovementThreshold, GetMovementThreshold, SetMovementThreshold, doc="See `GetMovementThreshold` and `SetMovementThreshold`"); + %property(NumberAxes, GetNumberAxes, doc="See `GetNumberAxes`"); + %property(NumberButtons, GetNumberButtons, doc="See `GetNumberButtons`"); + %property(NumberJoysticks, GetNumberJoysticks, doc="See `GetNumberJoysticks`"); + %property(POVCTSPosition, GetPOVCTSPosition, doc="See `GetPOVCTSPosition`"); + %property(POVPosition, GetPOVPosition, doc="See `GetPOVPosition`"); + %property(PollingMax, GetPollingMax, doc="See `GetPollingMax`"); + %property(PollingMin, GetPollingMin, doc="See `GetPollingMin`"); + %property(Position, GetPosition, doc="See `GetPosition`"); + %property(ProductId, GetProductId, doc="See `GetProductId`"); + %property(ProductName, GetProductName, doc="See `GetProductName`"); + %property(RudderMax, GetRudderMax, doc="See `GetRudderMax`"); + %property(RudderMin, GetRudderMin, doc="See `GetRudderMin`"); + %property(RudderPosition, GetRudderPosition, doc="See `GetRudderPosition`"); + %property(UMax, GetUMax, doc="See `GetUMax`"); + %property(UMin, GetUMin, doc="See `GetUMin`"); + %property(UPosition, GetUPosition, doc="See `GetUPosition`"); + %property(VMax, GetVMax, doc="See `GetVMax`"); + %property(VMin, GetVMin, doc="See `GetVMin`"); + %property(VPosition, GetVPosition, doc="See `GetVPosition`"); + %property(XMax, GetXMax, doc="See `GetXMax`"); + %property(XMin, GetXMin, doc="See `GetXMin`"); + %property(YMax, GetYMax, doc="See `GetYMax`"); + %property(YMin, GetYMin, doc="See `GetYMin`"); + %property(ZMax, GetZMax, doc="See `GetZMax`"); + %property(ZMin, GetZMin, doc="See `GetZMin`"); + %property(ZPosition, GetZPosition, doc="See `GetZPosition`"); }; @@ -169,12 +204,6 @@ public: class wxJoystickEvent : public wxEvent { public: - wxPoint m_pos; - int m_zPosition; - int m_buttonChange; // Which button changed? - int m_buttonState; // Which buttons are down? - int m_joyStick; // Which joystick? - wxJoystickEvent(wxEventType type = wxEVT_NULL, int state = 0, int joystick = wxJOYSTICK1, @@ -209,6 +238,20 @@ public: // Was the given button 1,2,3,4 or any in Down state? bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const; + + %pythoncode { + m_pos = property(GetPosition, SetPosition) + m_zPosition = property(GetZPosition, SetZPosition) + m_buttonChange = property(GetButtonChange, SetButtonChange) + m_buttonState = property(GetButtonState, SetButtonState) + m_joyStick = property(GetJoystick, SetJoystick) + } + + %property(ButtonChange, GetButtonChange, SetButtonChange, doc="See `GetButtonChange` and `SetButtonChange`"); + %property(ButtonState, GetButtonState, SetButtonState, doc="See `GetButtonState` and `SetButtonState`"); + %property(Joystick, GetJoystick, SetJoystick, doc="See `GetJoystick` and `SetJoystick`"); + %property(Position, GetPosition, SetPosition, doc="See `GetPosition` and `SetPosition`"); + %property(ZPosition, GetZPosition, SetZPosition, doc="See `GetZPosition` and `SetZPosition`"); };