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);
 
 307 //---------------------------------------------------------------------------
 
 309 class wxShowEvent: public wxEvent {
 
 311     wxShowEvent(int id = 0, int show = FALSE);
 
 312     void SetShow(bool show);
 
 316 //---------------------------------------------------------------------------
 
 318 class wxIconizeEvent: public wxEvent {
 
 320     wxIconizeEvent(int id = 0, bool iconized = TRUE);
 
 324 //---------------------------------------------------------------------------
 
 326 class wxMaximizeEvent: public wxEvent {
 
 328     wxMaximizeEvent(int id = 0);
 
 331 //---------------------------------------------------------------------------
 
 333 class wxJoystickEvent: public wxEvent {
 
 335     wxJoystickEvent(int type = wxEVT_NULL,
 
 337                     int joystick = wxJOYSTICK1,
 
 339     wxPoint GetPosition();
 
 341     int GetButtonState();
 
 342     int GetButtonChange();
 
 344     void SetJoystick(int stick);
 
 345     void SetButtonState(int state);
 
 346     void SetButtonChange(int change);
 
 347     void SetPosition(const wxPoint& pos);
 
 348     void SetZPosition(int zPos);
 
 352     bool ButtonDown(int but = wxJOY_BUTTON_ANY);
 
 353     bool ButtonUp(int but = wxJOY_BUTTON_ANY);
 
 354     bool ButtonIsDown(int but =  wxJOY_BUTTON_ANY);
 
 357 //---------------------------------------------------------------------------
 
 359 class wxDropFilesEvent: public wxEvent {
 
 361     wxPoint GetPosition();
 
 362     int GetNumberOfFiles();
 
 365         PyObject* GetFiles() {
 
 366             int         count = self->GetNumberOfFiles();
 
 367             wxString*   files = self->GetFiles();
 
 368             PyObject*   list  = PyList_New(count);
 
 371                 PyErr_SetString(PyExc_MemoryError, "Can't allocate list of files!");
 
 375             for (int i=0; i<count; i++) {
 
 376                 PyList_SetItem(list, i, PyString_FromString((const char*)files[i]));
 
 383 //---------------------------------------------------------------------------
 
 385 class wxIdleEvent: public wxEvent {
 
 388     void RequestMore(bool needMore = TRUE);
 
 389     bool MoreRequested();
 
 392 //---------------------------------------------------------------------------
 
 394 class wxUpdateUIEvent: public wxEvent {
 
 396     wxUpdateUIEvent(wxWindowID commandId = 0);
 
 401     bool GetSetChecked();
 
 402     bool GetSetEnabled();
 
 404     void Check(bool check);
 
 405     void Enable(bool enable);
 
 406     void SetText(const wxString& text);
 
 409 //---------------------------------------------------------------------------
 
 411 class wxSysColourChangedEvent: public wxEvent {
 
 413     wxSysColourChangedEvent();
 
 416 //---------------------------------------------------------------------------
 
 419 class wxNotifyEvent : public wxCommandEvent {
 
 421     wxNotifyEvent(int commandType = wxEVT_NULL, int id = 0);
 
 428 //---------------------------------------------------------------------------
 
 430 class  wxPaletteChangedEvent : public wxEvent {
 
 432     wxPaletteChangedEvent(wxWindowID id = 0);
 
 434     void SetChangedWindow(wxWindow* win);
 
 435     wxWindow* GetChangedWindow();
 
 439 //---------------------------------------------------------------------------
 
 441 class  wxQueryNewPaletteEvent : public wxEvent {
 
 443     wxQueryNewPaletteEvent(wxWindowID id = 0);
 
 445     void SetPaletteRealized(bool realized);
 
 446     bool GetPaletteRealized();
 
 450 //---------------------------------------------------------------------------
 
 452 class wxWindowCreateEvent : public wxCommandEvent {
 
 454     wxWindowCreateEvent(wxWindow *win = NULL);
 
 456     wxWindow *GetWindow();
 
 459 class wxWindowDestroyEvent : public wxCommandEvent {
 
 461     wxWindowDestroyEvent(wxWindow *win = NULL);
 
 463     wxWindow *GetWindow();
 
 466 //---------------------------------------------------------------------------
 
 468 class  wxTimerEvent : public wxEvent
 
 471     wxTimerEvent(int id = 0, int interval = 0);
 
 475 //---------------------------------------------------------------------------
 
 477 class wxTextUrlEvent : public wxCommandEvent
 
 480     wxTextUrlEvent(int id, const wxMouseEvent& evtMouse,
 
 481                    long start, long end);
 
 482     const wxMouseEvent& GetMouseEvent();
 
 487 //---------------------------------------------------------------------------
 
 488 //---------------------------------------------------------------------------
 
 489 // These classes can be derived from in Python and passed through the event
 
 490 // system without loosing anything.  They do this by keeping a reference to
 
 491 // themselves and some special case handling in wxPyCallback::EventThunker.
 
 493 class wxPyEvent : public wxEvent {
 
 498     %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
 
 500     void SetSelf(PyObject* self);
 
 505 class wxPyCommandEvent : public wxCommandEvent {
 
 507     wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
 
 510     %pragma(python) addtomethod = "__init__:self.SetSelf(self)"
 
 512     void SetSelf(PyObject* self);
 
 519 //---------------------------------------------------------------------------
 
 520 //---------------------------------------------------------------------------