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