Represents a key press, including any modifier keys that are needed.
More...
#include <juce_KeyPress.h>
|
static const int | spaceKey |
| key-code for the space bar
|
|
static const int | escapeKey |
| key-code for the escape key
|
|
static const int | returnKey |
| key-code for the return key
|
|
static const int | tabKey |
| key-code for the tab key
|
|
static const int | deleteKey |
| key-code for the delete key (not backspace)
|
|
static const int | backspaceKey |
| key-code for the backspace key
|
|
static const int | insertKey |
| key-code for the insert key
|
|
static const int | upKey |
| key-code for the cursor-up key
|
|
static const int | downKey |
| key-code for the cursor-down key
|
|
static const int | leftKey |
| key-code for the cursor-left key
|
|
static const int | rightKey |
| key-code for the cursor-right key
|
|
static const int | pageUpKey |
| key-code for the page-up key
|
|
static const int | pageDownKey |
| key-code for the page-down key
|
|
static const int | homeKey |
| key-code for the home key
|
|
static const int | endKey |
| key-code for the end key
|
|
static const int | F1Key |
| key-code for the F1 key
|
|
static const int | F2Key |
| key-code for the F2 key
|
|
static const int | F3Key |
| key-code for the F3 key
|
|
static const int | F4Key |
| key-code for the F4 key
|
|
static const int | F5Key |
| key-code for the F5 key
|
|
static const int | F6Key |
| key-code for the F6 key
|
|
static const int | F7Key |
| key-code for the F7 key
|
|
static const int | F8Key |
| key-code for the F8 key
|
|
static const int | F9Key |
| key-code for the F9 key
|
|
static const int | F10Key |
| key-code for the F10 key
|
|
static const int | F11Key |
| key-code for the F11 key
|
|
static const int | F12Key |
| key-code for the F12 key
|
|
static const int | F13Key |
| key-code for the F13 key
|
|
static const int | F14Key |
| key-code for the F14 key
|
|
static const int | F15Key |
| key-code for the F15 key
|
|
static const int | F16Key |
| key-code for the F16 key
|
|
static const int | F17Key |
| key-code for the F17 key
|
|
static const int | F18Key |
| key-code for the F18 key
|
|
static const int | F19Key |
| key-code for the F19 key
|
|
static const int | F20Key |
| key-code for the F20 key
|
|
static const int | F21Key |
| key-code for the F21 key
|
|
static const int | F22Key |
| key-code for the F22 key
|
|
static const int | F23Key |
| key-code for the F23 key
|
|
static const int | F24Key |
| key-code for the F24 key
|
|
static const int | F25Key |
| key-code for the F25 key
|
|
static const int | F26Key |
| key-code for the F26 key
|
|
static const int | F27Key |
| key-code for the F27 key
|
|
static const int | F28Key |
| key-code for the F28 key
|
|
static const int | F29Key |
| key-code for the F29 key
|
|
static const int | F30Key |
| key-code for the F30 key
|
|
static const int | F31Key |
| key-code for the F31 key
|
|
static const int | F32Key |
| key-code for the F32 key
|
|
static const int | F33Key |
| key-code for the F33 key
|
|
static const int | F34Key |
| key-code for the F34 key
|
|
static const int | F35Key |
| key-code for the F35 key
|
|
static const int | numberPad0 |
| key-code for the 0 on the numeric keypad.
|
|
static const int | numberPad1 |
| key-code for the 1 on the numeric keypad.
|
|
static const int | numberPad2 |
| key-code for the 2 on the numeric keypad.
|
|
static const int | numberPad3 |
| key-code for the 3 on the numeric keypad.
|
|
static const int | numberPad4 |
| key-code for the 4 on the numeric keypad.
|
|
static const int | numberPad5 |
| key-code for the 5 on the numeric keypad.
|
|
static const int | numberPad6 |
| key-code for the 6 on the numeric keypad.
|
|
static const int | numberPad7 |
| key-code for the 7 on the numeric keypad.
|
|
static const int | numberPad8 |
| key-code for the 8 on the numeric keypad.
|
|
static const int | numberPad9 |
| key-code for the 9 on the numeric keypad.
|
|
static const int | numberPadAdd |
| key-code for the add sign on the numeric keypad.
|
|
static const int | numberPadSubtract |
| key-code for the subtract sign on the numeric keypad.
|
|
static const int | numberPadMultiply |
| key-code for the multiply sign on the numeric keypad.
|
|
static const int | numberPadDivide |
| key-code for the divide sign on the numeric keypad.
|
|
static const int | numberPadSeparator |
| key-code for the comma on the numeric keypad.
|
|
static const int | numberPadDecimalPoint |
| key-code for the decimal point sign on the numeric keypad.
|
|
static const int | numberPadEquals |
| key-code for the equals key on the numeric keypad.
|
|
static const int | numberPadDelete |
| key-code for the delete key on the numeric keypad.
|
|
static const int | playKey |
| key-code for a multimedia 'play' key, (not all keyboards will have one)
|
|
static const int | stopKey |
| key-code for a multimedia 'stop' key, (not all keyboards will have one)
|
|
static const int | fastForwardKey |
| key-code for a multimedia 'fast-forward' key, (not all keyboards will have one)
|
|
static const int | rewindKey |
| key-code for a multimedia 'rewind' key, (not all keyboards will have one)
|
|
Represents a key press, including any modifier keys that are needed.
E.g. a KeyPress might represent CTRL+C, SHIFT+ALT+H, Spacebar, Escape, etc.
- See also
- Component, KeyListener, KeyPressMappingSet, Button::addShortcut
◆ KeyPress() [1/4]
◆ ~KeyPress()
◆ KeyPress() [2/4]
Creates a KeyPress for a key and some modifiers.
e.g. CTRL+C would be: KeyPress ('c', ModifierKeys::ctrlModifier, 0) SHIFT+Escape would be: KeyPress (KeyPress::escapeKey, ModifierKeys::shiftModifier, 0)
- Parameters
-
keyCode | a code that represents the key - this value must be one of special constants listed in this class, or an 8-bit character code such as a letter (case is ignored), digit or a simple key like "," or ".". Note that this isn't the same as the textCharacter parameter, so for example a keyCode of 'a' and a shift-key modifier should have a textCharacter value of 'A'. |
modifiers | the modifiers to associate with the keystroke |
textCharacter | the character that would be printed if someone typed this keypress into a text editor. This value may be null if the keypress is a non-printing character |
- See also
- getKeyCode, isKeyCode, getModifiers
◆ KeyPress() [3/4]
KeyPress::KeyPress |
( |
int | keyCode | ) |
|
|
explicitnoexcept |
Creates a keypress with a keyCode but no modifiers or text character.
◆ KeyPress() [4/4]
◆ operator=()
◆ operator==() [1/2]
bool KeyPress::operator== |
( |
const KeyPress & | other | ) |
const |
|
noexcept |
◆ operator!=() [1/2]
bool KeyPress::operator!= |
( |
const KeyPress & | other | ) |
const |
|
noexcept |
◆ operator==() [2/2]
bool KeyPress::operator== |
( |
int | keyCode | ) |
const |
|
noexcept |
Returns true if this keypress is for the given keycode without any modifiers.
◆ operator!=() [2/2]
bool KeyPress::operator!= |
( |
int | keyCode | ) |
const |
|
noexcept |
Returns true if this keypress is not for the given keycode without any modifiers.
◆ isValid()
bool KeyPress::isValid |
( |
| ) |
const |
|
noexcept |
Returns true if this is a valid KeyPress.
A null keypress can be created by the default constructor, in case it's needed.
◆ getKeyCode()
int KeyPress::getKeyCode |
( |
| ) |
const |
|
noexcept |
Returns the key code itself.
This will either be one of the special constants defined in this class, or an 8-bit character code.
◆ getModifiers()
◆ getTextCharacter()
Returns the character that is associated with this keypress.
This is the character that you'd expect to see printed if you press this keypress in a text editor or similar component.
◆ isKeyCode()
bool KeyPress::isKeyCode |
( |
int | keyCodeToCompare | ) |
const |
|
noexcept |
Checks whether the KeyPress's key is the same as the one provided, without checking the modifiers.
The values for key codes can either be one of the special constants defined in this class, or an 8-bit character code.
- See also
- getKeyCode
◆ createFromDescription()
static KeyPress KeyPress::createFromDescription |
( |
const String & | textVersion | ) |
|
|
static |
Converts a textual key description to a KeyPress.
This attempts to decode a textual version of a keypress, e.g. "ctrl + c" or "spacebar".
This isn't designed to cope with any kind of input, but should be given the strings that are created by the getTextDescription() method.
If the string can't be parsed, the object returned will be invalid.
- See also
- getTextDescription
◆ getTextDescription()
String KeyPress::getTextDescription |
( |
| ) |
const |
Creates a textual description of the key combination.
e.g. "ctrl + c" or "delete".
To store a keypress in a file, use this method, along with createFromDescription() to retrieve it later.
◆ getTextDescriptionWithIcons()
String KeyPress::getTextDescriptionWithIcons |
( |
| ) |
const |
Creates a textual description of the key combination, using unicode icon symbols if possible.
On OSX, this uses the Apple symbols for command, option, shift, etc, instead of the textual modifier key descriptions that are returned by getTextDescription()
◆ isCurrentlyDown()
bool KeyPress::isCurrentlyDown |
( |
| ) |
const |
Checks whether the user is currently holding down the keys that make up this KeyPress.
Note that this will return false if any extra modifier keys are down - e.g. if the keypress is CTRL+X and the user is actually holding CTRL+ALT+x then it will be false.
◆ isKeyCurrentlyDown()
static bool KeyPress::isKeyCurrentlyDown |
( |
int | keyCode | ) |
|
|
static |
Checks whether a particular key is held down, irrespective of modifiers.
The values for key codes can either be one of the special constants defined in this class, or an 8-bit character code.
◆ spaceKey
const int KeyPress::spaceKey |
|
static |
key-code for the space bar
◆ escapeKey
const int KeyPress::escapeKey |
|
static |
key-code for the escape key
◆ returnKey
const int KeyPress::returnKey |
|
static |
key-code for the return key
◆ tabKey
const int KeyPress::tabKey |
|
static |
◆ deleteKey
const int KeyPress::deleteKey |
|
static |
◆ backspaceKey
const int KeyPress::backspaceKey |
|
static |
◆ insertKey
const int KeyPress::insertKey |
|
static |
◆ upKey
const int KeyPress::upKey |
|
static |
◆ downKey
const int KeyPress::downKey |
|
static |
◆ leftKey
const int KeyPress::leftKey |
|
static |
◆ rightKey
const int KeyPress::rightKey |
|
static |
◆ pageUpKey
const int KeyPress::pageUpKey |
|
static |
◆ pageDownKey
const int KeyPress::pageDownKey |
|
static |
◆ homeKey
const int KeyPress::homeKey |
|
static |
◆ endKey
const int KeyPress::endKey |
|
static |
◆ F1Key
const int KeyPress::F1Key |
|
static |
◆ F2Key
const int KeyPress::F2Key |
|
static |
◆ F3Key
const int KeyPress::F3Key |
|
static |
◆ F4Key
const int KeyPress::F4Key |
|
static |
◆ F5Key
const int KeyPress::F5Key |
|
static |
◆ F6Key
const int KeyPress::F6Key |
|
static |
◆ F7Key
const int KeyPress::F7Key |
|
static |
◆ F8Key
const int KeyPress::F8Key |
|
static |
◆ F9Key
const int KeyPress::F9Key |
|
static |
◆ F10Key
const int KeyPress::F10Key |
|
static |
◆ F11Key
const int KeyPress::F11Key |
|
static |
◆ F12Key
const int KeyPress::F12Key |
|
static |
◆ F13Key
const int KeyPress::F13Key |
|
static |
◆ F14Key
const int KeyPress::F14Key |
|
static |
◆ F15Key
const int KeyPress::F15Key |
|
static |
◆ F16Key
const int KeyPress::F16Key |
|
static |
◆ F17Key
const int KeyPress::F17Key |
|
static |
◆ F18Key
const int KeyPress::F18Key |
|
static |
◆ F19Key
const int KeyPress::F19Key |
|
static |
◆ F20Key
const int KeyPress::F20Key |
|
static |
◆ F21Key
const int KeyPress::F21Key |
|
static |
◆ F22Key
const int KeyPress::F22Key |
|
static |
◆ F23Key
const int KeyPress::F23Key |
|
static |
◆ F24Key
const int KeyPress::F24Key |
|
static |
◆ F25Key
const int KeyPress::F25Key |
|
static |
◆ F26Key
const int KeyPress::F26Key |
|
static |
◆ F27Key
const int KeyPress::F27Key |
|
static |
◆ F28Key
const int KeyPress::F28Key |
|
static |
◆ F29Key
const int KeyPress::F29Key |
|
static |
◆ F30Key
const int KeyPress::F30Key |
|
static |
◆ F31Key
const int KeyPress::F31Key |
|
static |
◆ F32Key
const int KeyPress::F32Key |
|
static |
◆ F33Key
const int KeyPress::F33Key |
|
static |
◆ F34Key
const int KeyPress::F34Key |
|
static |
◆ F35Key
const int KeyPress::F35Key |
|
static |
◆ numberPad0
const int KeyPress::numberPad0 |
|
static |
key-code for the 0 on the numeric keypad.
◆ numberPad1
const int KeyPress::numberPad1 |
|
static |
key-code for the 1 on the numeric keypad.
◆ numberPad2
const int KeyPress::numberPad2 |
|
static |
key-code for the 2 on the numeric keypad.
◆ numberPad3
const int KeyPress::numberPad3 |
|
static |
key-code for the 3 on the numeric keypad.
◆ numberPad4
const int KeyPress::numberPad4 |
|
static |
key-code for the 4 on the numeric keypad.
◆ numberPad5
const int KeyPress::numberPad5 |
|
static |
key-code for the 5 on the numeric keypad.
◆ numberPad6
const int KeyPress::numberPad6 |
|
static |
key-code for the 6 on the numeric keypad.
◆ numberPad7
const int KeyPress::numberPad7 |
|
static |
key-code for the 7 on the numeric keypad.
◆ numberPad8
const int KeyPress::numberPad8 |
|
static |
key-code for the 8 on the numeric keypad.
◆ numberPad9
const int KeyPress::numberPad9 |
|
static |
key-code for the 9 on the numeric keypad.
◆ numberPadAdd
const int KeyPress::numberPadAdd |
|
static |
key-code for the add sign on the numeric keypad.
◆ numberPadSubtract
const int KeyPress::numberPadSubtract |
|
static |
key-code for the subtract sign on the numeric keypad.
◆ numberPadMultiply
const int KeyPress::numberPadMultiply |
|
static |
key-code for the multiply sign on the numeric keypad.
◆ numberPadDivide
const int KeyPress::numberPadDivide |
|
static |
key-code for the divide sign on the numeric keypad.
◆ numberPadSeparator
const int KeyPress::numberPadSeparator |
|
static |
key-code for the comma on the numeric keypad.
◆ numberPadDecimalPoint
const int KeyPress::numberPadDecimalPoint |
|
static |
key-code for the decimal point sign on the numeric keypad.
◆ numberPadEquals
const int KeyPress::numberPadEquals |
|
static |
key-code for the equals key on the numeric keypad.
◆ numberPadDelete
const int KeyPress::numberPadDelete |
|
static |
key-code for the delete key on the numeric keypad.
◆ playKey
const int KeyPress::playKey |
|
static |
key-code for a multimedia 'play' key, (not all keyboards will have one)
◆ stopKey
const int KeyPress::stopKey |
|
static |
key-code for a multimedia 'stop' key, (not all keyboards will have one)
◆ fastForwardKey
const int KeyPress::fastForwardKey |
|
static |
key-code for a multimedia 'fast-forward' key, (not all keyboards will have one)
◆ rewindKey
const int KeyPress::rewindKey |
|
static |
key-code for a multimedia 'rewind' key, (not all keyboards will have one)
The documentation for this class was generated from the following file: