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