X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6d26dc89c5e7a421f4f8807728928eee91aa5f7e..704f9c00cdcfd153e351675845da115bf2c4c89b:/wxPython/src/events.i?ds=sidebyside diff --git a/wxPython/src/events.i b/wxPython/src/events.i index 5d2bd07da5..3c825cbaf5 100644 --- a/wxPython/src/events.i +++ b/wxPython/src/events.i @@ -30,9 +30,20 @@ //--------------------------------------------------------------------------- +enum Propagation_state +{ + // don't propagate it at all + wxEVENT_PROPAGATE_NONE = 0, + + // propagate it until it is processed + wxEVENT_PROPAGATE_MAX = INT_MAX +}; + int wxNewEventType(); + + class wxEvent : public wxObject { public: // wxEvent(int id = 0); // *** This class is now an ABC @@ -41,15 +52,52 @@ public: wxObject* GetEventObject(); wxEventType GetEventType(); int GetId(); - bool GetSkipped(); long GetTimestamp(); void SetEventObject(wxObject* object); void SetEventType(wxEventType typ); void SetId(int id); void SetTimestamp(long timeStamp); + + bool IsCommandEvent() const; + + // Can instruct event processor that we wish to ignore this event + // (treat as if the event table entry had not been found): this must be done + // to allow the event processing by the base classes (calling event.Skip() + // is the analog of calling the base class verstion of a virtual function) void Skip(bool skip = TRUE); + bool GetSkipped() const; - wxEvent *Clone(); + // Determine if this event should be propagating to the parent window. + bool ShouldPropagate() const; + + // Stop an event from propagating to its parent window, returns the old + // propagation level value + int StopPropagation(); + + // Resume the event propagation by restoring the propagation level + // (returned by StopPropagation()) + void ResumePropagation(int propagationLevel); + + wxEvent *Clone(); +}; + +//--------------------------------------------------------------------------- + +// Helper class to temporarily change an event not to propagate. +class wxPropagationDisabler +{ +public: + wxPropagationDisabler(wxEvent& event); + ~wxPropagationDisabler(); +}; + + +// Another one to temporarily lower propagation level. +class wxPropagateOnce +{ +public: + wxPropagateOnce(wxEvent& event); + ~wxPropagateOnce(); }; //--------------------------------------------------------------------------- @@ -58,6 +106,8 @@ class wxSizeEvent : public wxEvent { public: wxSizeEvent(const wxSize& sz, int id = 0); wxSize GetSize(); + wxRect GetRect() const; + void SetRect(wxRect rect); }; //--------------------------------------------------------------------------- @@ -202,6 +252,21 @@ public: //--------------------------------------------------------------------------- +class wxSetCursorEvent : public wxEvent +{ +public: + wxSetCursorEvent(wxCoord x = 0, wxCoord y = 0); + + wxCoord GetX() const; + wxCoord GetY() const; + + void SetCursor(const wxCursor& cursor); + const wxCursor& GetCursor() const; + bool HasCursor() const; +}; + +//--------------------------------------------------------------------------- + class wxKeyEvent: public wxEvent { public: wxKeyEvent(int keyEventType); @@ -210,9 +275,9 @@ public: bool MetaDown(); bool AltDown(); bool ShiftDown(); - long KeyCode(); long GetKeyCode(); + %pragma(python) addtoclass = "KeyCode = GetKeyCode" bool HasModifiers(); // get the raw key code (platform-dependent) @@ -258,8 +323,9 @@ public: class wxMoveEvent: public wxEvent { public: wxMoveEvent(const wxPoint& pt, int id = 0); - wxPoint GetPosition(); + wxRect GetRect() const; + void SetRect(wxRect rect); }; //--------------------------------------------------------------------------- @@ -283,7 +349,7 @@ public: class wxFocusEvent: public wxEvent { public: - wxFocusEvent(WXTYPE eventType = 0, int id = 0); + wxFocusEvent(int eventType = 0, int id = 0); }; //--------------------------------------------------------------------------- @@ -302,7 +368,7 @@ public: class wxActivateEvent: public wxEvent{ public: - wxActivateEvent(WXTYPE eventType = 0, int active = TRUE, int id = 0); + wxActivateEvent(int eventType = 0, int active = TRUE, int id = 0); bool GetActive(); }; @@ -317,9 +383,10 @@ public: class wxMenuEvent: public wxEvent { public: - wxMenuEvent(WXTYPE id = 0, int id = 0); + wxMenuEvent(int id = 0, int winid = 0, wxMenu* menu = NULL); int GetMenuId(); bool IsPopup(); + wxMenu* GetMenu() const; }; //--------------------------------------------------------------------------- @@ -392,7 +459,7 @@ public: for (int i=0; i