]>
Commit | Line | Data |
---|---|---|
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 | ||
14 | %module events | |
15 | ||
16 | %{ | |
17 | #include "helpers.h" | |
18 | #include <wx/spinbutt.h> | |
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 | %import gdi.i | |
30 | ||
31 | //--------------------------------------------------------------------------- | |
32 | ||
33 | ||
34 | int wxNewEventType(); | |
35 | ||
36 | class wxEvent { | |
37 | public: | |
38 | wxEvent(int id = 0); | |
39 | ~wxEvent(); | |
40 | ||
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: | |
57 | wxSizeEvent(const wxSize& sz, int id = 0); | |
58 | wxSize GetSize(); | |
59 | }; | |
60 | ||
61 | //--------------------------------------------------------------------------- | |
62 | ||
63 | class wxCloseEvent : public wxEvent { | |
64 | public: | |
65 | wxCloseEvent(int commandEventType = 0, int id = 0); | |
66 | ||
67 | void SetLoggingOff(bool loggingOff); | |
68 | bool GetLoggingOff(); | |
69 | void Veto(bool veto = TRUE); | |
70 | bool CanVeto(); | |
71 | bool GetVeto(); | |
72 | void SetCanVeto(bool canVeto); | |
73 | }; | |
74 | ||
75 | //--------------------------------------------------------------------------- | |
76 | ||
77 | class wxCommandEvent : public wxEvent { | |
78 | public: | |
79 | wxCommandEvent(int commandEventType = 0, int id = 0); | |
80 | ||
81 | bool IsChecked(); | |
82 | %name(Checked)bool IsChecked(); | |
83 | long GetExtraLong(); | |
84 | int GetInt(); | |
85 | int GetSelection(); | |
86 | wxString GetString(); | |
87 | bool IsSelection(); | |
88 | void SetString(const wxString& s); | |
89 | void SetExtraLong(long extraLong); | |
90 | void SetInt(int i); | |
91 | ||
92 | }; | |
93 | ||
94 | ||
95 | //--------------------------------------------------------------------------- | |
96 | ||
97 | class wxScrollEvent: public wxCommandEvent { | |
98 | public: | |
99 | wxScrollEvent(int commandType = 0, int id = 0, int pos = 0, | |
100 | int orientation = 0); | |
101 | ||
102 | int GetOrientation(); | |
103 | int GetPosition(); | |
104 | }; | |
105 | ||
106 | //--------------------------------------------------------------------------- | |
107 | ||
108 | class wxScrollWinEvent: public wxEvent { | |
109 | public: | |
110 | wxScrollWinEvent(int commandType = 0, int pos = 0, | |
111 | int orientation = 0); | |
112 | ||
113 | int GetOrientation(); | |
114 | int GetPosition(); | |
115 | }; | |
116 | ||
117 | //--------------------------------------------------------------------------- | |
118 | ||
119 | class wxSpinEvent : public wxScrollEvent { | |
120 | public: | |
121 | wxSpinEvent(int commandType = 0, int id = 0); | |
122 | ||
123 | }; | |
124 | ||
125 | //--------------------------------------------------------------------------- | |
126 | ||
127 | class wxMouseEvent: public wxEvent { | |
128 | public: | |
129 | wxMouseEvent(int mouseEventType = 0); | |
130 | ||
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(); | |
157 | wxPoint GetPosition(); | |
158 | %name(GetPositionTuple)void GetPosition(long *OUTPUT, long *OUTPUT); | |
159 | wxPoint GetLogicalPosition(const wxDC& dc); | |
160 | long GetX(); | |
161 | long GetY(); | |
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; | |
171 | }; | |
172 | ||
173 | //--------------------------------------------------------------------------- | |
174 | ||
175 | class wxKeyEvent: public wxEvent { | |
176 | public: | |
177 | wxKeyEvent(int keyEventType); | |
178 | ||
179 | bool ControlDown(); | |
180 | bool MetaDown(); | |
181 | bool AltDown(); | |
182 | bool ShiftDown(); | |
183 | long KeyCode(); | |
184 | ||
185 | long GetKeyCode(); | |
186 | bool HasModifiers(); | |
187 | ||
188 | long GetX(); | |
189 | long GetY(); | |
190 | wxPoint GetPosition(); | |
191 | %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT); | |
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 | ||
201 | }; | |
202 | ||
203 | //--------------------------------------------------------------------------- | |
204 | ||
205 | class wxNavigationKeyEvent : public wxEvent { | |
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 | }; | |
216 | ||
217 | ||
218 | //--------------------------------------------------------------------------- | |
219 | ||
220 | class wxMoveEvent: public wxEvent { | |
221 | public: | |
222 | wxMoveEvent(const wxPoint& pt, int id = 0); | |
223 | ||
224 | wxPoint GetPosition(); | |
225 | }; | |
226 | ||
227 | //--------------------------------------------------------------------------- | |
228 | ||
229 | class wxPaintEvent: public wxEvent { | |
230 | public: | |
231 | wxPaintEvent(int id = 0); | |
232 | ||
233 | }; | |
234 | ||
235 | //--------------------------------------------------------------------------- | |
236 | ||
237 | class wxEraseEvent: public wxEvent { | |
238 | public: | |
239 | wxEraseEvent(int id = 0, wxDC* dc = NULL); | |
240 | ||
241 | wxDC *GetDC(); | |
242 | }; | |
243 | ||
244 | //--------------------------------------------------------------------------- | |
245 | ||
246 | class wxFocusEvent: public wxEvent { | |
247 | public: | |
248 | wxFocusEvent(WXTYPE eventType = 0, int id = 0); | |
249 | }; | |
250 | ||
251 | //--------------------------------------------------------------------------- | |
252 | ||
253 | class wxActivateEvent: public wxEvent{ | |
254 | public: | |
255 | wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0); | |
256 | bool GetActive(); | |
257 | }; | |
258 | ||
259 | //--------------------------------------------------------------------------- | |
260 | ||
261 | class wxInitDialogEvent: public wxEvent { | |
262 | public: | |
263 | wxInitDialogEvent(int id = 0); | |
264 | }; | |
265 | ||
266 | //--------------------------------------------------------------------------- | |
267 | ||
268 | class wxMenuEvent: public wxEvent { | |
269 | public: | |
270 | wxMenuEvent(WXTYPE id = 0, int id = 0); | |
271 | int GetMenuId(); | |
272 | }; | |
273 | ||
274 | //--------------------------------------------------------------------------- | |
275 | ||
276 | class wxShowEvent: public wxEvent { | |
277 | public: | |
278 | wxShowEvent(int id = 0, int show = FALSE); | |
279 | void SetShow(bool show); | |
280 | bool GetShow(); | |
281 | }; | |
282 | ||
283 | //--------------------------------------------------------------------------- | |
284 | ||
285 | class wxIconizeEvent: public wxEvent { | |
286 | public: | |
287 | wxIconizeEvent(int id = 0); | |
288 | }; | |
289 | ||
290 | //--------------------------------------------------------------------------- | |
291 | ||
292 | class wxMaximizeEvent: public wxEvent { | |
293 | public: | |
294 | wxMaximizeEvent(int id = 0); | |
295 | }; | |
296 | ||
297 | //--------------------------------------------------------------------------- | |
298 | ||
299 | class wxJoystickEvent: public wxEvent { | |
300 | public: | |
301 | wxJoystickEvent(int type = wxEVT_NULL, | |
302 | int state = 0, | |
303 | int joystick = wxJOYSTICK1, | |
304 | int change = 0); | |
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: | |
353 | wxIdleEvent(); | |
354 | void RequestMore(bool needMore = TRUE); | |
355 | bool MoreRequested(); | |
356 | }; | |
357 | ||
358 | //--------------------------------------------------------------------------- | |
359 | ||
360 | class wxUpdateUIEvent: public wxEvent { | |
361 | public: | |
362 | wxUpdateUIEvent(wxWindowID commandId = 0); | |
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: | |
379 | wxSysColourChangedEvent(); | |
380 | }; | |
381 | ||
382 | //--------------------------------------------------------------------------- | |
383 | ||
384 | ||
385 | class wxNotifyEvent : public wxCommandEvent { | |
386 | public: | |
387 | wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0); | |
388 | bool IsAllowed(); | |
389 | void Allow(); | |
390 | void Veto(); | |
391 | }; | |
392 | ||
393 | ||
394 | //--------------------------------------------------------------------------- | |
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 | ||
418 | class wxWindowCreateEvent : public wxCommandEvent { | |
419 | public: | |
420 | wxWindowCreateEvent(wxWindow *win = NULL); | |
421 | ||
422 | wxWindow *GetWindow(); | |
423 | }; | |
424 | ||
425 | class wxWindowDestroyEvent : public wxCommandEvent { | |
426 | public: | |
427 | wxWindowDestroyEvent(wxWindow *win = NULL); | |
428 | ||
429 | wxWindow *GetWindow(); | |
430 | }; | |
431 | ||
432 | //--------------------------------------------------------------------------- | |
433 | ||
434 | class wxTimerEvent : public wxEvent | |
435 | { | |
436 | public: | |
437 | wxTimerEvent(int id = 0, int interval = 0); | |
438 | int GetInterval(); | |
439 | }; | |
440 | ||
441 | ||
442 | //--------------------------------------------------------------------------- | |
443 | //--------------------------------------------------------------------------- | |
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. | |
447 | ||
448 | class wxPyEvent : public wxEvent { | |
449 | public: | |
450 | wxPyEvent(int id=0); | |
451 | ~wxPyEvent(); | |
452 | ||
453 | %pragma(python) addtomethod = "__init__:self.SetSelf(self)" | |
454 | ||
455 | void SetSelf(PyObject* self); | |
456 | PyObject* GetSelf(); | |
457 | }; | |
458 | ||
459 | ||
460 | class wxPyCommandEvent : public wxCommandEvent { | |
461 | public: | |
462 | wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0); | |
463 | ~wxPyCommandEvent(); | |
464 | ||
465 | %pragma(python) addtomethod = "__init__:self.SetSelf(self)" | |
466 | ||
467 | void SetSelf(PyObject* self); | |
468 | PyObject* GetSelf(); | |
469 | }; | |
470 | ||
471 | ||
472 | ||
473 | ||
474 | //--------------------------------------------------------------------------- | |
475 | //--------------------------------------------------------------------------- | |
476 |