Commit | Line | Data |
---|---|---|
7bf85405 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: events.i | |
3 | // Purpose: SWIGgable Event classes for wxPython | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 5/24/98 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | ||
03e9bead RD |
14 | %module events |
15 | ||
16 | %{ | |
7bf85405 | 17 | #include "helpers.h" |
62bd0874 | 18 | #include <wx/spinbutt.h> |
7bf85405 RD |
19 | %} |
20 | ||
21 | //---------------------------------------------------------------------- | |
22 | ||
23 | %include typemaps.i | |
24 | %include my_typemaps.i | |
25 | ||
26 | // Import some definitions of other classes, etc. | |
27 | %import _defs.i | |
28 | %import misc.i | |
29 | ||
30 | //--------------------------------------------------------------------------- | |
31 | ||
32 | class wxEvent { | |
33 | public: | |
34 | wxObject* GetEventObject(); | |
35 | wxEventType GetEventType(); | |
36 | int GetId(); | |
37 | bool GetSkipped(); | |
38 | long GetTimestamp(); | |
39 | void SetEventObject(wxObject* object); | |
40 | void SetEventType(wxEventType typ); | |
41 | void SetId(int id); | |
42 | void SetTimestamp(long timeStamp); | |
43 | void Skip(bool skip = TRUE); | |
44 | }; | |
45 | ||
46 | //--------------------------------------------------------------------------- | |
47 | ||
48 | class wxSizeEvent : public wxEvent { | |
49 | public: | |
50 | wxSize GetSize(); | |
51 | }; | |
52 | ||
53 | //--------------------------------------------------------------------------- | |
54 | ||
55 | class wxCloseEvent : public wxEvent { | |
56 | public: | |
e980740a | 57 | void SetLoggingOff(bool loggingOff); |
7bf85405 RD |
58 | bool GetLoggingOff(); |
59 | void Veto(bool veto = TRUE); | |
e980740a | 60 | bool CanVeto(); |
7bf85405 | 61 | bool GetVeto(); |
b8b8dda7 | 62 | void SetCanVeto(bool canVeto); |
7bf85405 RD |
63 | }; |
64 | ||
65 | //--------------------------------------------------------------------------- | |
66 | ||
67 | class wxCommandEvent : public wxEvent { | |
68 | public: | |
69 | bool Checked(); | |
70 | long GetExtraLong(); | |
71 | int GetInt(); | |
72 | int GetSelection(); | |
cf694132 | 73 | wxString GetString(); |
7bf85405 | 74 | bool IsSelection(); |
7bf85405 RD |
75 | }; |
76 | ||
77 | ||
78 | //--------------------------------------------------------------------------- | |
79 | ||
80 | class wxScrollEvent: public wxCommandEvent { | |
81 | public: | |
82 | int GetOrientation(); | |
83 | int GetPosition(); | |
84 | }; | |
85 | ||
86 | //--------------------------------------------------------------------------- | |
87 | ||
d426c97e RD |
88 | class wxScrollWinEvent: public wxEvent { |
89 | public: | |
90 | int GetOrientation(); | |
91 | int GetPosition(); | |
92 | }; | |
93 | ||
94 | //--------------------------------------------------------------------------- | |
95 | ||
62bd0874 RD |
96 | class wxSpinEvent : public wxScrollEvent { |
97 | public: | |
98 | ||
99 | }; | |
100 | ||
101 | //--------------------------------------------------------------------------- | |
102 | ||
7bf85405 RD |
103 | class wxMouseEvent: public wxEvent { |
104 | public: | |
105 | bool IsButton(); | |
106 | bool ButtonDown(int but = -1); | |
107 | bool ButtonDClick(int but = -1); | |
108 | bool ButtonUp(int but = -1); | |
109 | bool Button(int but); | |
110 | bool ButtonIsDown(int but); | |
111 | bool ControlDown(); | |
112 | bool MetaDown(); | |
113 | bool AltDown(); | |
114 | bool ShiftDown(); | |
115 | bool LeftDown(); | |
116 | bool MiddleDown(); | |
117 | bool RightDown(); | |
118 | bool LeftUp(); | |
119 | bool MiddleUp(); | |
120 | bool RightUp(); | |
121 | bool LeftDClick(); | |
122 | bool MiddleDClick(); | |
123 | bool RightDClick(); | |
124 | bool LeftIsDown(); | |
125 | bool MiddleIsDown(); | |
126 | bool RightIsDown(); | |
127 | bool Dragging(); | |
128 | bool Moving(); | |
129 | bool Entering(); | |
130 | bool Leaving(); | |
131 | void Position(long *OUTPUT, long *OUTPUT); | |
132 | wxPoint GetPosition(); | |
133 | wxPoint GetLogicalPosition(const wxDC& dc); | |
134 | long GetX(); | |
135 | long GetY(); | |
136 | }; | |
137 | ||
138 | //--------------------------------------------------------------------------- | |
139 | ||
140 | class wxKeyEvent: public wxEvent { | |
141 | public: | |
142 | bool ControlDown(); | |
143 | bool MetaDown(); | |
144 | bool AltDown(); | |
145 | bool ShiftDown(); | |
146 | long KeyCode(); | |
e980740a | 147 | |
7bf85405 RD |
148 | }; |
149 | ||
150 | //--------------------------------------------------------------------------- | |
151 | ||
152 | class wxMoveEvent: public wxEvent { | |
153 | public: | |
154 | wxPoint GetPosition(); | |
155 | }; | |
156 | ||
157 | //--------------------------------------------------------------------------- | |
158 | ||
159 | class wxPaintEvent: public wxEvent { | |
160 | public: | |
161 | ||
162 | }; | |
163 | ||
164 | //--------------------------------------------------------------------------- | |
165 | ||
166 | class wxEraseEvent: public wxEvent { | |
167 | public: | |
168 | wxDC *GetDC(); | |
169 | }; | |
170 | ||
171 | //--------------------------------------------------------------------------- | |
172 | ||
173 | class wxFocusEvent: public wxEvent { | |
174 | public: | |
175 | ||
176 | }; | |
177 | ||
178 | //--------------------------------------------------------------------------- | |
179 | ||
180 | class wxActivateEvent: public wxEvent{ | |
181 | public: | |
182 | bool GetActive(); | |
183 | }; | |
184 | ||
185 | //--------------------------------------------------------------------------- | |
186 | ||
187 | class wxInitDialogEvent: public wxEvent { | |
188 | public: | |
189 | ||
190 | }; | |
191 | ||
192 | //--------------------------------------------------------------------------- | |
193 | ||
194 | class wxMenuEvent: public wxEvent { | |
195 | public: | |
196 | int GetMenuId(); | |
197 | }; | |
198 | ||
199 | //--------------------------------------------------------------------------- | |
200 | ||
201 | class wxShowEvent: public wxEvent { | |
202 | public: | |
203 | void SetShow(bool show); | |
204 | bool GetShow(); | |
205 | }; | |
206 | ||
207 | //--------------------------------------------------------------------------- | |
208 | ||
209 | class wxIconizeEvent: public wxEvent { | |
210 | public: | |
211 | }; | |
212 | ||
213 | //--------------------------------------------------------------------------- | |
214 | ||
215 | class wxMaximizeEvent: public wxEvent { | |
216 | public: | |
217 | ||
218 | }; | |
219 | ||
220 | //--------------------------------------------------------------------------- | |
221 | ||
222 | class wxJoystickEvent: public wxEvent { | |
223 | public: | |
224 | wxPoint GetPosition(); | |
225 | int GetZPosition(); | |
226 | int GetButtonState(); | |
227 | int GetButtonChange(); | |
228 | int GetJoystick(); | |
229 | void SetJoystick(int stick); | |
230 | void SetButtonState(int state); | |
231 | void SetButtonChange(int change); | |
232 | void SetPosition(const wxPoint& pos); | |
233 | void SetZPosition(int zPos); | |
234 | bool IsButton(); | |
235 | bool IsMove(); | |
236 | bool IsZMove(); | |
237 | bool ButtonDown(int but = wxJOY_BUTTON_ANY); | |
238 | bool ButtonUp(int but = wxJOY_BUTTON_ANY); | |
239 | bool ButtonIsDown(int but = wxJOY_BUTTON_ANY); | |
240 | }; | |
241 | ||
242 | //--------------------------------------------------------------------------- | |
243 | ||
244 | class wxDropFilesEvent: public wxEvent { | |
245 | public: | |
246 | wxPoint GetPosition(); | |
247 | int GetNumberOfFiles(); | |
248 | ||
249 | %addmethods { | |
250 | PyObject* GetFiles() { | |
251 | int count = self->GetNumberOfFiles(); | |
252 | wxString* files = self->GetFiles(); | |
253 | PyObject* list = PyList_New(count); | |
254 | ||
255 | if (!list) { | |
256 | PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!"); | |
257 | return NULL; | |
258 | } | |
259 | ||
260 | for (int i=0; i<count; i++) { | |
261 | PyList_SetItem(list, i, PyString_FromString((const char*)files[i])); | |
262 | } | |
263 | return list; | |
264 | } | |
265 | } | |
266 | }; | |
267 | ||
268 | //--------------------------------------------------------------------------- | |
269 | ||
270 | class wxIdleEvent: public wxEvent { | |
271 | public: | |
272 | void RequestMore(bool needMore = TRUE); | |
273 | bool MoreRequested(); | |
274 | }; | |
275 | ||
276 | //--------------------------------------------------------------------------- | |
277 | ||
278 | class wxUpdateUIEvent: public wxEvent { | |
279 | public: | |
280 | bool GetChecked(); | |
281 | bool GetEnabled(); | |
282 | wxString GetText(); | |
283 | bool GetSetText(); | |
284 | bool GetSetChecked(); | |
285 | bool GetSetEnabled(); | |
286 | ||
287 | void Check(bool check); | |
288 | void Enable(bool enable); | |
289 | void SetText(const wxString& text); | |
290 | }; | |
291 | ||
292 | //--------------------------------------------------------------------------- | |
293 | ||
294 | class wxSysColourChangedEvent: public wxEvent { | |
295 | public: | |
296 | ||
297 | }; | |
298 | ||
299 | //--------------------------------------------------------------------------- | |
300 | ||
cf694132 RD |
301 | class wxPyEvent : public wxCommandEvent { |
302 | public: | |
303 | wxPyEvent(wxEventType commandType = wxEVT_NULL, PyObject* userData = Py_None); | |
304 | ~wxPyEvent(); | |
305 | ||
306 | void SetUserData(PyObject* userData); | |
307 | PyObject* GetUserData(); | |
308 | }; | |
309 | ||
7bf85405 | 310 | |
cf694132 RD |
311 | |
312 | //--------------------------------------------------------------------------- | |
bb0054cd RD |
313 | |
314 | class wxNotifyEvent : public wxCommandEvent { | |
315 | public: | |
316 | bool IsAllowed(); | |
317 | void Veto(); | |
318 | }; | |
319 | ||
320 | //--------------------------------------------------------------------------- | |
321 | //--------------------------------------------------------------------------- | |
7bf85405 | 322 |