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