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);
79 %name(Checked)bool IsChecked();
85 void SetString(const wxString& s);
86 void SetExtraLong(long extraLong);
92 //---------------------------------------------------------------------------
94 class wxScrollEvent: public wxCommandEvent {
96 wxScrollEvent(int commandType = 0, int id = 0, int pos = 0,
103 //---------------------------------------------------------------------------
105 class wxScrollWinEvent: public wxEvent {
107 wxScrollWinEvent(int commandType = 0, int pos = 0,
108 int orientation = 0);
110 int GetOrientation();
114 //---------------------------------------------------------------------------
116 class wxSpinEvent : public wxScrollEvent {
118 wxSpinEvent(int commandType = 0, int id = 0);
122 //---------------------------------------------------------------------------
124 class wxMouseEvent: public wxEvent {
126 wxMouseEvent(int mouseEventType = 0);
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);
154 wxPoint GetPosition();
155 %name(GetPositionTuple)void GetPosition(long *OUTPUT, long *OUTPUT);
156 wxPoint GetLogicalPosition(const wxDC& dc);
170 //---------------------------------------------------------------------------
172 class wxKeyEvent: public wxEvent {
174 wxKeyEvent(int keyEventType);
187 wxPoint GetPosition();
188 %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
200 //---------------------------------------------------------------------------
202 class wxNavigationKeyEvent : public wxEvent {
204 wxNavigationKeyEvent();
207 void SetDirection(bool bForward);
208 bool IsWindowChange();
209 void SetWindowChange(bool bIs);
210 wxWindow* GetCurrentFocus();
211 void SetCurrentFocus(wxWindow *win);
215 //---------------------------------------------------------------------------
217 class wxMoveEvent: public wxEvent {
219 wxMoveEvent(const wxPoint& pt, int id = 0);
221 wxPoint GetPosition();
224 //---------------------------------------------------------------------------
226 class wxPaintEvent: public wxEvent {
228 wxPaintEvent(int id = 0);
232 //---------------------------------------------------------------------------
234 class wxEraseEvent: public wxEvent {
236 wxEraseEvent(int id = 0, wxDC* dc = NULL);
241 //---------------------------------------------------------------------------
243 class wxFocusEvent: public wxEvent {
245 wxFocusEvent(WXTYPE eventType = 0, int id = 0);
248 //---------------------------------------------------------------------------
250 class wxActivateEvent: public wxEvent{
252 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
256 //---------------------------------------------------------------------------
258 class wxInitDialogEvent: public wxEvent {
260 wxInitDialogEvent(int id = 0);
263 //---------------------------------------------------------------------------
265 class wxMenuEvent: public wxEvent {
267 wxMenuEvent(WXTYPE id = 0, int id = 0);
271 //---------------------------------------------------------------------------
273 class wxShowEvent: public wxEvent {
275 wxShowEvent(int id = 0, int show = FALSE);
276 void SetShow(bool show);
280 //---------------------------------------------------------------------------
282 class wxIconizeEvent: public wxEvent {
284 wxIconizeEvent(int id = 0);
287 //---------------------------------------------------------------------------
289 class wxMaximizeEvent: public wxEvent {
291 wxMaximizeEvent(int id = 0);
294 //---------------------------------------------------------------------------
296 class wxJoystickEvent: public wxEvent {
298 wxJoystickEvent(int type = wxEVT_NULL,
300 int joystick = wxJOYSTICK1,
302 wxPoint GetPosition();
304 int GetButtonState();
305 int GetButtonChange();
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);
315 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
316 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
317 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
320 //---------------------------------------------------------------------------
322 class wxDropFilesEvent: public wxEvent {
324 wxPoint GetPosition();
325 int GetNumberOfFiles();
328 PyObject* GetFiles() {
329 int count = self->GetNumberOfFiles();
330 wxString* files = self->GetFiles();
331 PyObject* list = PyList_New(count);
334 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
338 for (int i=0; i<count; i++) {
339 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
346 //---------------------------------------------------------------------------
348 class wxIdleEvent: public wxEvent {
351 void RequestMore(bool needMore = TRUE);
352 bool MoreRequested();
355 //---------------------------------------------------------------------------
357 class wxUpdateUIEvent: public wxEvent {
359 wxUpdateUIEvent(wxWindowID commandId = 0);
364 bool GetSetChecked();
365 bool GetSetEnabled();
367 void Check(bool check);
368 void Enable(bool enable);
369 void SetText(const wxString& text);
372 //---------------------------------------------------------------------------
374 class wxSysColourChangedEvent: public wxEvent {
376 wxSysColourChangedEvent();
379 //---------------------------------------------------------------------------
382 class wxNotifyEvent : public wxCommandEvent {
384 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
390 //---------------------------------------------------------------------------
392 class wxPaletteChangedEvent : public wxEvent {
394 wxPaletteChangedEvent(wxWindowID id = 0);
396 void SetChangedWindow(wxWindow* win);
397 wxWindow* GetChangedWindow();
401 //---------------------------------------------------------------------------
403 class wxQueryNewPaletteEvent : public wxEvent {
405 wxQueryNewPaletteEvent(wxWindowID id = 0);
407 void SetPaletteRealized(bool realized);
408 bool GetPaletteRealized();
412 //---------------------------------------------------------------------------
414 class wxWindowCreateEvent : public wxCommandEvent {
416 wxWindowCreateEvent(wxWindow *win = NULL);
418 wxWindow *GetWindow();
421 class wxWindowDestroyEvent : public wxCommandEvent {
423 wxWindowDestroyEvent(wxWindow *win = NULL);
425 wxWindow *GetWindow();
428 //---------------------------------------------------------------------------
430 class wxTimerEvent : public wxEvent
433 wxTimerEvent(int id = 0, int interval = 0);
438 //---------------------------------------------------------------------------
439 //---------------------------------------------------------------------------
440 // These classes can be derived from in Python and passed through the event
441 // system without loosing anything. They do this by keeping a reference to
442 // themselves and some special case handling in wxPyCallback::EventThunker.
444 class wxPyEvent : public wxEvent {
449 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
451 void SetSelf(PyObject* self);
456 class wxPyCommandEvent : public wxCommandEvent {
458 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
461 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
463 void SetSelf(PyObject* self);
470 //---------------------------------------------------------------------------
471 //---------------------------------------------------------------------------