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 wxMouseCaptureChangedEvent : public wxEvent
199 wxMouseCaptureChangedEvent(wxWindowID id = 0, wxWindow* gainedCapture = NULL);
200 wxWindow* GetCapturedWindow() const;
203 //---------------------------------------------------------------------------
205 class wxKeyEvent: public wxEvent {
207 wxKeyEvent(int keyEventType);
218 // get the raw key code (platform-dependent)
219 long GetRawKeyCode() const;
221 // get the raw key flags (platform-dependent)
222 long GetRawKeyFlags() const;
226 wxPoint GetPosition();
227 %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
241 //---------------------------------------------------------------------------
243 class wxNavigationKeyEvent : public wxEvent {
245 wxNavigationKeyEvent();
248 void SetDirection(bool bForward);
249 bool IsWindowChange();
250 void SetWindowChange(bool bIs);
251 wxWindow* GetCurrentFocus();
252 void SetCurrentFocus(wxWindow *win);
256 //---------------------------------------------------------------------------
258 class wxMoveEvent: public wxEvent {
260 wxMoveEvent(const wxPoint& pt, int id = 0);
262 wxPoint GetPosition();
265 //---------------------------------------------------------------------------
267 class wxPaintEvent: public wxEvent {
269 wxPaintEvent(int id = 0);
273 //---------------------------------------------------------------------------
275 class wxEraseEvent: public wxEvent {
277 wxEraseEvent(int id = 0, wxDC* dc = NULL);
282 //---------------------------------------------------------------------------
284 class wxFocusEvent: public wxEvent {
286 wxFocusEvent(WXTYPE eventType = 0, int id = 0);
289 //---------------------------------------------------------------------------
291 // wxChildFocusEvent notifies the parent that a child has got the focus: unlike
292 // wxFocusEvent it is propgated upwards the window chain
293 class wxChildFocusEvent : public wxCommandEvent
296 wxChildFocusEvent(wxWindow *win = NULL);
297 wxWindow *GetWindow() const;
301 //---------------------------------------------------------------------------
303 class wxActivateEvent: public wxEvent{
305 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
309 //---------------------------------------------------------------------------
311 class wxInitDialogEvent: public wxEvent {
313 wxInitDialogEvent(int id = 0);
316 //---------------------------------------------------------------------------
318 class wxMenuEvent: public wxEvent {
320 wxMenuEvent(WXTYPE id = 0, int id = 0);
325 //---------------------------------------------------------------------------
327 class wxShowEvent: public wxEvent {
329 wxShowEvent(int id = 0, int show = FALSE);
330 void SetShow(bool show);
334 //---------------------------------------------------------------------------
336 class wxIconizeEvent: public wxEvent {
338 wxIconizeEvent(int id = 0, bool iconized = TRUE);
342 //---------------------------------------------------------------------------
344 class wxMaximizeEvent: public wxEvent {
346 wxMaximizeEvent(int id = 0);
349 //---------------------------------------------------------------------------
351 class wxJoystickEvent: public wxEvent {
353 wxJoystickEvent(int type = wxEVT_NULL,
355 int joystick = wxJOYSTICK1,
357 wxPoint GetPosition();
359 int GetButtonState();
360 int GetButtonChange();
362 void SetJoystick(int stick);
363 void SetButtonState(int state);
364 void SetButtonChange(int change);
365 void SetPosition(const wxPoint& pos);
366 void SetZPosition(int zPos);
370 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
371 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
372 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
375 //---------------------------------------------------------------------------
377 class wxDropFilesEvent: public wxEvent {
379 wxPoint GetPosition();
380 int GetNumberOfFiles();
383 PyObject* GetFiles() {
384 int count = self->GetNumberOfFiles();
385 wxString* files = self->GetFiles();
386 PyObject* list = PyList_New(count);
389 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
393 for (int i=0; i<count; i++) {
395 PyList_SetItem(list, i, PyUnicode_FromUnicode(files[i], files[i].Len()));
397 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
405 //---------------------------------------------------------------------------
407 class wxIdleEvent: public wxEvent {
410 void RequestMore(bool needMore = TRUE);
411 bool MoreRequested();
414 //---------------------------------------------------------------------------
416 class wxUpdateUIEvent: public wxEvent {
418 wxUpdateUIEvent(wxWindowID commandId = 0);
423 bool GetSetChecked();
424 bool GetSetEnabled();
426 void Check(bool check);
427 void Enable(bool enable);
428 void SetText(const wxString& text);
431 //---------------------------------------------------------------------------
433 class wxSysColourChangedEvent: public wxEvent {
435 wxSysColourChangedEvent();
438 //---------------------------------------------------------------------------
441 class wxNotifyEvent : public wxCommandEvent {
443 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
450 //---------------------------------------------------------------------------
452 class wxDisplayChangedEvent : public wxEvent
455 wxDisplayChangedEvent();
459 //---------------------------------------------------------------------------
461 class wxPaletteChangedEvent : public wxEvent {
463 wxPaletteChangedEvent(wxWindowID id = 0);
465 void SetChangedWindow(wxWindow* win);
466 wxWindow* GetChangedWindow();
470 //---------------------------------------------------------------------------
472 class wxQueryNewPaletteEvent : public wxEvent {
474 wxQueryNewPaletteEvent(wxWindowID id = 0);
476 void SetPaletteRealized(bool realized);
477 bool GetPaletteRealized();
481 //---------------------------------------------------------------------------
483 class wxWindowCreateEvent : public wxCommandEvent {
485 wxWindowCreateEvent(wxWindow *win = NULL);
487 wxWindow *GetWindow();
490 class wxWindowDestroyEvent : public wxCommandEvent {
492 wxWindowDestroyEvent(wxWindow *win = NULL);
494 wxWindow *GetWindow();
497 //---------------------------------------------------------------------------
499 class wxTimerEvent : public wxEvent
502 wxTimerEvent(int id = 0, int interval = 0);
506 //---------------------------------------------------------------------------
508 class wxTextUrlEvent : public wxCommandEvent
511 wxTextUrlEvent(int id, const wxMouseEvent& evtMouse,
512 long start, long end);
513 const wxMouseEvent& GetMouseEvent();
518 //---------------------------------------------------------------------------
519 //---------------------------------------------------------------------------
520 // These classes can be derived from in Python and passed through the event
521 // system without loosing anything. They do this by keeping a reference to
522 // themselves and some special case handling in wxPyCallback::EventThunker.
524 class wxPyEvent : public wxEvent {
529 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
531 void SetSelf(PyObject* self);
536 class wxPyCommandEvent : public wxCommandEvent {
538 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
541 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
543 void SetSelf(PyObject* self);
550 //---------------------------------------------------------------------------
551 //---------------------------------------------------------------------------