X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0e0977894a66f5b3227d2864becaeae86a5e93c8..9e9574fe45b176ee74bba8fad7574cf9906145d1:/interface/wx/kbdstate.h diff --git a/interface/wx/kbdstate.h b/interface/wx/kbdstate.h index 9a99a7c217..bbc8e4eac7 100644 --- a/interface/wx/kbdstate.h +++ b/interface/wx/kbdstate.h @@ -3,8 +3,7 @@ // Purpose: documentation of wxKeyboardState // Author: wxWidgets team // Created: 2008-09-19 -// RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @@ -15,10 +14,11 @@ information about the modifier keys which were pressed when the event occurred. - This class is implemented entirely inline in @ and thus has + This class is implemented entirely inline in @ and thus has no linking requirements. - @category{misc} + @nolibrary + @category{events} @see wxKeyEvent, wxMouseState */ @@ -26,21 +26,24 @@ class wxKeyboardState { public: /** - Default constructor. + Constructor initializes the modifier key settings. By default, no modifiers are active. */ - wxKeyboardState(); + wxKeyboardState(bool controlDown = false, + bool shiftDown = false, + bool altDown = false, + bool metaDown = false); /** Return the bit mask of all pressed modifier keys. - + The return value is a combination of @c wxMOD_ALT, @c wxMOD_CONTROL, @c wxMOD_SHIFT and @c wxMOD_META bit masks. Additionally, @c wxMOD_NONE - is defined as 0, i.e. corresponds to no modifiers (see HasModifiers()) - and @c wxMOD_CMD is either @c wxMOD_CONTROL (MSW and Unix) or @c - wxMOD_META (Mac), see CmdDown(). See @ref page_keymodifiers for the - full list of modifiers. + is defined as 0, i.e. corresponds to no modifiers (see HasAnyModifiers()) + and @c wxMOD_CMD is either @c wxMOD_CONTROL (MSW and Unix) or + @c wxMOD_META (Mac), see CmdDown(). + See ::wxKeyModifier for the full list of modifiers. Notice that this function is easier to use correctly than, for example, ControlDown() because when using the latter you also have to remember to @@ -69,22 +72,48 @@ public: Returns true if any modifiers at all are pressed. This is equivalent to @c GetModifiers() @c != @c wxMOD_NONE. + + Notice that this is different from HasModifiers() method which doesn't + take e.g. Shift modifier into account. This method is most suitable for + mouse events when any modifier, including Shift, can change the + interpretation of the event. + + @since 2.9.5 + */ + bool HasAnyModifiers() const; + + /** + Returns true if Control or Alt are pressed. + + Checks if Control, Alt or, under OS X only, Command key are pressed + (notice that the real Control key is still taken into account under OS + X too). + + This method returns @false if only Shift is pressed for compatibility + reasons and also because pressing Shift usually doesn't change the + interpretation of key events, see HasAnyModifiers() if you want to + take Shift into account as well. */ bool HasModifiers() const; /** - Returns true if the Control key is pressed. + Returns true if the Control key or Apple/Command key under OS X is pressed. This function doesn't distinguish between right and left control keys. - In portable code you usually want to use CmdDown() to automatically - test for the more frequently used Command key (and not the rarely used - Control one) under Mac. - Notice that GetModifiers() should usually be used instead of this one. */ bool ControlDown() const; + /** + Returns true if the Control key (also under OS X). + + This function doesn't distinguish between right and left control keys. + + Notice that GetModifiers() should usually be used instead of this one. + */ + bool RawControlDown() const; + /** Returns true if the Shift key is pressed. @@ -98,9 +127,7 @@ public: Returns true if the Meta/Windows/Apple key is pressed. This function tests the state of the key traditionally called Meta - under Unix systems, Windows keys under MSW and Apple, or Command, key - under Mac. - + under Unix systems, Windows keys under MSW Notice that GetModifiers() should usually be used instead of this one. @see CmdDown() @@ -115,16 +142,19 @@ public: bool AltDown() const; /** - Returns true if the key used for command accelerators is pressed. - - @c Cmd is a pseudo key which is Control for PC and Unix platforms but - Apple (or Command) key under Macs: it makes often sense to use it - instead of ControlDown() because @c Command key is used for the same - thing under Mac as @c Control elsewhere (even though @c Control still - exists, it is usually not used for the same purpose under Mac). + Returns true if the key used for command accelerators is pressed. Same as + ControlDown(). Deprecated. Notice that GetModifiers() should usually be used instead of this one. */ bool CmdDown() const; + + + void SetControlDown(bool down); + void SetRawControlDown(bool down); + void SetShiftDown(bool down); + void SetAltDown(bool down); + void SetMetaDown(bool down); + };