]> git.saurik.com Git - wxWidgets.git/blob - interface/joystick.h
store selected indices as unsigned int, not size_t, in wxSelectionStore, we don't...
[wxWidgets.git] / interface / joystick.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: joystick.h
3 // Purpose: interface of wxJoystick
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxJoystick
11 @wxheader{joystick.h}
12
13 wxJoystick allows an application to control one or more joysticks.
14
15 @library{wxadv}
16 @category{FIXME}
17
18 @see wxJoystickEvent
19 */
20 class wxJoystick : public wxObject
21 {
22 public:
23 /**
24 Constructor. @a joystick may be one of wxJOYSTICK1, wxJOYSTICK2, indicating the
25 joystick
26 controller of interest.
27 */
28 wxJoystick(int joystick = wxJOYSTICK1);
29
30 /**
31 Destroys the wxJoystick object.
32 */
33 ~wxJoystick();
34
35 //@{
36 /**
37 Returns the state of the specified joystick button.
38
39 @param id
40 The button id to report, from 0 to GetNumberButtons() - 1
41 */
42 int GetButtonState() const;
43 const bool GetButtonState(unsigned id) const;
44 //@}
45
46 /**
47 Returns the manufacturer id.
48 */
49 int GetManufacturerId() const;
50
51 /**
52 Returns the movement threshold, the number of steps outside which the joystick
53 is deemed to have
54 moved.
55 */
56 int GetMovementThreshold() const;
57
58 /**
59 Returns the number of axes for this joystick.
60 */
61 int GetNumberAxes() const;
62
63 /**
64 Returns the number of buttons for this joystick.
65 */
66 int GetNumberButtons() const;
67
68 /**
69 Returns the number of joysticks currently attached to the computer.
70 */
71 static int GetNumberJoysticks();
72
73 /**
74 Returns the point-of-view position, expressed in continuous, one-hundredth of a
75 degree units.
76 Returns -1 on error.
77 */
78 int GetPOVCTSPosition() const;
79
80 /**
81 Returns the point-of-view position, expressed in continuous, one-hundredth of a
82 degree units,
83 but limited to return 0, 9000, 18000 or 27000.
84 Returns -1 on error.
85 */
86 int GetPOVPosition() const;
87
88 /**
89 Returns the maximum polling frequency.
90 */
91 int GetPollingMax() const;
92
93 /**
94 Returns the minimum polling frequency.
95 */
96 int GetPollingMin() const;
97
98 //@{
99 /**
100 Returns the position of the specified joystick axis.
101
102 @param axis
103 The joystick axis to report, from 0 to GetNumberAxes() - 1.
104 */
105 wxPoint GetPosition() const;
106 const int GetPosition(unsigned axis) const;
107 //@}
108
109 /**
110 Returns the product id for the joystick.
111 */
112 int GetProductId() const;
113
114 /**
115 Returns the product name for the joystick.
116 */
117 wxString GetProductName() const;
118
119 /**
120 Returns the maximum rudder position.
121 */
122 int GetRudderMax() const;
123
124 /**
125 Returns the minimum rudder position.
126 */
127 int GetRudderMin() const;
128
129 /**
130 Returns the rudder position.
131 */
132 int GetRudderPosition() const;
133
134 /**
135 Returns the maximum U position.
136 */
137 int GetUMax() const;
138
139 /**
140 Returns the minimum U position.
141 */
142 int GetUMin() const;
143
144 /**
145 Gets the position of the fifth axis of the joystick, if it exists.
146 */
147 int GetUPosition() const;
148
149 /**
150 Returns the maximum V position.
151 */
152 int GetVMax() const;
153
154 /**
155 Returns the minimum V position.
156 */
157 int GetVMin() const;
158
159 /**
160 Gets the position of the sixth axis of the joystick, if it exists.
161 */
162 int GetVPosition() const;
163
164 /**
165 Returns the maximum x position.
166 */
167 int GetXMax() const;
168
169 /**
170 Returns the minimum x position.
171 */
172 int GetXMin() const;
173
174 /**
175 Returns the maximum y position.
176 */
177 int GetYMax() const;
178
179 /**
180 Returns the minimum y position.
181 */
182 int GetYMin() const;
183
184 /**
185 Returns the maximum z position.
186 */
187 int GetZMax() const;
188
189 /**
190 Returns the minimum z position.
191 */
192 int GetZMin() const;
193
194 /**
195 Returns the z position of the joystick.
196 */
197 int GetZPosition() const;
198
199 /**
200 Returns @true if the joystick has a point of view control.
201 */
202 bool HasPOV() const;
203
204 /**
205 Returns @true if the joystick point-of-view supports discrete values (centered,
206 forward, backward, left, and right).
207 */
208 bool HasPOV4Dir() const;
209
210 /**
211 Returns @true if the joystick point-of-view supports continuous degree bearings.
212 */
213 #define bool HasPOVCTS() const /* implementation is private */
214
215 /**
216 Returns @true if there is a rudder attached to the computer.
217 */
218 bool HasRudder() const;
219
220 /**
221 Returns @true if the joystick has a U axis.
222 */
223 bool HasU() const;
224
225 /**
226 Returns @true if the joystick has a V axis.
227 */
228 bool HasV() const;
229
230 /**
231 Returns @true if the joystick has a Z axis.
232 */
233 bool HasZ() const;
234
235 /**
236 Returns @true if the joystick is functioning.
237 */
238 bool IsOk() const;
239
240 /**
241 Releases the capture set by @b SetCapture.
242
243 @returns @true if the capture release succeeded.
244
245 @see SetCapture(), wxJoystickEvent
246 */
247 bool ReleaseCapture();
248
249 /**
250 Sets the capture to direct joystick events to @e win.
251
252 @param win
253 The window that will receive joystick events.
254 @param pollingFreq
255 If zero, movement events are sent when above the
256 threshold. If greater than zero, events are received every pollingFreq
257 milliseconds.
258
259 @returns @true if the capture succeeded.
260
261 @see ReleaseCapture(), wxJoystickEvent
262 */
263 bool SetCapture(wxWindow* win, int pollingFreq = 0);
264
265 /**
266 Sets the movement threshold, the number of steps outside which the joystick is
267 deemed to have
268 moved.
269 */
270 void SetMovementThreshold(int threshold);
271 };
272