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);
391 //---------------------------------------------------------------------------
393 class wxPaletteChangedEvent : public wxEvent {
395 wxPaletteChangedEvent(wxWindowID id = 0);
397 void SetChangedWindow(wxWindow* win);
398 wxWindow* GetChangedWindow();
402 //---------------------------------------------------------------------------
404 class wxQueryNewPaletteEvent : public wxEvent {
406 wxQueryNewPaletteEvent(wxWindowID id = 0);
408 void SetPaletteRealized(bool realized);
409 bool GetPaletteRealized();
413 //---------------------------------------------------------------------------
415 class wxWindowCreateEvent : public wxCommandEvent {
417 wxWindowCreateEvent(wxWindow *win = NULL);
419 wxWindow *GetWindow();
422 class wxWindowDestroyEvent : public wxCommandEvent {
424 wxWindowDestroyEvent(wxWindow *win = NULL);
426 wxWindow *GetWindow();
429 //---------------------------------------------------------------------------
431 class wxTimerEvent : public wxEvent
434 wxTimerEvent(int id = 0, int interval = 0);
439 //---------------------------------------------------------------------------
440 //---------------------------------------------------------------------------
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.
445 class wxPyEvent : public wxEvent {
450 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
452 void SetSelf(PyObject* self);
457 class wxPyCommandEvent : public wxCommandEvent {
459 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
462 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
464 void SetSelf(PyObject* self);
471 //---------------------------------------------------------------------------
472 //---------------------------------------------------------------------------