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);
209 // get the raw key code (platform-dependent)
210 long GetRawKeyCode() const;
212 // get the raw key flags (platform-dependent)
213 long GetRawKeyFlags() const;
217 wxPoint GetPosition();
218 %name(GetPositionTuple) void GetPosition(long* OUTPUT, long* OUTPUT);
232 //---------------------------------------------------------------------------
234 class wxNavigationKeyEvent : public wxEvent {
236 wxNavigationKeyEvent();
239 void SetDirection(bool bForward);
240 bool IsWindowChange();
241 void SetWindowChange(bool bIs);
242 wxWindow* GetCurrentFocus();
243 void SetCurrentFocus(wxWindow *win);
247 //---------------------------------------------------------------------------
249 class wxMoveEvent: public wxEvent {
251 wxMoveEvent(const wxPoint& pt, int id = 0);
253 wxPoint GetPosition();
256 //---------------------------------------------------------------------------
258 class wxPaintEvent: public wxEvent {
260 wxPaintEvent(int id = 0);
264 //---------------------------------------------------------------------------
266 class wxEraseEvent: public wxEvent {
268 wxEraseEvent(int id = 0, wxDC* dc = NULL);
273 //---------------------------------------------------------------------------
275 class wxFocusEvent: public wxEvent {
277 wxFocusEvent(WXTYPE eventType = 0, int id = 0);
280 //---------------------------------------------------------------------------
282 // wxChildFocusEvent notifies the parent that a child has got the focus: unlike
283 // wxFocusEvent it is propgated upwards the window chain
284 class wxChildFocusEvent : public wxCommandEvent
287 wxChildFocusEvent(wxWindow *win = NULL);
288 wxWindow *GetWindow() const;
292 //---------------------------------------------------------------------------
294 class wxActivateEvent: public wxEvent{
296 wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0);
300 //---------------------------------------------------------------------------
302 class wxInitDialogEvent: public wxEvent {
304 wxInitDialogEvent(int id = 0);
307 //---------------------------------------------------------------------------
309 class wxMenuEvent: public wxEvent {
311 wxMenuEvent(WXTYPE id = 0, int id = 0);
316 //---------------------------------------------------------------------------
318 class wxShowEvent: public wxEvent {
320 wxShowEvent(int id = 0, int show = FALSE);
321 void SetShow(bool show);
325 //---------------------------------------------------------------------------
327 class wxIconizeEvent: public wxEvent {
329 wxIconizeEvent(int id = 0, bool iconized = TRUE);
333 //---------------------------------------------------------------------------
335 class wxMaximizeEvent: public wxEvent {
337 wxMaximizeEvent(int id = 0);
340 //---------------------------------------------------------------------------
342 class wxJoystickEvent: public wxEvent {
344 wxJoystickEvent(int type = wxEVT_NULL,
346 int joystick = wxJOYSTICK1,
348 wxPoint GetPosition();
350 int GetButtonState();
351 int GetButtonChange();
353 void SetJoystick(int stick);
354 void SetButtonState(int state);
355 void SetButtonChange(int change);
356 void SetPosition(const wxPoint& pos);
357 void SetZPosition(int zPos);
361 bool ButtonDown(int but = wxJOY_BUTTON_ANY);
362 bool ButtonUp(int but = wxJOY_BUTTON_ANY);
363 bool ButtonIsDown(int but = wxJOY_BUTTON_ANY);
366 //---------------------------------------------------------------------------
368 class wxDropFilesEvent: public wxEvent {
370 wxPoint GetPosition();
371 int GetNumberOfFiles();
374 PyObject* GetFiles() {
375 int count = self->GetNumberOfFiles();
376 wxString* files = self->GetFiles();
377 PyObject* list = PyList_New(count);
380 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
384 for (int i=0; i<count; i++) {
386 PyList_SetItem(list, i, PyUnicode_FromUnicode(files[i], files[i].Len()));
388 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
396 //---------------------------------------------------------------------------
398 class wxIdleEvent: public wxEvent {
401 void RequestMore(bool needMore = TRUE);
402 bool MoreRequested();
405 //---------------------------------------------------------------------------
407 class wxUpdateUIEvent: public wxEvent {
409 wxUpdateUIEvent(wxWindowID commandId = 0);
414 bool GetSetChecked();
415 bool GetSetEnabled();
417 void Check(bool check);
418 void Enable(bool enable);
419 void SetText(const wxString& text);
422 //---------------------------------------------------------------------------
424 class wxSysColourChangedEvent: public wxEvent {
426 wxSysColourChangedEvent();
429 //---------------------------------------------------------------------------
432 class wxNotifyEvent : public wxCommandEvent {
434 wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
441 //---------------------------------------------------------------------------
443 class wxDisplayChangedEvent : public wxEvent
446 wxDisplayChangedEvent();
450 //---------------------------------------------------------------------------
452 class wxPaletteChangedEvent : public wxEvent {
454 wxPaletteChangedEvent(wxWindowID id = 0);
456 void SetChangedWindow(wxWindow* win);
457 wxWindow* GetChangedWindow();
461 //---------------------------------------------------------------------------
463 class wxQueryNewPaletteEvent : public wxEvent {
465 wxQueryNewPaletteEvent(wxWindowID id = 0);
467 void SetPaletteRealized(bool realized);
468 bool GetPaletteRealized();
472 //---------------------------------------------------------------------------
474 class wxWindowCreateEvent : public wxCommandEvent {
476 wxWindowCreateEvent(wxWindow *win = NULL);
478 wxWindow *GetWindow();
481 class wxWindowDestroyEvent : public wxCommandEvent {
483 wxWindowDestroyEvent(wxWindow *win = NULL);
485 wxWindow *GetWindow();
488 //---------------------------------------------------------------------------
490 class wxTimerEvent : public wxEvent
493 wxTimerEvent(int id = 0, int interval = 0);
497 //---------------------------------------------------------------------------
499 class wxTextUrlEvent : public wxCommandEvent
502 wxTextUrlEvent(int id, const wxMouseEvent& evtMouse,
503 long start, long end);
504 const wxMouseEvent& GetMouseEvent();
509 //---------------------------------------------------------------------------
510 //---------------------------------------------------------------------------
511 // These classes can be derived from in Python and passed through the event
512 // system without loosing anything. They do this by keeping a reference to
513 // themselves and some special case handling in wxPyCallback::EventThunker.
515 class wxPyEvent : public wxEvent {
520 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
522 void SetSelf(PyObject* self);
527 class wxPyCommandEvent : public wxCommandEvent {
529 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
532 %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
534 void SetSelf(PyObject* self);
541 //---------------------------------------------------------------------------
542 //---------------------------------------------------------------------------