]>
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 | ||
7bf85405 RD |
36 | class wxEvent { |
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 RD |
162 | |
163 | long m_x, m_y; | |
164 | bool m_leftDown; | |
165 | bool m_middleDown; | |
166 | bool m_rightDown; | |
167 | bool m_controlDown; | |
168 | bool m_shiftDown; | |
169 | bool m_altDown; | |
170 | bool m_metaDown; | |
7bf85405 RD |
171 | }; |
172 | ||
173 | //--------------------------------------------------------------------------- | |
174 | ||
175 | class wxKeyEvent: public wxEvent { | |
176 | public: | |
1475671a RD |
177 | wxKeyEvent(int keyEventType); |
178 | ||
7bf85405 RD |
179 | bool ControlDown(); |
180 | bool MetaDown(); | |
181 | bool AltDown(); | |
182 | bool ShiftDown(); | |
183 | long KeyCode(); | |
e980740a | 184 | |
f6bcfd97 BP |
185 | long GetKeyCode(); |
186 | bool HasModifiers(); | |
187 | ||
1475671a RD |
188 | long GetX(); |
189 | long GetY(); | |
190 | wxPoint GetPosition(); | |
191 | %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT); | |
c368d904 RD |
192 | |
193 | long m_x, m_y; | |
194 | long m_keyCode; | |
195 | bool m_controlDown; | |
196 | bool m_shiftDown; | |
197 | bool m_altDown; | |
198 | bool m_metaDown; | |
199 | bool m_scanCode; | |
200 | ||
7bf85405 RD |
201 | }; |
202 | ||
2f90df85 RD |
203 | //--------------------------------------------------------------------------- |
204 | ||
eec92d76 | 205 | class wxNavigationKeyEvent : public wxEvent { |
1475671a RD |
206 | public: |
207 | wxNavigationKeyEvent(); | |
208 | ||
209 | bool GetDirection(); | |
210 | void SetDirection(bool bForward); | |
211 | bool IsWindowChange(); | |
212 | void SetWindowChange(bool bIs); | |
213 | wxWindow* GetCurrentFocus(); | |
214 | void SetCurrentFocus(wxWindow *win); | |
215 | }; | |
2f90df85 RD |
216 | |
217 | ||
7bf85405 RD |
218 | //--------------------------------------------------------------------------- |
219 | ||
220 | class wxMoveEvent: public wxEvent { | |
221 | public: | |
1475671a RD |
222 | wxMoveEvent(const wxPoint& pt, int id = 0); |
223 | ||
7bf85405 RD |
224 | wxPoint GetPosition(); |
225 | }; | |
226 | ||
227 | //--------------------------------------------------------------------------- | |
228 | ||
229 | class wxPaintEvent: public wxEvent { | |
230 | public: | |
1475671a | 231 | wxPaintEvent(int id = 0); |
7bf85405 RD |
232 | |
233 | }; | |
234 | ||
235 | //--------------------------------------------------------------------------- | |
236 | ||
237 | class wxEraseEvent: public wxEvent { | |
238 | public: | |
1475671a RD |
239 | wxEraseEvent(int id = 0, wxDC* dc = NULL); |
240 | ||
7bf85405 RD |
241 | wxDC *GetDC(); |
242 | }; | |
243 | ||
244 | //--------------------------------------------------------------------------- | |
245 | ||
246 | class wxFocusEvent: public wxEvent { | |
247 | public: | |
1475671a | 248 | wxFocusEvent(WXTYPE eventType = 0, int id = 0); |
7bf85405 RD |
249 | }; |
250 | ||
251 | //--------------------------------------------------------------------------- | |
252 | ||
253 | class wxActivateEvent: public wxEvent{ | |
254 | public: | |
1475671a | 255 | wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0); |
7bf85405 RD |
256 | bool GetActive(); |
257 | }; | |
258 | ||
259 | //--------------------------------------------------------------------------- | |
260 | ||
261 | class wxInitDialogEvent: public wxEvent { | |
262 | public: | |
1475671a | 263 | wxInitDialogEvent(int id = 0); |
7bf85405 RD |
264 | }; |
265 | ||
266 | //--------------------------------------------------------------------------- | |
267 | ||
268 | class wxMenuEvent: public wxEvent { | |
269 | public: | |
1475671a | 270 | wxMenuEvent(WXTYPE id = 0, int id = 0); |
7bf85405 RD |
271 | int GetMenuId(); |
272 | }; | |
273 | ||
274 | //--------------------------------------------------------------------------- | |
275 | ||
276 | class wxShowEvent: public wxEvent { | |
277 | public: | |
1475671a | 278 | wxShowEvent(int id = 0, int show = FALSE); |
7bf85405 RD |
279 | void SetShow(bool show); |
280 | bool GetShow(); | |
281 | }; | |
282 | ||
283 | //--------------------------------------------------------------------------- | |
284 | ||
285 | class wxIconizeEvent: public wxEvent { | |
286 | public: | |
1475671a | 287 | wxIconizeEvent(int id = 0); |
7bf85405 RD |
288 | }; |
289 | ||
290 | //--------------------------------------------------------------------------- | |
291 | ||
292 | class wxMaximizeEvent: public wxEvent { | |
293 | public: | |
1475671a | 294 | wxMaximizeEvent(int id = 0); |
7bf85405 RD |
295 | }; |
296 | ||
297 | //--------------------------------------------------------------------------- | |
298 | ||
299 | class wxJoystickEvent: public wxEvent { | |
300 | public: | |
1475671a RD |
301 | wxJoystickEvent(int type = wxEVT_NULL, |
302 | int state = 0, | |
303 | int joystick = wxJOYSTICK1, | |
304 | int change = 0); | |
7bf85405 RD |
305 | wxPoint GetPosition(); |
306 | int GetZPosition(); | |
307 | int GetButtonState(); | |
308 | int GetButtonChange(); | |
309 | int GetJoystick(); | |
310 | void SetJoystick(int stick); | |
311 | void SetButtonState(int state); | |
312 | void SetButtonChange(int change); | |
313 | void SetPosition(const wxPoint& pos); | |
314 | void SetZPosition(int zPos); | |
315 | bool IsButton(); | |
316 | bool IsMove(); | |
317 | bool IsZMove(); | |
318 | bool ButtonDown(int but = wxJOY_BUTTON_ANY); | |
319 | bool ButtonUp(int but = wxJOY_BUTTON_ANY); | |
320 | bool ButtonIsDown(int but = wxJOY_BUTTON_ANY); | |
321 | }; | |
322 | ||
323 | //--------------------------------------------------------------------------- | |
324 | ||
325 | class wxDropFilesEvent: public wxEvent { | |
326 | public: | |
327 | wxPoint GetPosition(); | |
328 | int GetNumberOfFiles(); | |
329 | ||
330 | %addmethods { | |
331 | PyObject* GetFiles() { | |
332 | int count = self->GetNumberOfFiles(); | |
333 | wxString* files = self->GetFiles(); | |
334 | PyObject* list = PyList_New(count); | |
335 | ||
336 | if (!list) { | |
337 | PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!"); | |
338 | return NULL; | |
339 | } | |
340 | ||
341 | for (int i=0; i<count; i++) { | |
342 | PyList_SetItem(list, i, PyString_FromString((const char*)files[i])); | |
343 | } | |
344 | return list; | |
345 | } | |
346 | } | |
347 | }; | |
348 | ||
349 | //--------------------------------------------------------------------------- | |
350 | ||
351 | class wxIdleEvent: public wxEvent { | |
352 | public: | |
1475671a | 353 | wxIdleEvent(); |
7bf85405 RD |
354 | void RequestMore(bool needMore = TRUE); |
355 | bool MoreRequested(); | |
356 | }; | |
357 | ||
358 | //--------------------------------------------------------------------------- | |
359 | ||
360 | class wxUpdateUIEvent: public wxEvent { | |
361 | public: | |
1475671a | 362 | wxUpdateUIEvent(wxWindowID commandId = 0); |
7bf85405 RD |
363 | bool GetChecked(); |
364 | bool GetEnabled(); | |
365 | wxString GetText(); | |
366 | bool GetSetText(); | |
367 | bool GetSetChecked(); | |
368 | bool GetSetEnabled(); | |
369 | ||
370 | void Check(bool check); | |
371 | void Enable(bool enable); | |
372 | void SetText(const wxString& text); | |
373 | }; | |
374 | ||
375 | //--------------------------------------------------------------------------- | |
376 | ||
377 | class wxSysColourChangedEvent: public wxEvent { | |
378 | public: | |
1475671a | 379 | wxSysColourChangedEvent(); |
7bf85405 RD |
380 | }; |
381 | ||
382 | //--------------------------------------------------------------------------- | |
383 | ||
2f90df85 RD |
384 | |
385 | class wxNotifyEvent : public wxCommandEvent { | |
cf694132 | 386 | public: |
1475671a | 387 | wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0); |
2f90df85 | 388 | bool IsAllowed(); |
185d7c3e | 389 | void Allow(); |
2f90df85 RD |
390 | void Veto(); |
391 | }; | |
392 | ||
393 | ||
394 | //--------------------------------------------------------------------------- | |
1475671a RD |
395 | |
396 | class wxPaletteChangedEvent : public wxEvent { | |
397 | public: | |
398 | wxPaletteChangedEvent(wxWindowID id = 0); | |
399 | ||
400 | void SetChangedWindow(wxWindow* win); | |
401 | wxWindow* GetChangedWindow(); | |
402 | ||
403 | }; | |
404 | ||
405 | //--------------------------------------------------------------------------- | |
406 | ||
407 | class wxQueryNewPaletteEvent : public wxEvent { | |
408 | public: | |
409 | wxQueryNewPaletteEvent(wxWindowID id = 0); | |
410 | ||
411 | void SetPaletteRealized(bool realized); | |
412 | bool GetPaletteRealized(); | |
413 | }; | |
414 | ||
415 | ||
416 | //--------------------------------------------------------------------------- | |
417 | ||
f6bcfd97 | 418 | class wxWindowCreateEvent : public wxCommandEvent { |
1475671a RD |
419 | public: |
420 | wxWindowCreateEvent(wxWindow *win = NULL); | |
421 | ||
422 | wxWindow *GetWindow(); | |
423 | }; | |
424 | ||
f6bcfd97 | 425 | class wxWindowDestroyEvent : public wxCommandEvent { |
1475671a RD |
426 | public: |
427 | wxWindowDestroyEvent(wxWindow *win = NULL); | |
428 | ||
429 | wxWindow *GetWindow(); | |
430 | }; | |
431 | ||
f6bcfd97 BP |
432 | //--------------------------------------------------------------------------- |
433 | ||
434 | class wxTimerEvent : public wxEvent | |
435 | { | |
436 | public: | |
437 | wxTimerEvent(int id = 0, int interval = 0); | |
438 | int GetInterval(); | |
439 | }; | |
440 | ||
1475671a RD |
441 | |
442 | //--------------------------------------------------------------------------- | |
443 | //--------------------------------------------------------------------------- | |
65dd82cb RD |
444 | // These classes can be derived from in Python and passed through the event |
445 | // system without loosing anything. They do this by keeping a reference to | |
446 | // themselves and some special case handling in wxPyCallback::EventThunker. | |
cf694132 | 447 | |
2f90df85 RD |
448 | class wxPyEvent : public wxEvent { |
449 | public: | |
65dd82cb | 450 | wxPyEvent(int id=0); |
2f90df85 RD |
451 | ~wxPyEvent(); |
452 | ||
65dd82cb RD |
453 | %pragma(python) addtomethod = "__init__:self.SetSelf(self)" |
454 | ||
455 | void SetSelf(PyObject* self); | |
456 | PyObject* GetSelf(); | |
2f90df85 RD |
457 | }; |
458 | ||
bb0054cd | 459 | |
2f90df85 | 460 | class wxPyCommandEvent : public wxCommandEvent { |
bb0054cd | 461 | public: |
65dd82cb RD |
462 | wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0); |
463 | ~wxPyCommandEvent(); | |
2f90df85 | 464 | |
65dd82cb | 465 | %pragma(python) addtomethod = "__init__:self.SetSelf(self)" |
2f90df85 | 466 | |
65dd82cb RD |
467 | void SetSelf(PyObject* self); |
468 | PyObject* GetSelf(); | |
2f90df85 RD |
469 | }; |
470 | ||
2f90df85 | 471 | |
bb0054cd | 472 | |
2f90df85 | 473 | |
bb0054cd RD |
474 | //--------------------------------------------------------------------------- |
475 | //--------------------------------------------------------------------------- | |
7bf85405 | 476 |