]> git.saurik.com Git - wxWidgets.git/blob - utils/wxPython/src/events.i
Some minor updates, fixes, etc.
[wxWidgets.git] / utils / wxPython / src / events.i
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
30 //---------------------------------------------------------------------------
31
32 class wxEvent {
33 public:
34 wxEvent(int id = 0);
35 ~wxEvent();
36
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:
53 wxSizeEvent(const wxSize& sz, int id = 0);
54 wxSize GetSize();
55 };
56
57 //---------------------------------------------------------------------------
58
59 class wxCloseEvent : public wxEvent {
60 public:
61 wxCloseEvent(int commandEventType = 0, int id = 0);
62
63 void SetLoggingOff(bool loggingOff);
64 bool GetLoggingOff();
65 void Veto(bool veto = TRUE);
66 bool CanVeto();
67 bool GetVeto();
68 void SetCanVeto(bool canVeto);
69 };
70
71 //---------------------------------------------------------------------------
72
73 class wxCommandEvent : public wxEvent {
74 public:
75 wxCommandEvent(int commandEventType = 0, int id = 0);
76
77 bool Checked();
78 long GetExtraLong();
79 int GetInt();
80 int GetSelection();
81 wxString GetString();
82 bool IsSelection();
83 void SetString(const wxString& s);
84 void SetExtraLong(long extraLong);
85 void SetInt(int i);
86
87 };
88
89
90 //---------------------------------------------------------------------------
91
92 class wxScrollEvent: public wxCommandEvent {
93 public:
94 wxScrollEvent(int commandType = 0, int id = 0, int pos = 0,
95 int orientation = 0);
96
97 int GetOrientation();
98 int GetPosition();
99 };
100
101 //---------------------------------------------------------------------------
102
103 class wxScrollWinEvent: public wxEvent {
104 public:
105 wxScrollWinEvent(int commandType = 0, int pos = 0,
106 int orientation = 0);
107
108 int GetOrientation();
109 int GetPosition();
110 };
111
112 //---------------------------------------------------------------------------
113
114 class wxSpinEvent : public wxScrollEvent {
115 public:
116 wxSpinEvent(int commandType = 0, int id = 0);
117
118 };
119
120 //---------------------------------------------------------------------------
121
122 class wxMouseEvent: public wxEvent {
123 public:
124 wxMouseEvent(int mouseEventType = 0);
125
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();
152 wxPoint GetPosition();
153 %name(GetPositionTuple)void GetPosition(long *OUTPUT, long *OUTPUT);
154 wxPoint GetLogicalPosition(const wxDC& dc);
155 long GetX();
156 long GetY();
157 };
158
159 //---------------------------------------------------------------------------
160
161 class wxKeyEvent: public wxEvent {
162 public:
163 wxKeyEvent(int keyEventType);
164
165 bool ControlDown();
166 bool MetaDown();
167 bool AltDown();
168 bool ShiftDown();
169 long KeyCode();
170
171 long GetX();
172 long GetY();
173 wxPoint GetPosition();
174 %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
175 };
176
177 //---------------------------------------------------------------------------
178
179 class wxNavigationKeyEvent : public wxEvent {
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 };
190
191
192 //---------------------------------------------------------------------------
193
194 class wxMoveEvent: public wxEvent {
195 public:
196 wxMoveEvent(const wxPoint& pt, int id = 0);
197
198 wxPoint GetPosition();
199 };
200
201 //---------------------------------------------------------------------------
202
203 class wxPaintEvent: public wxEvent {
204 public:
205 wxPaintEvent(int id = 0);
206
207 };
208
209 //---------------------------------------------------------------------------
210
211 class wxEraseEvent: public wxEvent {
212 public:
213 wxEraseEvent(int id = 0, wxDC* dc = NULL);
214
215 wxDC *GetDC();
216 };
217
218 //---------------------------------------------------------------------------
219
220 class wxFocusEvent: public wxEvent {
221 public:
222 wxFocusEvent(WXTYPE eventType = 0, int id = 0);
223 };
224
225 //---------------------------------------------------------------------------
226
227 class wxActivateEvent: public wxEvent{
228 public:
229 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
230 bool GetActive();
231 };
232
233 //---------------------------------------------------------------------------
234
235 class wxInitDialogEvent: public wxEvent {
236 public:
237 wxInitDialogEvent(int id = 0);
238 };
239
240 //---------------------------------------------------------------------------
241
242 class wxMenuEvent: public wxEvent {
243 public:
244 wxMenuEvent(WXTYPE id = 0, int id = 0);
245 int GetMenuId();
246 };
247
248 //---------------------------------------------------------------------------
249
250 class wxShowEvent: public wxEvent {
251 public:
252 wxShowEvent(int id = 0, int show = FALSE);
253 void SetShow(bool show);
254 bool GetShow();
255 };
256
257 //---------------------------------------------------------------------------
258
259 class wxIconizeEvent: public wxEvent {
260 public:
261 wxIconizeEvent(int id = 0);
262 };
263
264 //---------------------------------------------------------------------------
265
266 class wxMaximizeEvent: public wxEvent {
267 public:
268 wxMaximizeEvent(int id = 0);
269 };
270
271 //---------------------------------------------------------------------------
272
273 class wxJoystickEvent: public wxEvent {
274 public:
275 wxJoystickEvent(int type = wxEVT_NULL,
276 int state = 0,
277 int joystick = wxJOYSTICK1,
278 int change = 0);
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:
327 wxIdleEvent();
328 void RequestMore(bool needMore = TRUE);
329 bool MoreRequested();
330 };
331
332 //---------------------------------------------------------------------------
333
334 class wxUpdateUIEvent: public wxEvent {
335 public:
336 wxUpdateUIEvent(wxWindowID commandId = 0);
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:
353 wxSysColourChangedEvent();
354 };
355
356 //---------------------------------------------------------------------------
357
358
359 class wxNotifyEvent : public wxCommandEvent {
360 public:
361 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
362 bool IsAllowed();
363 void Veto();
364 };
365
366
367 //---------------------------------------------------------------------------
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 //---------------------------------------------------------------------------
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.
411
412 class wxPyEvent : public wxEvent {
413 public:
414 wxPyEvent(int id=0);
415 ~wxPyEvent();
416
417 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
418
419 void SetSelf(PyObject* self);
420 PyObject* GetSelf();
421 };
422
423
424 class wxPyCommandEvent : public wxCommandEvent {
425 public:
426 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
427 ~wxPyCommandEvent();
428
429 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
430
431 void SetSelf(PyObject* self);
432 PyObject* GetSelf();
433 };
434
435
436
437
438 //---------------------------------------------------------------------------
439 //---------------------------------------------------------------------------
440