1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIGgable Event classes for wxPython
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
18 #include <wx/spinbutt.h>
21 //----------------------------------------------------------------------
24 %include my_typemaps.i
26 // Import some definitions of other classes, etc.
31 //---------------------------------------------------------------------------
38 wxObject* GetEventObject();
39 wxEventType GetEventType();
43 void SetEventObject(wxObject* object);
44 void SetEventType(wxEventType typ);
46 void SetTimestamp(long timeStamp);
47 void Skip(bool skip = TRUE);
50 //---------------------------------------------------------------------------
52 class wxSizeEvent : public wxEvent {
54 wxSizeEvent(const wxSize& sz, int id = 0);
58 //---------------------------------------------------------------------------
60 class wxCloseEvent : public wxEvent {
62 wxCloseEvent(int commandEventType = 0, int id = 0);
64 void SetLoggingOff(bool loggingOff);
66 void Veto(bool veto = TRUE);
69 void SetCanVeto(bool canVeto);
72 //---------------------------------------------------------------------------
74 class wxCommandEvent : public wxEvent {
76 wxCommandEvent(int commandEventType = 0, int id = 0);
84 void SetString(const wxString& s);
85 void SetExtraLong(long extraLong);
91 //---------------------------------------------------------------------------
93 class wxScrollEvent: public wxCommandEvent {
95 wxScrollEvent(int commandType = 0, int id = 0, int pos = 0,
102 //---------------------------------------------------------------------------
104 class wxScrollWinEvent: public wxEvent {
106 wxScrollWinEvent(int commandType = 0, int pos = 0,
107 int orientation = 0);
109 int GetOrientation();
113 //---------------------------------------------------------------------------
115 class wxSpinEvent : public wxScrollEvent {
117 wxSpinEvent(int commandType = 0, int id = 0);
121 //---------------------------------------------------------------------------
123 class wxMouseEvent: public wxEvent {
125 wxMouseEvent(int mouseEventType = 0);
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);
153 wxPoint GetPosition();
154 %name(GetPositionTuple)void GetPosition(long *OUTPUT, long *OUTPUT);
155 wxPoint GetLogicalPosition(const wxDC& dc);
160 //---------------------------------------------------------------------------
162 class wxKeyEvent: public wxEvent {
164 wxKeyEvent(int keyEventType);
177 wxPoint GetPosition();
178 %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
181 //---------------------------------------------------------------------------
183 class wxNavigationKeyEvent : public wxEvent {
185 wxNavigationKeyEvent();
188 void SetDirection(bool bForward);
189 bool IsWindowChange();
190 void SetWindowChange(bool bIs);
191 wxWindow* GetCurrentFocus();
192 void SetCurrentFocus(wxWindow *win);
196 //---------------------------------------------------------------------------
198 class wxMoveEvent: public wxEvent {
200 wxMoveEvent(const wxPoint& pt, int id = 0);
202 wxPoint GetPosition();
205 //---------------------------------------------------------------------------
207 class wxPaintEvent: public wxEvent {
209 wxPaintEvent(int id = 0);
213 //---------------------------------------------------------------------------
215 class wxEraseEvent: public wxEvent {
217 wxEraseEvent(int id = 0, wxDC* dc = NULL);
222 //---------------------------------------------------------------------------
224 class wxFocusEvent: public wxEvent {
226 wxFocusEvent(WXTYPE eventType = 0, int id = 0);
229 //---------------------------------------------------------------------------
231 class wxActivateEvent: public wxEvent{
233 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
237 //---------------------------------------------------------------------------
239 class wxInitDialogEvent: public wxEvent {
241 wxInitDialogEvent(int id = 0);
244 //---------------------------------------------------------------------------
246 class wxMenuEvent: public wxEvent {
248 wxMenuEvent(WXTYPE id = 0, int id = 0);
252 //---------------------------------------------------------------------------
254 class wxShowEvent: public wxEvent {
256 wxShowEvent(int id = 0, int show = FALSE);
257 void SetShow(bool show);
261 //---------------------------------------------------------------------------
263 class wxIconizeEvent: public wxEvent {
265 wxIconizeEvent(int id = 0);
268 //---------------------------------------------------------------------------
270 class wxMaximizeEvent: public wxEvent {
272 wxMaximizeEvent(int id = 0);
275 //---------------------------------------------------------------------------
277 class wxJoystickEvent: public wxEvent {
279 wxJoystickEvent(int type = wxEVT_NULL,
281 int joystick = wxJOYSTICK1,
283 wxPoint GetPosition();
285 int GetButtonState();
286 int GetButtonChange();
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);
296 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
297 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
298 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
301 //---------------------------------------------------------------------------
303 class wxDropFilesEvent: public wxEvent {
305 wxPoint GetPosition();
306 int GetNumberOfFiles();
309 PyObject* GetFiles() {
310 int count = self->GetNumberOfFiles();
311 wxString* files = self->GetFiles();
312 PyObject* list = PyList_New(count);
315 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
319 for (int i=0; i<count; i++) {
320 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
327 //---------------------------------------------------------------------------
329 class wxIdleEvent: public wxEvent {
332 void RequestMore(bool needMore = TRUE);
333 bool MoreRequested();
336 //---------------------------------------------------------------------------
338 class wxUpdateUIEvent: public wxEvent {
340 wxUpdateUIEvent(wxWindowID commandId = 0);
345 bool GetSetChecked();
346 bool GetSetEnabled();
348 void Check(bool check);
349 void Enable(bool enable);
350 void SetText(const wxString& text);
353 //---------------------------------------------------------------------------
355 class wxSysColourChangedEvent: public wxEvent {
357 wxSysColourChangedEvent();
360 //---------------------------------------------------------------------------
363 class wxNotifyEvent : public wxCommandEvent {
365 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
371 //---------------------------------------------------------------------------
373 class wxPaletteChangedEvent : public wxEvent {
375 wxPaletteChangedEvent(wxWindowID id = 0);
377 void SetChangedWindow(wxWindow* win);
378 wxWindow* GetChangedWindow();
382 //---------------------------------------------------------------------------
384 class wxQueryNewPaletteEvent : public wxEvent {
386 wxQueryNewPaletteEvent(wxWindowID id = 0);
388 void SetPaletteRealized(bool realized);
389 bool GetPaletteRealized();
393 //---------------------------------------------------------------------------
395 class wxWindowCreateEvent : public wxCommandEvent {
397 wxWindowCreateEvent(wxWindow *win = NULL);
399 wxWindow *GetWindow();
402 class wxWindowDestroyEvent : public wxCommandEvent {
404 wxWindowDestroyEvent(wxWindow *win = NULL);
406 wxWindow *GetWindow();
409 //---------------------------------------------------------------------------
411 class wxTimerEvent : public wxEvent
414 wxTimerEvent(int id = 0, int interval = 0);
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.
425 class wxPyEvent : public wxEvent {
430 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
432 void SetSelf(PyObject* self);
437 class wxPyCommandEvent : public wxCommandEvent {
439 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
442 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
444 void SetSelf(PyObject* self);
451 //---------------------------------------------------------------------------
452 //---------------------------------------------------------------------------