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