]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_joystick.i
reSWIGged
[wxWidgets.git] / wxPython / src / _joystick.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: _joystick.i
3 // Purpose: SWIG interface stuff for wxJoystick
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 18-June-1999
8 // RCS-ID: $Id$
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 // Not a %module
14
15
16 //---------------------------------------------------------------------------
17 %newgroup
18
19 %{
20 #include <wx/joystick.h>
21 %}
22
23 //---------------------------------------------------------------------------
24
25
26
27 // Which joystick? Same as Windows ids so no conversion necessary.
28 enum
29 {
30 wxJOYSTICK1,
31 wxJOYSTICK2
32 };
33
34 // Which button is down?
35 enum
36 {
37 wxJOY_BUTTON_ANY,
38 wxJOY_BUTTON1,
39 wxJOY_BUTTON2,
40 wxJOY_BUTTON3,
41 wxJOY_BUTTON4,
42 };
43
44
45 %{
46 #if !wxUSE_JOYSTICK && !defined(__WXMSW__)
47 // A C++ stub class for wxJoystick for platforms that don't have it.
48 class wxJoystick : public wxObject {
49 public:
50 wxJoystick(int joystick = wxJOYSTICK1) {
51 wxPyBeginBlockThreads();
52 PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform.");
53 wxPyEndBlockThreads();
54 }
55 wxPoint GetPosition() { return wxPoint(-1,-1); }
56 int GetZPosition() { return -1; }
57 int GetButtonState() { return -1; }
58 int GetPOVPosition() { return -1; }
59 int GetPOVCTSPosition() { return -1; }
60 int GetRudderPosition() { return -1; }
61 int GetUPosition() { return -1; }
62 int GetVPosition() { return -1; }
63 int GetMovementThreshold() { return -1; }
64 void SetMovementThreshold(int threshold) {}
65
66 bool IsOk(void) { return False; }
67 int GetNumberJoysticks() { return -1; }
68 int GetManufacturerId() { return -1; }
69 int GetProductId() { return -1; }
70 wxString GetProductName() { return ""; }
71 int GetXMin() { return -1; }
72 int GetYMin() { return -1; }
73 int GetZMin() { return -1; }
74 int GetXMax() { return -1; }
75 int GetYMax() { return -1; }
76 int GetZMax() { return -1; }
77 int GetNumberButtons() { return -1; }
78 int GetNumberAxes() { return -1; }
79 int GetMaxButtons() { return -1; }
80 int GetMaxAxes() { return -1; }
81 int GetPollingMin() { return -1; }
82 int GetPollingMax() { return -1; }
83 int GetRudderMin() { return -1; }
84 int GetRudderMax() { return -1; }
85 int GetUMin() { return -1; }
86 int GetUMax() { return -1; }
87 int GetVMin() { return -1; }
88 int GetVMax() { return -1; }
89
90 bool HasRudder() { return False; }
91 bool HasZ() { return False; }
92 bool HasU() { return False; }
93 bool HasV() { return False; }
94 bool HasPOV() { return False; }
95 bool HasPOV4Dir() { return False; }
96 bool HasPOVCTS() { return False; }
97
98 bool SetCapture(wxWindow* win, int pollingFreq = 0) { return False; }
99 bool ReleaseCapture() { return False; }
100 };
101 #endif
102 %}
103
104
105 class wxJoystick /* : public wxObject */
106 {
107 public:
108 wxJoystick(int joystick = wxJOYSTICK1);
109 ~wxJoystick();
110
111 wxPoint GetPosition();
112 int GetZPosition();
113 int GetButtonState();
114 int GetPOVPosition();
115 int GetPOVCTSPosition();
116 int GetRudderPosition();
117 int GetUPosition();
118 int GetVPosition();
119 int GetMovementThreshold();
120 void SetMovementThreshold(int threshold) ;
121
122 bool IsOk(void);
123 int GetNumberJoysticks();
124 int GetManufacturerId();
125 int GetProductId();
126 wxString GetProductName();
127 int GetXMin();
128 int GetYMin();
129 int GetZMin();
130 int GetXMax();
131 int GetYMax();
132 int GetZMax();
133 int GetNumberButtons();
134 int GetNumberAxes();
135 int GetMaxButtons();
136 int GetMaxAxes();
137 int GetPollingMin();
138 int GetPollingMax();
139 int GetRudderMin();
140 int GetRudderMax();
141 int GetUMin();
142 int GetUMax();
143 int GetVMin();
144 int GetVMax();
145
146 bool HasRudder();
147 bool HasZ();
148 bool HasU();
149 bool HasV();
150 bool HasPOV();
151 bool HasPOV4Dir();
152 bool HasPOVCTS();
153
154 bool SetCapture(wxWindow* win, int pollingFreq = 0);
155 bool ReleaseCapture();
156
157 %pythoncode { def __nonzero__(self): return self.IsOk() }
158 };
159
160
161 //---------------------------------------------------------------------------
162
163 %constant wxEventType wxEVT_JOY_BUTTON_DOWN;
164 %constant wxEventType wxEVT_JOY_BUTTON_UP;
165 %constant wxEventType wxEVT_JOY_MOVE;
166 %constant wxEventType wxEVT_JOY_ZMOVE;
167
168
169 class wxJoystickEvent : public wxEvent
170 {
171 public:
172 wxPoint m_pos;
173 int m_zPosition;
174 int m_buttonChange; // Which button changed?
175 int m_buttonState; // Which buttons are down?
176 int m_joyStick; // Which joystick?
177
178 wxJoystickEvent(wxEventType type = wxEVT_NULL,
179 int state = 0,
180 int joystick = wxJOYSTICK1,
181 int change = 0);
182
183 wxPoint GetPosition() const;
184 int GetZPosition() const;
185 int GetButtonState() const;
186 int GetButtonChange() const;
187 int GetJoystick() const;
188
189 void SetJoystick(int stick);
190 void SetButtonState(int state);
191 void SetButtonChange(int change);
192 void SetPosition(const wxPoint& pos);
193 void SetZPosition(int zPos);
194
195 // Was it a button event? (*doesn't* mean: is any button *down*?)
196 bool IsButton() const;
197
198 // Was it a move event?
199 bool IsMove() const;
200
201 // Was it a zmove event?
202 bool IsZMove() const;
203
204 // Was it a down event from button 1, 2, 3, 4 or any?
205 bool ButtonDown(int but = wxJOY_BUTTON_ANY) const;
206
207 // Was it a up event from button 1, 2, 3 or any?
208 bool ButtonUp(int but = wxJOY_BUTTON_ANY) const;
209
210 // Was the given button 1,2,3,4 or any in Down state?
211 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY) const;
212 };
213
214
215 %pythoncode {
216 EVT_JOY_BUTTON_DOWN = wx.PyEventBinder( wxEVT_JOY_BUTTON_DOWN )
217 EVT_JOY_BUTTON_UP = wx.PyEventBinder( wxEVT_JOY_BUTTON_UP )
218 EVT_JOY_MOVE = wx.PyEventBinder( wxEVT_JOY_MOVE )
219 EVT_JOY_ZMOVE = wx.PyEventBinder( wxEVT_JOY_ZMOVE )
220
221 EVT_JOYSTICK_EVENTS = wx.PyEventBinder([ wxEVT_JOY_BUTTON_DOWN,
222 wxEVT_JOY_BUTTON_UP,
223 wxEVT_JOY_MOVE,
224 wxEVT_JOY_ZMOVE,
225 ])
226
227 }
228
229 //---------------------------------------------------------------------------