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