X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1b4bff8262c70299a1c9f20548ec3043209616dc..2e18fe7139558b3cb592a04a4e4668319a966ebf:/include/wx/event.h diff --git a/include/wx/event.h b/include/wx/event.h index 16f91819d9..62d3a575a0 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -1244,7 +1244,7 @@ public: { // make sure our string member (which uses COW, aka refcounting) is not // shared by other wxString instances: - SetString(GetString().c_str()); + SetString(GetString().Clone()); } virtual wxEvent *Clone() const @@ -1448,6 +1448,12 @@ private: wxEVT_RIGHT_DCLICK */ +enum wxMouseWheelAxis +{ + wxMOUSE_WHEEL_VERTICAL, + wxMOUSE_WHEEL_HORIZONTAL +}; + class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent, public wxMouseState { @@ -1535,10 +1541,10 @@ public: // should occur for each delta. int GetWheelDelta() const { return m_wheelDelta; } - // Gets the axis the wheel operation concerns, 0 being the y axis as on - // most mouse wheels, 1 is the x axis for things like MightyMouse scrolls - // or horizontal trackpad scrolling - int GetWheelAxis() const { return m_wheelAxis; } + // Gets the axis the wheel operation concerns; wxMOUSE_WHEEL_VERTICAL + // (most common case) or wxMOUSE_WHEEL_HORIZONTAL (for horizontal scrolling + // using e.g. a trackpad). + wxMouseWheelAxis GetWheelAxis() const { return m_wheelAxis; } // Returns the configured number of lines (or whatever) to be scrolled per // wheel action. Defaults to one. @@ -1560,7 +1566,7 @@ public: public: int m_clickCount; - int m_wheelAxis; + wxMouseWheelAxis m_wheelAxis; int m_wheelRotation; int m_wheelDelta; int m_linesPerAction; @@ -1693,10 +1699,10 @@ public: { return wxPoint(m_x, m_y); } // Get X position - wxCoord GetX() const { return m_x; } + wxCoord GetX() const; // Get Y position - wxCoord GetY() const { return m_y; } + wxCoord GetY() const; // Can be called from wxEVT_CHAR_HOOK handler to allow generation of normal // key events even though the event had been handled (by default they would @@ -1760,6 +1766,7 @@ private: { m_x = evt.m_x; m_y = evt.m_y; + m_hasPosition = evt.m_hasPosition; m_keyCode = evt.m_keyCode; @@ -1770,11 +1777,19 @@ private: #endif } + // Initialize m_x and m_y using the current mouse cursor position if + // necessary. + void InitPositionIfNecessary() const; + // If this flag is true, the normal key events should still be generated // even if wxEVT_CHAR_HOOK had been handled. By default it is false as // handling wxEVT_CHAR_HOOK suppresses all the subsequent events. bool m_allowNext; + // If true, m_x and m_y were already initialized. If false, try to get them + // when they're requested. + bool m_hasPosition; + DECLARE_DYNAMIC_CLASS(wxKeyEvent) };