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