]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/events.i
added a PROIO_yyparse function in order to compile again after defines have moved...
[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
33class wxEvent {
34public:
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
52class wxSizeEvent : public wxEvent {
53public:
1475671a 54 wxSizeEvent(const wxSize& sz, int id = 0);
7bf85405
RD
55 wxSize GetSize();
56};
57
58//---------------------------------------------------------------------------
59
60class wxCloseEvent : public wxEvent {
61public:
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
74class wxCommandEvent : public wxEvent {
75public:
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
94class wxScrollEvent: public wxCommandEvent {
95public:
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
105class wxScrollWinEvent: public wxEvent {
106public:
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
116class wxSpinEvent : public wxScrollEvent {
117public:
1475671a 118 wxSpinEvent(int commandType = 0, int id = 0);
62bd0874
RD
119
120};
121
122//---------------------------------------------------------------------------
123
7bf85405
RD
124class wxMouseEvent: public wxEvent {
125public:
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();
c368d904
RD
159
160 long m_x, m_y;
161 bool m_leftDown;
162 bool m_middleDown;
163 bool m_rightDown;
164 bool m_controlDown;
165 bool m_shiftDown;
166 bool m_altDown;
167 bool m_metaDown;
7bf85405
RD
168};
169
170//---------------------------------------------------------------------------
171
172class wxKeyEvent: public wxEvent {
173public:
1475671a
RD
174 wxKeyEvent(int keyEventType);
175
7bf85405
RD
176 bool ControlDown();
177 bool MetaDown();
178 bool AltDown();
179 bool ShiftDown();
180 long KeyCode();
e980740a 181
f6bcfd97
BP
182 long GetKeyCode();
183 bool HasModifiers();
184
1475671a
RD
185 long GetX();
186 long GetY();
187 wxPoint GetPosition();
188 %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
c368d904
RD
189
190 long m_x, m_y;
191 long m_keyCode;
192 bool m_controlDown;
193 bool m_shiftDown;
194 bool m_altDown;
195 bool m_metaDown;
196 bool m_scanCode;
197
7bf85405
RD
198};
199
2f90df85
RD
200//---------------------------------------------------------------------------
201
eec92d76 202class wxNavigationKeyEvent : public wxEvent {
1475671a
RD
203public:
204 wxNavigationKeyEvent();
205
206 bool GetDirection();
207 void SetDirection(bool bForward);
208 bool IsWindowChange();
209 void SetWindowChange(bool bIs);
210 wxWindow* GetCurrentFocus();
211 void SetCurrentFocus(wxWindow *win);
212};
2f90df85
RD
213
214
7bf85405
RD
215//---------------------------------------------------------------------------
216
217class wxMoveEvent: public wxEvent {
218public:
1475671a
RD
219 wxMoveEvent(const wxPoint& pt, int id = 0);
220
7bf85405
RD
221 wxPoint GetPosition();
222};
223
224//---------------------------------------------------------------------------
225
226class wxPaintEvent: public wxEvent {
227public:
1475671a 228 wxPaintEvent(int id = 0);
7bf85405
RD
229
230};
231
232//---------------------------------------------------------------------------
233
234class wxEraseEvent: public wxEvent {
235public:
1475671a
RD
236 wxEraseEvent(int id = 0, wxDC* dc = NULL);
237
7bf85405
RD
238 wxDC *GetDC();
239};
240
241//---------------------------------------------------------------------------
242
243class wxFocusEvent: public wxEvent {
244public:
1475671a 245 wxFocusEvent(WXTYPE eventType = 0, int id = 0);
7bf85405
RD
246};
247
248//---------------------------------------------------------------------------
249
250class wxActivateEvent: public wxEvent{
251public:
1475671a 252 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
7bf85405
RD
253 bool GetActive();
254};
255
256//---------------------------------------------------------------------------
257
258class wxInitDialogEvent: public wxEvent {
259public:
1475671a 260 wxInitDialogEvent(int id = 0);
7bf85405
RD
261};
262
263//---------------------------------------------------------------------------
264
265class wxMenuEvent: public wxEvent {
266public:
1475671a 267 wxMenuEvent(WXTYPE id = 0, int id = 0);
7bf85405
RD
268 int GetMenuId();
269};
270
271//---------------------------------------------------------------------------
272
273class wxShowEvent: public wxEvent {
274public:
1475671a 275 wxShowEvent(int id = 0, int show = FALSE);
7bf85405
RD
276 void SetShow(bool show);
277 bool GetShow();
278};
279
280//---------------------------------------------------------------------------
281
282class wxIconizeEvent: public wxEvent {
283public:
1475671a 284 wxIconizeEvent(int id = 0);
7bf85405
RD
285};
286
287//---------------------------------------------------------------------------
288
289class wxMaximizeEvent: public wxEvent {
290public:
1475671a 291 wxMaximizeEvent(int id = 0);
7bf85405
RD
292};
293
294//---------------------------------------------------------------------------
295
296class wxJoystickEvent: public wxEvent {
297public:
1475671a
RD
298 wxJoystickEvent(int type = wxEVT_NULL,
299 int state = 0,
300 int joystick = wxJOYSTICK1,
301 int change = 0);
7bf85405
RD
302 wxPoint GetPosition();
303 int GetZPosition();
304 int GetButtonState();
305 int GetButtonChange();
306 int GetJoystick();
307 void SetJoystick(int stick);
308 void SetButtonState(int state);
309 void SetButtonChange(int change);
310 void SetPosition(const wxPoint& pos);
311 void SetZPosition(int zPos);
312 bool IsButton();
313 bool IsMove();
314 bool IsZMove();
315 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
316 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
317 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
318};
319
320//---------------------------------------------------------------------------
321
322class wxDropFilesEvent: public wxEvent {
323public:
324 wxPoint GetPosition();
325 int GetNumberOfFiles();
326
327 %addmethods {
328 PyObject* GetFiles() {
329 int count = self->GetNumberOfFiles();
330 wxString* files = self->GetFiles();
331 PyObject* list = PyList_New(count);
332
333 if (!list) {
334 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
335 return NULL;
336 }
337
338 for (int i=0; i<count; i++) {
339 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
340 }
341 return list;
342 }
343 }
344};
345
346//---------------------------------------------------------------------------
347
348class wxIdleEvent: public wxEvent {
349public:
1475671a 350 wxIdleEvent();
7bf85405
RD
351 void RequestMore(bool needMore = TRUE);
352 bool MoreRequested();
353};
354
355//---------------------------------------------------------------------------
356
357class wxUpdateUIEvent: public wxEvent {
358public:
1475671a 359 wxUpdateUIEvent(wxWindowID commandId = 0);
7bf85405
RD
360 bool GetChecked();
361 bool GetEnabled();
362 wxString GetText();
363 bool GetSetText();
364 bool GetSetChecked();
365 bool GetSetEnabled();
366
367 void Check(bool check);
368 void Enable(bool enable);
369 void SetText(const wxString& text);
370};
371
372//---------------------------------------------------------------------------
373
374class wxSysColourChangedEvent: public wxEvent {
375public:
1475671a 376 wxSysColourChangedEvent();
7bf85405
RD
377};
378
379//---------------------------------------------------------------------------
380
2f90df85
RD
381
382class wxNotifyEvent : public wxCommandEvent {
cf694132 383public:
1475671a 384 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
2f90df85 385 bool IsAllowed();
185d7c3e 386 void Allow();
2f90df85
RD
387 void Veto();
388};
389
390
391//---------------------------------------------------------------------------
1475671a
RD
392
393class wxPaletteChangedEvent : public wxEvent {
394public:
395 wxPaletteChangedEvent(wxWindowID id = 0);
396
397 void SetChangedWindow(wxWindow* win);
398 wxWindow* GetChangedWindow();
399
400};
401
402//---------------------------------------------------------------------------
403
404class wxQueryNewPaletteEvent : public wxEvent {
405public:
406 wxQueryNewPaletteEvent(wxWindowID id = 0);
407
408 void SetPaletteRealized(bool realized);
409 bool GetPaletteRealized();
410};
411
412
413//---------------------------------------------------------------------------
414
f6bcfd97 415class wxWindowCreateEvent : public wxCommandEvent {
1475671a
RD
416public:
417 wxWindowCreateEvent(wxWindow *win = NULL);
418
419 wxWindow *GetWindow();
420};
421
f6bcfd97 422class wxWindowDestroyEvent : public wxCommandEvent {
1475671a
RD
423public:
424 wxWindowDestroyEvent(wxWindow *win = NULL);
425
426 wxWindow *GetWindow();
427};
428
f6bcfd97
BP
429//---------------------------------------------------------------------------
430
431class wxTimerEvent : public wxEvent
432{
433public:
434 wxTimerEvent(int id = 0, int interval = 0);
435 int GetInterval();
436};
437
1475671a
RD
438
439//---------------------------------------------------------------------------
440//---------------------------------------------------------------------------
65dd82cb
RD
441// These classes can be derived from in Python and passed through the event
442// system without loosing anything. They do this by keeping a reference to
443// themselves and some special case handling in wxPyCallback::EventThunker.
cf694132 444
2f90df85
RD
445class wxPyEvent : public wxEvent {
446public:
65dd82cb 447 wxPyEvent(int id=0);
2f90df85
RD
448 ~wxPyEvent();
449
65dd82cb
RD
450 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
451
452 void SetSelf(PyObject* self);
453 PyObject* GetSelf();
2f90df85
RD
454};
455
bb0054cd 456
2f90df85 457class wxPyCommandEvent : public wxCommandEvent {
bb0054cd 458public:
65dd82cb
RD
459 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
460 ~wxPyCommandEvent();
2f90df85 461
65dd82cb 462 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
2f90df85 463
65dd82cb
RD
464 void SetSelf(PyObject* self);
465 PyObject* GetSelf();
2f90df85
RD
466};
467
2f90df85 468
bb0054cd 469
2f90df85 470
bb0054cd
RD
471//---------------------------------------------------------------------------
472//---------------------------------------------------------------------------
7bf85405 473