]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/events.i
Removed unneeded assert
[wxWidgets.git] / wxPython / src / events.i
CommitLineData
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
34int wxNewEventType();
35
9416aa89 36class wxEvent : public wxObject {
7bf85405 37public:
ebf4302c 38 // wxEvent(int id = 0); // *** This class is now an ABC
1475671a
RD
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);
07b2e1cd
RD
51
52 wxEvent *Clone();
7bf85405
RD
53};
54
55//---------------------------------------------------------------------------
56
57class wxSizeEvent : public wxEvent {
58public:
1475671a 59 wxSizeEvent(const wxSize& sz, int id = 0);
7bf85405
RD
60 wxSize GetSize();
61};
62
63//---------------------------------------------------------------------------
64
65class wxCloseEvent : public wxEvent {
66public:
1475671a
RD
67 wxCloseEvent(int commandEventType = 0, int id = 0);
68
e980740a 69 void SetLoggingOff(bool loggingOff);
7bf85405
RD
70 bool GetLoggingOff();
71 void Veto(bool veto = TRUE);
e980740a 72 bool CanVeto();
7bf85405 73 bool GetVeto();
b8b8dda7 74 void SetCanVeto(bool canVeto);
7bf85405
RD
75};
76
77//---------------------------------------------------------------------------
78
79class wxCommandEvent : public wxEvent {
80public:
1475671a
RD
81 wxCommandEvent(int commandEventType = 0, int id = 0);
82
3ca6a5f0
BP
83 bool IsChecked();
84 %name(Checked)bool IsChecked();
7bf85405
RD
85 long GetExtraLong();
86 int GetInt();
87 int GetSelection();
cf694132 88 wxString GetString();
7bf85405 89 bool IsSelection();
6999b0d8
RD
90 void SetString(const wxString& s);
91 void SetExtraLong(long extraLong);
92 void SetInt(int i);
93
900d9886
RD
94 %addmethods {
95 PyObject* GetClientData() {
96 wxPyClientData* data = (wxPyClientData*)self->GetClientObject();
97 if (data) {
98 Py_INCREF(data->m_obj);
99 return data->m_obj;
100 } else {
101 Py_INCREF(Py_None);
102 return Py_None;
103 }
104 }
105 }
7bf85405
RD
106};
107
108
109//---------------------------------------------------------------------------
110
111class wxScrollEvent: public wxCommandEvent {
112public:
1475671a
RD
113 wxScrollEvent(int commandType = 0, int id = 0, int pos = 0,
114 int orientation = 0);
115
7bf85405
RD
116 int GetOrientation();
117 int GetPosition();
118};
119
120//---------------------------------------------------------------------------
121
d426c97e
RD
122class wxScrollWinEvent: public wxEvent {
123public:
1475671a
RD
124 wxScrollWinEvent(int commandType = 0, int pos = 0,
125 int orientation = 0);
126
d426c97e
RD
127 int GetOrientation();
128 int GetPosition();
129};
130
131//---------------------------------------------------------------------------
132
62bd0874
RD
133class wxSpinEvent : public wxScrollEvent {
134public:
1475671a 135 wxSpinEvent(int commandType = 0, int id = 0);
62bd0874
RD
136
137};
138
139//---------------------------------------------------------------------------
140
7bf85405
RD
141class wxMouseEvent: public wxEvent {
142public:
1475671a
RD
143 wxMouseEvent(int mouseEventType = 0);
144
7bf85405
RD
145 bool IsButton();
146 bool ButtonDown(int but = -1);
147 bool ButtonDClick(int but = -1);
148 bool ButtonUp(int but = -1);
149 bool Button(int but);
150 bool ButtonIsDown(int but);
151 bool ControlDown();
152 bool MetaDown();
153 bool AltDown();
154 bool ShiftDown();
155 bool LeftDown();
156 bool MiddleDown();
157 bool RightDown();
158 bool LeftUp();
159 bool MiddleUp();
160 bool RightUp();
161 bool LeftDClick();
162 bool MiddleDClick();
163 bool RightDClick();
164 bool LeftIsDown();
165 bool MiddleIsDown();
166 bool RightIsDown();
167 bool Dragging();
168 bool Moving();
169 bool Entering();
170 bool Leaving();
7bf85405 171 wxPoint GetPosition();
b1462dfa 172 %name(GetPositionTuple)void GetPosition(long *OUTPUT, long *OUTPUT);
7bf85405
RD
173 wxPoint GetLogicalPosition(const wxDC& dc);
174 long GetX();
175 long GetY();
c368d904 176
d1679124
RD
177 int GetWheelRotation() const { return m_wheelRotation; }
178 int GetWheelDelta() const { return m_wheelDelta; }
179 int GetLinesPerAction() const { return m_linesPerAction; }
180
c368d904
RD
181 long m_x, m_y;
182 bool m_leftDown;
183 bool m_middleDown;
184 bool m_rightDown;
185 bool m_controlDown;
186 bool m_shiftDown;
187 bool m_altDown;
188 bool m_metaDown;
d1679124
RD
189 int m_wheelRotation;
190 int m_wheelDelta;
191 int m_linesPerAction;
7bf85405
RD
192};
193
194//---------------------------------------------------------------------------
195
196class wxKeyEvent: public wxEvent {
197public:
1475671a
RD
198 wxKeyEvent(int keyEventType);
199
7bf85405
RD
200 bool ControlDown();
201 bool MetaDown();
202 bool AltDown();
203 bool ShiftDown();
204 long KeyCode();
e980740a 205
f6bcfd97
BP
206 long GetKeyCode();
207 bool HasModifiers();
208
1475671a
RD
209 long GetX();
210 long GetY();
211 wxPoint GetPosition();
212 %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
c368d904
RD
213
214 long m_x, m_y;
215 long m_keyCode;
216 bool m_controlDown;
217 bool m_shiftDown;
218 bool m_altDown;
219 bool m_metaDown;
220 bool m_scanCode;
221
7bf85405
RD
222};
223
2f90df85
RD
224//---------------------------------------------------------------------------
225
eec92d76 226class wxNavigationKeyEvent : public wxEvent {
1475671a
RD
227public:
228 wxNavigationKeyEvent();
229
230 bool GetDirection();
231 void SetDirection(bool bForward);
232 bool IsWindowChange();
233 void SetWindowChange(bool bIs);
234 wxWindow* GetCurrentFocus();
235 void SetCurrentFocus(wxWindow *win);
236};
2f90df85
RD
237
238
7bf85405
RD
239//---------------------------------------------------------------------------
240
241class wxMoveEvent: public wxEvent {
242public:
1475671a
RD
243 wxMoveEvent(const wxPoint& pt, int id = 0);
244
7bf85405
RD
245 wxPoint GetPosition();
246};
247
248//---------------------------------------------------------------------------
249
250class wxPaintEvent: public wxEvent {
251public:
1475671a 252 wxPaintEvent(int id = 0);
7bf85405
RD
253
254};
255
256//---------------------------------------------------------------------------
257
258class wxEraseEvent: public wxEvent {
259public:
1475671a
RD
260 wxEraseEvent(int id = 0, wxDC* dc = NULL);
261
7bf85405
RD
262 wxDC *GetDC();
263};
264
265//---------------------------------------------------------------------------
266
267class wxFocusEvent: public wxEvent {
268public:
1475671a 269 wxFocusEvent(WXTYPE eventType = 0, int id = 0);
7bf85405
RD
270};
271
7b7ac0ab
RD
272//---------------------------------------------------------------------------
273
274// wxChildFocusEvent notifies the parent that a child has got the focus: unlike
275// wxFocusEvent it is propgated upwards the window chain
276class wxChildFocusEvent : public wxCommandEvent
277{
278public:
279 wxChildFocusEvent(wxWindow *win = NULL);
280 wxWindow *GetWindow() const;
281};
282
283
7bf85405
RD
284//---------------------------------------------------------------------------
285
286class wxActivateEvent: public wxEvent{
287public:
1475671a 288 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
7bf85405
RD
289 bool GetActive();
290};
291
292//---------------------------------------------------------------------------
293
294class wxInitDialogEvent: public wxEvent {
295public:
1475671a 296 wxInitDialogEvent(int id = 0);
7bf85405
RD
297};
298
299//---------------------------------------------------------------------------
300
301class wxMenuEvent: public wxEvent {
302public:
1475671a 303 wxMenuEvent(WXTYPE id = 0, int id = 0);
7bf85405 304 int GetMenuId();
afb810d9 305 bool IsPopup();
7bf85405
RD
306};
307
308//---------------------------------------------------------------------------
309
310class wxShowEvent: public wxEvent {
311public:
1475671a 312 wxShowEvent(int id = 0, int show = FALSE);
7bf85405
RD
313 void SetShow(bool show);
314 bool GetShow();
315};
316
317//---------------------------------------------------------------------------
318
319class wxIconizeEvent: public wxEvent {
320public:
d56cebe7
RD
321 wxIconizeEvent(int id = 0, bool iconized = TRUE);
322 bool Iconized();
7bf85405
RD
323};
324
325//---------------------------------------------------------------------------
326
327class wxMaximizeEvent: public wxEvent {
328public:
1475671a 329 wxMaximizeEvent(int id = 0);
7bf85405
RD
330};
331
332//---------------------------------------------------------------------------
333
334class wxJoystickEvent: public wxEvent {
335public:
1475671a
RD
336 wxJoystickEvent(int type = wxEVT_NULL,
337 int state = 0,
338 int joystick = wxJOYSTICK1,
339 int change = 0);
7bf85405
RD
340 wxPoint GetPosition();
341 int GetZPosition();
342 int GetButtonState();
343 int GetButtonChange();
344 int GetJoystick();
345 void SetJoystick(int stick);
346 void SetButtonState(int state);
347 void SetButtonChange(int change);
348 void SetPosition(const wxPoint& pos);
349 void SetZPosition(int zPos);
350 bool IsButton();
351 bool IsMove();
352 bool IsZMove();
353 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
354 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
355 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
356};
357
358//---------------------------------------------------------------------------
359
360class wxDropFilesEvent: public wxEvent {
361public:
362 wxPoint GetPosition();
363 int GetNumberOfFiles();
364
365 %addmethods {
366 PyObject* GetFiles() {
367 int count = self->GetNumberOfFiles();
368 wxString* files = self->GetFiles();
369 PyObject* list = PyList_New(count);
370
371 if (!list) {
372 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
373 return NULL;
374 }
375
376 for (int i=0; i<count; i++) {
377 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
378 }
379 return list;
380 }
381 }
382};
383
384//---------------------------------------------------------------------------
385
386class wxIdleEvent: public wxEvent {
387public:
1475671a 388 wxIdleEvent();
7bf85405
RD
389 void RequestMore(bool needMore = TRUE);
390 bool MoreRequested();
391};
392
393//---------------------------------------------------------------------------
394
395class wxUpdateUIEvent: public wxEvent {
396public:
1475671a 397 wxUpdateUIEvent(wxWindowID commandId = 0);
7bf85405
RD
398 bool GetChecked();
399 bool GetEnabled();
400 wxString GetText();
401 bool GetSetText();
402 bool GetSetChecked();
403 bool GetSetEnabled();
404
405 void Check(bool check);
406 void Enable(bool enable);
407 void SetText(const wxString& text);
408};
409
410//---------------------------------------------------------------------------
411
412class wxSysColourChangedEvent: public wxEvent {
413public:
1475671a 414 wxSysColourChangedEvent();
7bf85405
RD
415};
416
417//---------------------------------------------------------------------------
418
2f90df85
RD
419
420class wxNotifyEvent : public wxCommandEvent {
cf694132 421public:
1475671a 422 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
2f90df85 423 bool IsAllowed();
185d7c3e 424 void Allow();
2f90df85
RD
425 void Veto();
426};
427
428
be43cc44
RD
429//---------------------------------------------------------------------------
430
431class wxDisplayChangedEvent : public wxEvent
432{
433public:
434 wxDisplayChangedEvent();
435};
436
437
2f90df85 438//---------------------------------------------------------------------------
1475671a
RD
439
440class wxPaletteChangedEvent : public wxEvent {
441public:
442 wxPaletteChangedEvent(wxWindowID id = 0);
443
444 void SetChangedWindow(wxWindow* win);
445 wxWindow* GetChangedWindow();
446
447};
448
449//---------------------------------------------------------------------------
450
451class wxQueryNewPaletteEvent : public wxEvent {
452public:
453 wxQueryNewPaletteEvent(wxWindowID id = 0);
454
455 void SetPaletteRealized(bool realized);
456 bool GetPaletteRealized();
457};
458
459
460//---------------------------------------------------------------------------
461
f6bcfd97 462class wxWindowCreateEvent : public wxCommandEvent {
1475671a
RD
463public:
464 wxWindowCreateEvent(wxWindow *win = NULL);
465
466 wxWindow *GetWindow();
467};
468
f6bcfd97 469class wxWindowDestroyEvent : public wxCommandEvent {
1475671a
RD
470public:
471 wxWindowDestroyEvent(wxWindow *win = NULL);
472
473 wxWindow *GetWindow();
474};
475
f6bcfd97
BP
476//---------------------------------------------------------------------------
477
478class wxTimerEvent : public wxEvent
479{
480public:
481 wxTimerEvent(int id = 0, int interval = 0);
482 int GetInterval();
483};
484
c7e7022c
RD
485//---------------------------------------------------------------------------
486
487class wxTextUrlEvent : public wxCommandEvent
488{
489public:
490 wxTextUrlEvent(int id, const wxMouseEvent& evtMouse,
491 long start, long end);
492 const wxMouseEvent& GetMouseEvent();
493 long GetURLStart();
494 long GetURLEnd();
495};
1475671a
RD
496
497//---------------------------------------------------------------------------
498//---------------------------------------------------------------------------
65dd82cb
RD
499// These classes can be derived from in Python and passed through the event
500// system without loosing anything. They do this by keeping a reference to
501// themselves and some special case handling in wxPyCallback::EventThunker.
cf694132 502
2f90df85
RD
503class wxPyEvent : public wxEvent {
504public:
65dd82cb 505 wxPyEvent(int id=0);
2f90df85
RD
506 ~wxPyEvent();
507
65dd82cb
RD
508 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
509
510 void SetSelf(PyObject* self);
511 PyObject* GetSelf();
2f90df85
RD
512};
513
bb0054cd 514
2f90df85 515class wxPyCommandEvent : public wxCommandEvent {
bb0054cd 516public:
65dd82cb
RD
517 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
518 ~wxPyCommandEvent();
2f90df85 519
65dd82cb 520 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
2f90df85 521
65dd82cb
RD
522 void SetSelf(PyObject* self);
523 PyObject* GetSelf();
2f90df85
RD
524};
525
2f90df85 526
bb0054cd 527
2f90df85 528
bb0054cd
RD
529//---------------------------------------------------------------------------
530//---------------------------------------------------------------------------
7bf85405 531