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 {
38 // wxEvent(int id = 0); // *** This class is now an ABC
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 // wxChildFocusEvent notifies the parent that a child has got the focus: unlike
275 // wxFocusEvent it is propgated upwards the window chain
276 class wxChildFocusEvent : public wxCommandEvent
279 wxChildFocusEvent(wxWindow *win = NULL);
280 wxWindow *GetWindow() const;
284 //---------------------------------------------------------------------------
286 class wxActivateEvent: public wxEvent{
288 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
292 //---------------------------------------------------------------------------
294 class wxInitDialogEvent: public wxEvent {
296 wxInitDialogEvent(int id = 0);
299 //---------------------------------------------------------------------------
301 class wxMenuEvent: public wxEvent {
303 wxMenuEvent(WXTYPE id = 0, int id = 0);
308 //---------------------------------------------------------------------------
310 class wxShowEvent: public wxEvent {
312 wxShowEvent(int id = 0, int show = FALSE);
313 void SetShow(bool show);
317 //---------------------------------------------------------------------------
319 class wxIconizeEvent: public wxEvent {
321 wxIconizeEvent(int id = 0, bool iconized = TRUE);
325 //---------------------------------------------------------------------------
327 class wxMaximizeEvent: public wxEvent {
329 wxMaximizeEvent(int id = 0);
332 //---------------------------------------------------------------------------
334 class wxJoystickEvent: public wxEvent {
336 wxJoystickEvent(int type = wxEVT_NULL,
338 int joystick = wxJOYSTICK1,
340 wxPoint GetPosition();
342 int GetButtonState();
343 int GetButtonChange();
345 void SetJoystick(int stick);
346 void SetButtonState(int state);
347 void SetButtonChange(int change);
348 void SetPosition(const wxPoint& pos);
349 void SetZPosition(int zPos);
353 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
354 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
355 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
358 //---------------------------------------------------------------------------
360 class wxDropFilesEvent: public wxEvent {
362 wxPoint GetPosition();
363 int GetNumberOfFiles();
366 PyObject* GetFiles() {
367 int count = self->GetNumberOfFiles();
368 wxString* files = self->GetFiles();
369 PyObject* list = PyList_New(count);
372 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
376 for (int i=0; i<count; i++) {
377 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
384 //---------------------------------------------------------------------------
386 class wxIdleEvent: public wxEvent {
389 void RequestMore(bool needMore = TRUE);
390 bool MoreRequested();
393 //---------------------------------------------------------------------------
395 class wxUpdateUIEvent: public wxEvent {
397 wxUpdateUIEvent(wxWindowID commandId = 0);
402 bool GetSetChecked();
403 bool GetSetEnabled();
405 void Check(bool check);
406 void Enable(bool enable);
407 void SetText(const wxString& text);
410 //---------------------------------------------------------------------------
412 class wxSysColourChangedEvent: public wxEvent {
414 wxSysColourChangedEvent();
417 //---------------------------------------------------------------------------
420 class wxNotifyEvent : public wxCommandEvent {
422 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
429 //---------------------------------------------------------------------------
431 class wxDisplayChangedEvent : public wxEvent
434 wxDisplayChangedEvent();
438 //---------------------------------------------------------------------------
440 class wxPaletteChangedEvent : public wxEvent {
442 wxPaletteChangedEvent(wxWindowID id = 0);
444 void SetChangedWindow(wxWindow* win);
445 wxWindow* GetChangedWindow();
449 //---------------------------------------------------------------------------
451 class wxQueryNewPaletteEvent : public wxEvent {
453 wxQueryNewPaletteEvent(wxWindowID id = 0);
455 void SetPaletteRealized(bool realized);
456 bool GetPaletteRealized();
460 //---------------------------------------------------------------------------
462 class wxWindowCreateEvent : public wxCommandEvent {
464 wxWindowCreateEvent(wxWindow *win = NULL);
466 wxWindow *GetWindow();
469 class wxWindowDestroyEvent : public wxCommandEvent {
471 wxWindowDestroyEvent(wxWindow *win = NULL);
473 wxWindow *GetWindow();
476 //---------------------------------------------------------------------------
478 class wxTimerEvent : public wxEvent
481 wxTimerEvent(int id = 0, int interval = 0);
485 //---------------------------------------------------------------------------
487 class wxTextUrlEvent : public wxCommandEvent
490 wxTextUrlEvent(int id, const wxMouseEvent& evtMouse,
491 long start, long end);
492 const wxMouseEvent& GetMouseEvent();
497 //---------------------------------------------------------------------------
498 //---------------------------------------------------------------------------
499 // These classes can be derived from in Python and passed through the event
500 // system without loosing anything. They do this by keeping a reference to
501 // themselves and some special case handling in wxPyCallback::EventThunker.
503 class wxPyEvent : public wxEvent {
508 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
510 void SetSelf(PyObject* self);
515 class wxPyCommandEvent : public wxCommandEvent {
517 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
520 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
522 void SetSelf(PyObject* self);
529 //---------------------------------------------------------------------------
530 //---------------------------------------------------------------------------