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