]>
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: | |
1475671a RD |
34 | wxEvent(int id = 0); |
35 | ~wxEvent(); | |
36 | ||
7bf85405 RD |
37 | wxObject* GetEventObject(); |
38 | wxEventType GetEventType(); | |
39 | int GetId(); | |
40 | bool GetSkipped(); | |
41 | long GetTimestamp(); | |
42 | void SetEventObject(wxObject* object); | |
43 | void SetEventType(wxEventType typ); | |
44 | void SetId(int id); | |
45 | void SetTimestamp(long timeStamp); | |
46 | void Skip(bool skip = TRUE); | |
47 | }; | |
48 | ||
49 | //--------------------------------------------------------------------------- | |
50 | ||
51 | class wxSizeEvent : public wxEvent { | |
52 | public: | |
1475671a | 53 | wxSizeEvent(const wxSize& sz, int id = 0); |
7bf85405 RD |
54 | wxSize GetSize(); |
55 | }; | |
56 | ||
57 | //--------------------------------------------------------------------------- | |
58 | ||
59 | class wxCloseEvent : public wxEvent { | |
60 | public: | |
1475671a RD |
61 | wxCloseEvent(int commandEventType = 0, int id = 0); |
62 | ||
e980740a | 63 | void SetLoggingOff(bool loggingOff); |
7bf85405 RD |
64 | bool GetLoggingOff(); |
65 | void Veto(bool veto = TRUE); | |
e980740a | 66 | bool CanVeto(); |
7bf85405 | 67 | bool GetVeto(); |
b8b8dda7 | 68 | void SetCanVeto(bool canVeto); |
7bf85405 RD |
69 | }; |
70 | ||
71 | //--------------------------------------------------------------------------- | |
72 | ||
73 | class wxCommandEvent : public wxEvent { | |
74 | public: | |
1475671a RD |
75 | wxCommandEvent(int commandEventType = 0, int id = 0); |
76 | ||
7bf85405 RD |
77 | bool Checked(); |
78 | long GetExtraLong(); | |
79 | int GetInt(); | |
80 | int GetSelection(); | |
cf694132 | 81 | wxString GetString(); |
7bf85405 | 82 | bool IsSelection(); |
6999b0d8 RD |
83 | void SetString(const wxString& s); |
84 | void SetExtraLong(long extraLong); | |
85 | void SetInt(int i); | |
86 | ||
7bf85405 RD |
87 | }; |
88 | ||
89 | ||
90 | //--------------------------------------------------------------------------- | |
91 | ||
92 | class wxScrollEvent: public wxCommandEvent { | |
93 | public: | |
1475671a RD |
94 | wxScrollEvent(int commandType = 0, int id = 0, int pos = 0, |
95 | int orientation = 0); | |
96 | ||
7bf85405 RD |
97 | int GetOrientation(); |
98 | int GetPosition(); | |
99 | }; | |
100 | ||
101 | //--------------------------------------------------------------------------- | |
102 | ||
d426c97e RD |
103 | class wxScrollWinEvent: public wxEvent { |
104 | public: | |
1475671a RD |
105 | wxScrollWinEvent(int commandType = 0, int pos = 0, |
106 | int orientation = 0); | |
107 | ||
d426c97e RD |
108 | int GetOrientation(); |
109 | int GetPosition(); | |
110 | }; | |
111 | ||
112 | //--------------------------------------------------------------------------- | |
113 | ||
62bd0874 RD |
114 | class wxSpinEvent : public wxScrollEvent { |
115 | public: | |
1475671a | 116 | wxSpinEvent(int commandType = 0, int id = 0); |
62bd0874 RD |
117 | |
118 | }; | |
119 | ||
120 | //--------------------------------------------------------------------------- | |
121 | ||
7bf85405 RD |
122 | class wxMouseEvent: public wxEvent { |
123 | public: | |
1475671a RD |
124 | wxMouseEvent(int mouseEventType = 0); |
125 | ||
7bf85405 RD |
126 | bool IsButton(); |
127 | bool ButtonDown(int but = -1); | |
128 | bool ButtonDClick(int but = -1); | |
129 | bool ButtonUp(int but = -1); | |
130 | bool Button(int but); | |
131 | bool ButtonIsDown(int but); | |
132 | bool ControlDown(); | |
133 | bool MetaDown(); | |
134 | bool AltDown(); | |
135 | bool ShiftDown(); | |
136 | bool LeftDown(); | |
137 | bool MiddleDown(); | |
138 | bool RightDown(); | |
139 | bool LeftUp(); | |
140 | bool MiddleUp(); | |
141 | bool RightUp(); | |
142 | bool LeftDClick(); | |
143 | bool MiddleDClick(); | |
144 | bool RightDClick(); | |
145 | bool LeftIsDown(); | |
146 | bool MiddleIsDown(); | |
147 | bool RightIsDown(); | |
148 | bool Dragging(); | |
149 | bool Moving(); | |
150 | bool Entering(); | |
151 | bool Leaving(); | |
7bf85405 | 152 | wxPoint GetPosition(); |
b1462dfa | 153 | %name(GetPositionTuple)void GetPosition(long *OUTPUT, long *OUTPUT); |
7bf85405 RD |
154 | wxPoint GetLogicalPosition(const wxDC& dc); |
155 | long GetX(); | |
156 | long GetY(); | |
157 | }; | |
158 | ||
159 | //--------------------------------------------------------------------------- | |
160 | ||
161 | class wxKeyEvent: public wxEvent { | |
162 | public: | |
1475671a RD |
163 | wxKeyEvent(int keyEventType); |
164 | ||
7bf85405 RD |
165 | bool ControlDown(); |
166 | bool MetaDown(); | |
167 | bool AltDown(); | |
168 | bool ShiftDown(); | |
169 | long KeyCode(); | |
e980740a | 170 | |
1475671a RD |
171 | long GetX(); |
172 | long GetY(); | |
173 | wxPoint GetPosition(); | |
174 | %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT); | |
7bf85405 RD |
175 | }; |
176 | ||
2f90df85 RD |
177 | //--------------------------------------------------------------------------- |
178 | ||
eec92d76 | 179 | class wxNavigationKeyEvent : public wxEvent { |
1475671a RD |
180 | public: |
181 | wxNavigationKeyEvent(); | |
182 | ||
183 | bool GetDirection(); | |
184 | void SetDirection(bool bForward); | |
185 | bool IsWindowChange(); | |
186 | void SetWindowChange(bool bIs); | |
187 | wxWindow* GetCurrentFocus(); | |
188 | void SetCurrentFocus(wxWindow *win); | |
189 | }; | |
2f90df85 RD |
190 | |
191 | ||
7bf85405 RD |
192 | //--------------------------------------------------------------------------- |
193 | ||
194 | class wxMoveEvent: public wxEvent { | |
195 | public: | |
1475671a RD |
196 | wxMoveEvent(const wxPoint& pt, int id = 0); |
197 | ||
7bf85405 RD |
198 | wxPoint GetPosition(); |
199 | }; | |
200 | ||
201 | //--------------------------------------------------------------------------- | |
202 | ||
203 | class wxPaintEvent: public wxEvent { | |
204 | public: | |
1475671a | 205 | wxPaintEvent(int id = 0); |
7bf85405 RD |
206 | |
207 | }; | |
208 | ||
209 | //--------------------------------------------------------------------------- | |
210 | ||
211 | class wxEraseEvent: public wxEvent { | |
212 | public: | |
1475671a RD |
213 | wxEraseEvent(int id = 0, wxDC* dc = NULL); |
214 | ||
7bf85405 RD |
215 | wxDC *GetDC(); |
216 | }; | |
217 | ||
218 | //--------------------------------------------------------------------------- | |
219 | ||
220 | class wxFocusEvent: public wxEvent { | |
221 | public: | |
1475671a | 222 | wxFocusEvent(WXTYPE eventType = 0, int id = 0); |
7bf85405 RD |
223 | }; |
224 | ||
225 | //--------------------------------------------------------------------------- | |
226 | ||
227 | class wxActivateEvent: public wxEvent{ | |
228 | public: | |
1475671a | 229 | wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0); |
7bf85405 RD |
230 | bool GetActive(); |
231 | }; | |
232 | ||
233 | //--------------------------------------------------------------------------- | |
234 | ||
235 | class wxInitDialogEvent: public wxEvent { | |
236 | public: | |
1475671a | 237 | wxInitDialogEvent(int id = 0); |
7bf85405 RD |
238 | }; |
239 | ||
240 | //--------------------------------------------------------------------------- | |
241 | ||
242 | class wxMenuEvent: public wxEvent { | |
243 | public: | |
1475671a | 244 | wxMenuEvent(WXTYPE id = 0, int id = 0); |
7bf85405 RD |
245 | int GetMenuId(); |
246 | }; | |
247 | ||
248 | //--------------------------------------------------------------------------- | |
249 | ||
250 | class wxShowEvent: public wxEvent { | |
251 | public: | |
1475671a | 252 | wxShowEvent(int id = 0, int show = FALSE); |
7bf85405 RD |
253 | void SetShow(bool show); |
254 | bool GetShow(); | |
255 | }; | |
256 | ||
257 | //--------------------------------------------------------------------------- | |
258 | ||
259 | class wxIconizeEvent: public wxEvent { | |
260 | public: | |
1475671a | 261 | wxIconizeEvent(int id = 0); |
7bf85405 RD |
262 | }; |
263 | ||
264 | //--------------------------------------------------------------------------- | |
265 | ||
266 | class wxMaximizeEvent: public wxEvent { | |
267 | public: | |
1475671a | 268 | wxMaximizeEvent(int id = 0); |
7bf85405 RD |
269 | }; |
270 | ||
271 | //--------------------------------------------------------------------------- | |
272 | ||
273 | class wxJoystickEvent: public wxEvent { | |
274 | public: | |
1475671a RD |
275 | wxJoystickEvent(int type = wxEVT_NULL, |
276 | int state = 0, | |
277 | int joystick = wxJOYSTICK1, | |
278 | int change = 0); | |
7bf85405 RD |
279 | wxPoint GetPosition(); |
280 | int GetZPosition(); | |
281 | int GetButtonState(); | |
282 | int GetButtonChange(); | |
283 | int GetJoystick(); | |
284 | void SetJoystick(int stick); | |
285 | void SetButtonState(int state); | |
286 | void SetButtonChange(int change); | |
287 | void SetPosition(const wxPoint& pos); | |
288 | void SetZPosition(int zPos); | |
289 | bool IsButton(); | |
290 | bool IsMove(); | |
291 | bool IsZMove(); | |
292 | bool ButtonDown(int but = wxJOY_BUTTON_ANY); | |
293 | bool ButtonUp(int but = wxJOY_BUTTON_ANY); | |
294 | bool ButtonIsDown(int but = wxJOY_BUTTON_ANY); | |
295 | }; | |
296 | ||
297 | //--------------------------------------------------------------------------- | |
298 | ||
299 | class wxDropFilesEvent: public wxEvent { | |
300 | public: | |
301 | wxPoint GetPosition(); | |
302 | int GetNumberOfFiles(); | |
303 | ||
304 | %addmethods { | |
305 | PyObject* GetFiles() { | |
306 | int count = self->GetNumberOfFiles(); | |
307 | wxString* files = self->GetFiles(); | |
308 | PyObject* list = PyList_New(count); | |
309 | ||
310 | if (!list) { | |
311 | PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!"); | |
312 | return NULL; | |
313 | } | |
314 | ||
315 | for (int i=0; i<count; i++) { | |
316 | PyList_SetItem(list, i, PyString_FromString((const char*)files[i])); | |
317 | } | |
318 | return list; | |
319 | } | |
320 | } | |
321 | }; | |
322 | ||
323 | //--------------------------------------------------------------------------- | |
324 | ||
325 | class wxIdleEvent: public wxEvent { | |
326 | public: | |
1475671a | 327 | wxIdleEvent(); |
7bf85405 RD |
328 | void RequestMore(bool needMore = TRUE); |
329 | bool MoreRequested(); | |
330 | }; | |
331 | ||
332 | //--------------------------------------------------------------------------- | |
333 | ||
334 | class wxUpdateUIEvent: public wxEvent { | |
335 | public: | |
1475671a | 336 | wxUpdateUIEvent(wxWindowID commandId = 0); |
7bf85405 RD |
337 | bool GetChecked(); |
338 | bool GetEnabled(); | |
339 | wxString GetText(); | |
340 | bool GetSetText(); | |
341 | bool GetSetChecked(); | |
342 | bool GetSetEnabled(); | |
343 | ||
344 | void Check(bool check); | |
345 | void Enable(bool enable); | |
346 | void SetText(const wxString& text); | |
347 | }; | |
348 | ||
349 | //--------------------------------------------------------------------------- | |
350 | ||
351 | class wxSysColourChangedEvent: public wxEvent { | |
352 | public: | |
1475671a | 353 | wxSysColourChangedEvent(); |
7bf85405 RD |
354 | }; |
355 | ||
356 | //--------------------------------------------------------------------------- | |
357 | ||
2f90df85 RD |
358 | |
359 | class wxNotifyEvent : public wxCommandEvent { | |
cf694132 | 360 | public: |
1475671a | 361 | wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0); |
2f90df85 RD |
362 | bool IsAllowed(); |
363 | void Veto(); | |
364 | }; | |
365 | ||
366 | ||
367 | //--------------------------------------------------------------------------- | |
1475671a RD |
368 | |
369 | class wxPaletteChangedEvent : public wxEvent { | |
370 | public: | |
371 | wxPaletteChangedEvent(wxWindowID id = 0); | |
372 | ||
373 | void SetChangedWindow(wxWindow* win); | |
374 | wxWindow* GetChangedWindow(); | |
375 | ||
376 | }; | |
377 | ||
378 | //--------------------------------------------------------------------------- | |
379 | ||
380 | class wxQueryNewPaletteEvent : public wxEvent { | |
381 | public: | |
382 | wxQueryNewPaletteEvent(wxWindowID id = 0); | |
383 | ||
384 | void SetPaletteRealized(bool realized); | |
385 | bool GetPaletteRealized(); | |
386 | }; | |
387 | ||
388 | ||
389 | //--------------------------------------------------------------------------- | |
390 | ||
391 | class wxWindowCreateEvent : public wxEvent { | |
392 | public: | |
393 | wxWindowCreateEvent(wxWindow *win = NULL); | |
394 | ||
395 | wxWindow *GetWindow(); | |
396 | }; | |
397 | ||
398 | class wxWindowDestroyEvent : public wxEvent { | |
399 | public: | |
400 | wxWindowDestroyEvent(wxWindow *win = NULL); | |
401 | ||
402 | wxWindow *GetWindow(); | |
403 | }; | |
404 | ||
405 | ||
406 | //--------------------------------------------------------------------------- | |
407 | //--------------------------------------------------------------------------- | |
65dd82cb RD |
408 | // These classes can be derived from in Python and passed through the event |
409 | // system without loosing anything. They do this by keeping a reference to | |
410 | // themselves and some special case handling in wxPyCallback::EventThunker. | |
cf694132 | 411 | |
2f90df85 RD |
412 | class wxPyEvent : public wxEvent { |
413 | public: | |
65dd82cb | 414 | wxPyEvent(int id=0); |
2f90df85 RD |
415 | ~wxPyEvent(); |
416 | ||
65dd82cb RD |
417 | %pragma(python) addtomethod = "__init__:self.SetSelf(self)" |
418 | ||
419 | void SetSelf(PyObject* self); | |
420 | PyObject* GetSelf(); | |
2f90df85 RD |
421 | }; |
422 | ||
bb0054cd | 423 | |
2f90df85 | 424 | class wxPyCommandEvent : public wxCommandEvent { |
bb0054cd | 425 | public: |
65dd82cb RD |
426 | wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0); |
427 | ~wxPyCommandEvent(); | |
2f90df85 | 428 | |
65dd82cb | 429 | %pragma(python) addtomethod = "__init__:self.SetSelf(self)" |
2f90df85 | 430 | |
65dd82cb RD |
431 | void SetSelf(PyObject* self); |
432 | PyObject* GetSelf(); | |
2f90df85 RD |
433 | }; |
434 | ||
2f90df85 | 435 | |
bb0054cd | 436 | |
2f90df85 | 437 | |
bb0054cd RD |
438 | //--------------------------------------------------------------------------- |
439 | //--------------------------------------------------------------------------- | |
7bf85405 | 440 |