X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0e0977894a66f5b3227d2864becaeae86a5e93c8..6968a3b87cee46f5c5af9b46e1ef97f17133cef7:/include/wx/kbdstate.h?ds=sidebyside diff --git a/include/wx/kbdstate.h b/include/wx/kbdstate.h index b3a44e88c0..71e196db3c 100644 --- a/include/wx/kbdstate.h +++ b/include/wx/kbdstate.h @@ -20,11 +20,17 @@ class WXDLLIMPEXP_CORE wxKeyboardState { public: - wxKeyboardState() - : m_controlDown(false), - m_shiftDown(false), - m_altDown(false), - m_metaDown(false) + wxKeyboardState(bool controlDown = false, + bool shiftDown = false, + bool altDown = false, + bool metaDown = false) + : m_controlDown(controlDown), + m_shiftDown(shiftDown), + m_altDown(altDown), + m_metaDown(metaDown) +#ifdef __WXOSX__ + ,m_rawControlDown(false) +#endif { } @@ -42,14 +48,32 @@ public: return (m_controlDown ? wxMOD_CONTROL : 0) | (m_shiftDown ? wxMOD_SHIFT : 0) | (m_metaDown ? wxMOD_META : 0) | +#ifdef __WXOSX__ + (m_rawControlDown ? wxMOD_RAW_CONTROL : 0) | +#endif (m_altDown ? wxMOD_ALT : 0); } // returns true if any modifiers at all are pressed - bool HasModifiers() const { return GetModifiers() != wxMOD_NONE; } + bool HasAnyModifiers() const { return GetModifiers() != wxMOD_NONE; } + + // returns true if any modifiers changing the usual key interpretation are + // pressed, notably excluding Shift + bool HasModifiers() const + { + return ControlDown() || RawControlDown() || AltDown(); + } // accessors for individual modifier keys bool ControlDown() const { return m_controlDown; } + bool RawControlDown() const + { +#ifdef __WXOSX__ + return m_rawControlDown; +#else + return m_controlDown; +#endif + } bool ShiftDown() const { return m_shiftDown; } bool MetaDown() const { return m_metaDown; } bool AltDown() const { return m_altDown; } @@ -61,17 +85,21 @@ public: // purpose under Mac) bool CmdDown() const { -#if defined(__WXMAC__) || defined(__WXCOCOA__) - return MetaDown(); -#else return ControlDown(); -#endif } // these functions are mostly used by wxWidgets itself // --------------------------------------------------- void SetControlDown(bool down) { m_controlDown = down; } + void SetRawControlDown(bool down) + { +#ifdef __WXOSX__ + m_rawControlDown = down; +#else + m_controlDown = down; +#endif + } void SetShiftDown(bool down) { m_shiftDown = down; } void SetAltDown(bool down) { m_altDown = down; } void SetMetaDown(bool down) { m_metaDown = down; } @@ -81,10 +109,13 @@ public: // members of wxKeyEvent directly, these variables are public, however you // should not use them in any new code, please use the accessors instead public: - bool m_controlDown : 1; - bool m_shiftDown : 1; - bool m_altDown : 1; - bool m_metaDown : 1; + bool m_controlDown : 1; + bool m_shiftDown : 1; + bool m_altDown : 1; + bool m_metaDown : 1; +#ifdef __WXOSX__ + bool m_rawControlDown : 1; +#endif }; #endif // _WX_KBDSTATE_H_