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++) {
378 PyList_SetItem(list, i, PyUnicode_FromUnicode(files[i], files[i].Len()));
380 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
388 //---------------------------------------------------------------------------
390 class wxIdleEvent: public wxEvent {
393 void RequestMore(bool needMore = TRUE);
394 bool MoreRequested();
397 //---------------------------------------------------------------------------
399 class wxUpdateUIEvent: public wxEvent {
401 wxUpdateUIEvent(wxWindowID commandId = 0);
406 bool GetSetChecked();
407 bool GetSetEnabled();
409 void Check(bool check);
410 void Enable(bool enable);
411 void SetText(const wxString& text);
414 //---------------------------------------------------------------------------
416 class wxSysColourChangedEvent: public wxEvent {
418 wxSysColourChangedEvent();
421 //---------------------------------------------------------------------------
424 class wxNotifyEvent : public wxCommandEvent {
426 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
433 //---------------------------------------------------------------------------
435 class wxDisplayChangedEvent : public wxEvent
438 wxDisplayChangedEvent();
442 //---------------------------------------------------------------------------
444 class wxPaletteChangedEvent : public wxEvent {
446 wxPaletteChangedEvent(wxWindowID id = 0);
448 void SetChangedWindow(wxWindow* win);
449 wxWindow* GetChangedWindow();
453 //---------------------------------------------------------------------------
455 class wxQueryNewPaletteEvent : public wxEvent {
457 wxQueryNewPaletteEvent(wxWindowID id = 0);
459 void SetPaletteRealized(bool realized);
460 bool GetPaletteRealized();
464 //---------------------------------------------------------------------------
466 class wxWindowCreateEvent : public wxCommandEvent {
468 wxWindowCreateEvent(wxWindow *win = NULL);
470 wxWindow *GetWindow();
473 class wxWindowDestroyEvent : public wxCommandEvent {
475 wxWindowDestroyEvent(wxWindow *win = NULL);
477 wxWindow *GetWindow();
480 //---------------------------------------------------------------------------
482 class wxTimerEvent : public wxEvent
485 wxTimerEvent(int id = 0, int interval = 0);
489 //---------------------------------------------------------------------------
491 class wxTextUrlEvent : public wxCommandEvent
494 wxTextUrlEvent(int id, const wxMouseEvent& evtMouse,
495 long start, long end);
496 const wxMouseEvent& GetMouseEvent();
501 //---------------------------------------------------------------------------
502 //---------------------------------------------------------------------------
503 // These classes can be derived from in Python and passed through the event
504 // system without loosing anything. They do this by keeping a reference to
505 // themselves and some special case handling in wxPyCallback::EventThunker.
507 class wxPyEvent : public wxEvent {
512 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
514 void SetSelf(PyObject* self);
519 class wxPyCommandEvent : public wxCommandEvent {
521 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
524 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
526 void SetSelf(PyObject* self);
533 //---------------------------------------------------------------------------
534 //---------------------------------------------------------------------------