1 ///////////////////////////////////////////////////////////////////////////// 2 // Name: wx/osx/joystick.h 3 // Purpose: wxJoystick class 4 // Author: Stefan Csomor 5 // Modified by: 6 // Created: 1998-01-01 7 // Copyright: (c) Stefan Csomor 8 // Licence: wxWindows licence 9 ///////////////////////////////////////////////////////////////////////////// 10 11 #ifndef _WX_JOYSTICK_H_ 12 #define _WX_JOYSTICK_H_ 13 14 #include "wx/event.h" 15 16 class WXDLLIMPEXP_ADV wxJoystick: public wxObject 17 { DECLARE_DYNAMIC_CLASS(wxJoystick)18 DECLARE_DYNAMIC_CLASS(wxJoystick) 19 public: 20 /* 21 * Public interface 22 */ 23 24 wxJoystick(int joystick = wxJOYSTICK1) { m_joystick = joystick; } 25 26 // Attributes 27 //////////////////////////////////////////////////////////////////////////// 28 29 wxPoint GetPosition() const; 30 int GetPosition(unsigned axis) const; 31 bool GetButtonState(unsigned button) const; 32 int GetZPosition() const; 33 int GetButtonState() const; 34 int GetPOVPosition() const; 35 int GetPOVCTSPosition() const; 36 int GetRudderPosition() const; 37 int GetUPosition() const; 38 int GetVPosition() const; 39 int GetMovementThreshold() const; 40 void SetMovementThreshold(int threshold) ; 41 42 // Capabilities 43 //////////////////////////////////////////////////////////////////////////// 44 45 bool IsOk() const; // Checks that the joystick is functioning 46 static int GetNumberJoysticks() ; 47 int GetManufacturerId() const ; 48 int GetProductId() const ; 49 wxString GetProductName() const ; 50 int GetXMin() const; 51 int GetYMin() const; 52 int GetZMin() const; 53 int GetXMax() const; 54 int GetYMax() const; 55 int GetZMax() const; 56 int GetNumberButtons() const; 57 int GetNumberAxes() const; 58 int GetMaxButtons() const; 59 int GetMaxAxes() const; 60 int GetPollingMin() const; 61 int GetPollingMax() const; 62 int GetRudderMin() const; 63 int GetRudderMax() const; 64 int GetUMin() const; 65 int GetUMax() const; 66 int GetVMin() const; 67 int GetVMax() const; 68 69 bool HasRudder() const; 70 bool HasZ() const; 71 bool HasU() const; 72 bool HasV() const; 73 bool HasPOV() const; 74 bool HasPOV4Dir() const; 75 bool HasPOVCTS() const; 76 77 // Operations 78 //////////////////////////////////////////////////////////////////////////// 79 80 // pollingFreq = 0 means that movement events are sent when above the threshold. 81 // If pollingFreq > 0, events are received every this many milliseconds. 82 bool SetCapture(wxWindow* win, int pollingFreq = 0); 83 bool ReleaseCapture(); 84 85 protected: 86 int m_joystick; 87 }; 88 89 #endif 90 // _WX_JOYSTICK_H_ 91