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 //---------------------------------------------------------------------------
36 class wxEvent : public wxObject {
41 wxObject* GetEventObject();
42 wxEventType GetEventType();
46 void SetEventObject(wxObject* object);
47 void SetEventType(wxEventType typ);
49 void SetTimestamp(long timeStamp);
50 void Skip(bool skip = TRUE);
55 //---------------------------------------------------------------------------
57 class wxSizeEvent : public wxEvent {
59 wxSizeEvent(const wxSize& sz, int id = 0);
63 //---------------------------------------------------------------------------
65 class wxCloseEvent : public wxEvent {
67 wxCloseEvent(int commandEventType = 0, int id = 0);
69 void SetLoggingOff(bool loggingOff);
71 void Veto(bool veto = TRUE);
74 void SetCanVeto(bool canVeto);
77 //---------------------------------------------------------------------------
79 class wxCommandEvent : public wxEvent {
81 wxCommandEvent(int commandEventType = 0, int id = 0);
84 %name(Checked)bool IsChecked();
90 void SetString(const wxString& s);
91 void SetExtraLong(long extraLong);
95 PyObject* GetClientData() {
96 wxPyClientData* data = (wxPyClientData*)self->GetClientObject();
98 Py_INCREF(data->m_obj);
109 //---------------------------------------------------------------------------
111 class wxScrollEvent: public wxCommandEvent {
113 wxScrollEvent(int commandType = 0, int id = 0, int pos = 0,
114 int orientation = 0);
116 int GetOrientation();
120 //---------------------------------------------------------------------------
122 class wxScrollWinEvent: public wxEvent {
124 wxScrollWinEvent(int commandType = 0, int pos = 0,
125 int orientation = 0);
127 int GetOrientation();
131 //---------------------------------------------------------------------------
133 class wxSpinEvent : public wxScrollEvent {
135 wxSpinEvent(int commandType = 0, int id = 0);
139 //---------------------------------------------------------------------------
141 class wxMouseEvent: public wxEvent {
143 wxMouseEvent(int mouseEventType = 0);
146 bool ButtonDown(int but = -1);
147 bool ButtonDClick(int but = -1);
148 bool ButtonUp(int but = -1);
149 bool Button(int but);
150 bool ButtonIsDown(int but);
171 wxPoint GetPosition();
172 %name(GetPositionTuple)void GetPosition(long *OUTPUT, long *OUTPUT);
173 wxPoint GetLogicalPosition(const wxDC& dc);
177 int GetWheelRotation() const { return m_wheelRotation; }
178 int GetWheelDelta() const { return m_wheelDelta; }
179 int GetLinesPerAction() const { return m_linesPerAction; }
191 int m_linesPerAction;
194 //---------------------------------------------------------------------------
196 class wxKeyEvent: public wxEvent {
198 wxKeyEvent(int keyEventType);
211 wxPoint GetPosition();
212 %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
224 //---------------------------------------------------------------------------
226 class wxNavigationKeyEvent : public wxEvent {
228 wxNavigationKeyEvent();
231 void SetDirection(bool bForward);
232 bool IsWindowChange();
233 void SetWindowChange(bool bIs);
234 wxWindow* GetCurrentFocus();
235 void SetCurrentFocus(wxWindow *win);
239 //---------------------------------------------------------------------------
241 class wxMoveEvent: public wxEvent {
243 wxMoveEvent(const wxPoint& pt, int id = 0);
245 wxPoint GetPosition();
248 //---------------------------------------------------------------------------
250 class wxPaintEvent: public wxEvent {
252 wxPaintEvent(int id = 0);
256 //---------------------------------------------------------------------------
258 class wxEraseEvent: public wxEvent {
260 wxEraseEvent(int id = 0, wxDC* dc = NULL);
265 //---------------------------------------------------------------------------
267 class wxFocusEvent: public wxEvent {
269 wxFocusEvent(WXTYPE eventType = 0, int id = 0);
272 //---------------------------------------------------------------------------
274 class wxActivateEvent: public wxEvent{
276 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
280 //---------------------------------------------------------------------------
282 class wxInitDialogEvent: public wxEvent {
284 wxInitDialogEvent(int id = 0);
287 //---------------------------------------------------------------------------
289 class wxMenuEvent: public wxEvent {
291 wxMenuEvent(WXTYPE id = 0, int id = 0);
295 //---------------------------------------------------------------------------
297 class wxShowEvent: public wxEvent {
299 wxShowEvent(int id = 0, int show = FALSE);
300 void SetShow(bool show);
304 //---------------------------------------------------------------------------
306 class wxIconizeEvent: public wxEvent {
308 wxIconizeEvent(int id = 0, bool iconized = TRUE);
312 //---------------------------------------------------------------------------
314 class wxMaximizeEvent: public wxEvent {
316 wxMaximizeEvent(int id = 0);
319 //---------------------------------------------------------------------------
321 class wxJoystickEvent: public wxEvent {
323 wxJoystickEvent(int type = wxEVT_NULL,
325 int joystick = wxJOYSTICK1,
327 wxPoint GetPosition();
329 int GetButtonState();
330 int GetButtonChange();
332 void SetJoystick(int stick);
333 void SetButtonState(int state);
334 void SetButtonChange(int change);
335 void SetPosition(const wxPoint& pos);
336 void SetZPosition(int zPos);
340 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
341 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
342 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
345 //---------------------------------------------------------------------------
347 class wxDropFilesEvent: public wxEvent {
349 wxPoint GetPosition();
350 int GetNumberOfFiles();
353 PyObject* GetFiles() {
354 int count = self->GetNumberOfFiles();
355 wxString* files = self->GetFiles();
356 PyObject* list = PyList_New(count);
359 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
363 for (int i=0; i<count; i++) {
364 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
371 //---------------------------------------------------------------------------
373 class wxIdleEvent: public wxEvent {
376 void RequestMore(bool needMore = TRUE);
377 bool MoreRequested();
380 //---------------------------------------------------------------------------
382 class wxUpdateUIEvent: public wxEvent {
384 wxUpdateUIEvent(wxWindowID commandId = 0);
389 bool GetSetChecked();
390 bool GetSetEnabled();
392 void Check(bool check);
393 void Enable(bool enable);
394 void SetText(const wxString& text);
397 //---------------------------------------------------------------------------
399 class wxSysColourChangedEvent: public wxEvent {
401 wxSysColourChangedEvent();
404 //---------------------------------------------------------------------------
407 class wxNotifyEvent : public wxCommandEvent {
409 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
416 //---------------------------------------------------------------------------
418 class wxPaletteChangedEvent : public wxEvent {
420 wxPaletteChangedEvent(wxWindowID id = 0);
422 void SetChangedWindow(wxWindow* win);
423 wxWindow* GetChangedWindow();
427 //---------------------------------------------------------------------------
429 class wxQueryNewPaletteEvent : public wxEvent {
431 wxQueryNewPaletteEvent(wxWindowID id = 0);
433 void SetPaletteRealized(bool realized);
434 bool GetPaletteRealized();
438 //---------------------------------------------------------------------------
440 class wxWindowCreateEvent : public wxCommandEvent {
442 wxWindowCreateEvent(wxWindow *win = NULL);
444 wxWindow *GetWindow();
447 class wxWindowDestroyEvent : public wxCommandEvent {
449 wxWindowDestroyEvent(wxWindow *win = NULL);
451 wxWindow *GetWindow();
454 //---------------------------------------------------------------------------
456 class wxTimerEvent : public wxEvent
459 wxTimerEvent(int id = 0, int interval = 0);
463 //---------------------------------------------------------------------------
465 class wxTextUrlEvent : public wxCommandEvent
468 wxTextUrlEvent(int id, const wxMouseEvent& evtMouse,
469 long start, long end);
470 const wxMouseEvent& GetMouseEvent();
475 //---------------------------------------------------------------------------
476 //---------------------------------------------------------------------------
477 // These classes can be derived from in Python and passed through the event
478 // system without loosing anything. They do this by keeping a reference to
479 // themselves and some special case handling in wxPyCallback::EventThunker.
481 class wxPyEvent : public wxEvent {
486 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
488 void SetSelf(PyObject* self);
493 class wxPyCommandEvent : public wxCommandEvent {
495 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
498 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
500 void SetSelf(PyObject* self);
507 //---------------------------------------------------------------------------
508 //---------------------------------------------------------------------------