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