|
JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins
« « « Anklang Documentation |
Represents the state of the mouse buttons and modifier keys. More...
#include "juce_ModifierKeys.h"
Public Types | |
| enum | Flags { noModifiers , shiftModifier , ctrlModifier , altModifier , leftButtonModifier , rightButtonModifier , middleButtonModifier , commandModifier , popupMenuClickModifier , allKeyboardModifiers , allMouseButtonModifiers , ctrlAltCommandModifiers } |
| Flags that represent the different keys. More... | |
Public Member Functions | |
| ModifierKeys ()=default | |
| Creates a ModifierKeys object with no flags set. | |
| ModifierKeys (int flags) noexcept | |
| Creates a ModifierKeys object from a raw set of flags. | |
| ModifierKeys (const ModifierKeys &)=default | |
| Creates a copy of another object. | |
| ModifierKeys & | operator= (const ModifierKeys &)=default |
| Copies this object from another one. | |
| bool | isCommandDown () const noexcept |
| Checks whether the 'command' key flag is set (or 'ctrl' on Windows/Linux). | |
| bool | isPopupMenu () const noexcept |
| Checks whether the user is trying to launch a pop-up menu. | |
| bool | isLeftButtonDown () const noexcept |
| Checks whether the flag is set for the left mouse-button. | |
| bool | isRightButtonDown () const noexcept |
| Checks whether the flag is set for the right mouse-button. | |
| bool | isMiddleButtonDown () const noexcept |
| bool | isAnyMouseButtonDown () const noexcept |
| Tests for any of the mouse-button flags. | |
| bool | isAnyModifierKeyDown () const noexcept |
| Tests for any of the modifier key flags. | |
| bool | isShiftDown () const noexcept |
| Checks whether the shift key's flag is set. | |
| bool | isCtrlDown () const noexcept |
| Checks whether the CTRL key's flag is set. | |
| bool | isAltDown () const noexcept |
| Checks whether the ALT key's flag is set. | |
| ModifierKeys | withOnlyMouseButtons () const noexcept |
| Returns a copy of only the mouse-button flags. | |
| ModifierKeys | withoutMouseButtons () const noexcept |
| Returns a copy of only the non-mouse flags. | |
| bool | operator== (const ModifierKeys other) const noexcept |
| bool | operator!= (const ModifierKeys other) const noexcept |
| int | getRawFlags () const noexcept |
| Returns the raw flags for direct testing. | |
| ModifierKeys | withoutFlags (int rawFlagsToClear) const noexcept |
| ModifierKeys | withFlags (int rawFlagsToSet) const noexcept |
| bool | testFlags (int flagsToTest) const noexcept |
| Tests a combination of flags and returns true if any of them are set. | |
| int | getNumMouseButtonsDown () const noexcept |
| Returns the total number of mouse buttons that are down. | |
Static Public Member Functions | |
| static ModifierKeys | getCurrentModifiers () noexcept |
| Creates a ModifierKeys object to represent the last-known state of the keyboard and mouse buttons. | |
| static ModifierKeys | getCurrentModifiersRealtime () noexcept |
| Creates a ModifierKeys object to represent the current state of the keyboard and mouse buttons. | |
Static Public Attributes | |
| static ModifierKeys | currentModifiers |
| This object represents the last-known state of the keyboard and mouse buttons. | |
Represents the state of the mouse buttons and modifier keys.
This is used both by mouse events and by KeyPress objects to describe the state of keys such as shift, control, alt, etc.
@tags{GUI}
Definition at line 40 of file juce_ModifierKeys.h.
Flags that represent the different keys.
Definition at line 115 of file juce_ModifierKeys.h.
|
noexcept |
Creates a ModifierKeys object from a raw set of flags.
| flags | to represent the keys that are down |
Definition at line 31 of file juce_ModifierKeys.cpp.
|
staticnoexcept |
Creates a ModifierKeys object to represent the last-known state of the keyboard and mouse buttons.
This method is here for backwards compatibility and there's no need to call it anymore, you should use the public currentModifiers member directly.
Definition at line 197 of file juce_ModifierKeys.h.
|
staticnoexcept |
Creates a ModifierKeys object to represent the current state of the keyboard and mouse buttons.
This method is here for backwards compatibility and you should call ComponentPeer::getCurrentModifiersRealtime() instead (which is what this method now does).
Definition at line 44 of file juce_ModifierKeys.cpp.
|
noexcept |
Returns the total number of mouse buttons that are down.
Definition at line 33 of file juce_ModifierKeys.cpp.
|
noexcept |
Returns the raw flags for direct testing.
Definition at line 176 of file juce_ModifierKeys.h.
|
noexcept |
Checks whether the ALT key's flag is set.
Definition at line 111 of file juce_ModifierKeys.h.
|
noexcept |
Tests for any of the modifier key flags.
Definition at line 96 of file juce_ModifierKeys.h.
|
noexcept |
Tests for any of the mouse-button flags.
Definition at line 93 of file juce_ModifierKeys.h.
|
noexcept |
Checks whether the 'command' key flag is set (or 'ctrl' on Windows/Linux).
This is a platform-agnostic way of checking for the operating system's preferred command-key modifier - so on the Mac it tests for the cmd key, on Windows/Linux, it's actually checking for the CTRL key.
Definition at line 68 of file juce_ModifierKeys.h.
|
noexcept |
Checks whether the CTRL key's flag is set.
Remember that it's better to use the platform-agnostic routines to test for command-key and popup-menu modifiers.
Definition at line 108 of file juce_ModifierKeys.h.
|
noexcept |
Checks whether the flag is set for the left mouse-button.
Definition at line 81 of file juce_ModifierKeys.h.
|
noexcept |
Definition at line 90 of file juce_ModifierKeys.h.
|
noexcept |
Checks whether the user is trying to launch a pop-up menu.
This checks for platform-specific modifiers that might indicate that the user is following the operating system's normal method of showing a pop-up menu.
So on Windows/Linux, this method is really testing for a right-click. On the Mac, it tests for either the CTRL key being down, or a right-click.
Definition at line 78 of file juce_ModifierKeys.h.
|
noexcept |
Checks whether the flag is set for the right mouse-button.
Note that for detecting popup-menu clicks, you should be using isPopupMenu() instead, as this is platform-independent (and makes your code more explanatory too).
Definition at line 88 of file juce_ModifierKeys.h.
|
noexcept |
Checks whether the shift key's flag is set.
Definition at line 99 of file juce_ModifierKeys.h.
|
noexcept |
Definition at line 172 of file juce_ModifierKeys.h.
|
noexcept |
Definition at line 171 of file juce_ModifierKeys.h.
Tests a combination of flags and returns true if any of them are set.
Definition at line 182 of file juce_ModifierKeys.h.
|
noexcept |
Definition at line 179 of file juce_ModifierKeys.h.
|
noexcept |
Returns a copy of only the mouse-button flags.
Definition at line 166 of file juce_ModifierKeys.h.
|
noexcept |
Definition at line 178 of file juce_ModifierKeys.h.
|
noexcept |
Returns a copy of only the non-mouse flags.
Definition at line 169 of file juce_ModifierKeys.h.
|
static |
This object represents the last-known state of the keyboard and mouse buttons.
Definition at line 189 of file juce_ModifierKeys.h.