openshot-audio  0.1.6
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
juce::KeyPress Class Reference

#include <juce_gui_basics.h>

Public Member Functions

 KeyPress () noexcept
 
 KeyPress (int keyCode, ModifierKeys modifiers, juce_wchar textCharacter) noexcept
 
 KeyPress (int keyCode) noexcept
 
 KeyPress (const KeyPress &other) noexcept
 
KeyPressoperator= (const KeyPress &other) noexcept
 
bool operator== (const KeyPress &other) const noexcept
 
bool operator!= (const KeyPress &other) const noexcept
 
bool operator== (int keyCode) const noexcept
 
bool operator!= (int keyCode) const noexcept
 
bool isValid () const noexcept
 
int getKeyCode () const noexcept
 
ModifierKeys getModifiers () const noexcept
 
juce_wchar getTextCharacter () const noexcept
 
bool isKeyCode (int keyCodeToCompare) const noexcept
 
String getTextDescription () const
 
String getTextDescriptionWithIcons () const
 
bool isCurrentlyDown () const
 

Static Public Member Functions

static KeyPress createFromDescription (const String &textVersion)
 
static bool isKeyCurrentlyDown (int keyCode)
 

Static Public Attributes

static const int spaceKey
 
static const int escapeKey
 
static const int returnKey
 
static const int tabKey
 
static const int deleteKey
 
static const int backspaceKey
 
static const int insertKey
 
static const int upKey
 
static const int downKey
 
static const int leftKey
 
static const int rightKey
 
static const int pageUpKey
 
static const int pageDownKey
 
static const int homeKey
 
static const int endKey
 
static const int F1Key
 
static const int F2Key
 
static const int F3Key
 
static const int F4Key
 
static const int F5Key
 
static const int F6Key
 
static const int F7Key
 
static const int F8Key
 
static const int F9Key
 
static const int F10Key
 
static const int F11Key
 
static const int F12Key
 
static const int F13Key
 
static const int F14Key
 
static const int F15Key
 
static const int F16Key
 
static const int numberPad0
 
static const int numberPad1
 
static const int numberPad2
 
static const int numberPad3
 
static const int numberPad4
 
static const int numberPad5
 
static const int numberPad6
 
static const int numberPad7
 
static const int numberPad8
 
static const int numberPad9
 
static const int numberPadAdd
 
static const int numberPadSubtract
 
static const int numberPadMultiply
 
static const int numberPadDivide
 
static const int numberPadSeparator
 
static const int numberPadDecimalPoint
 
static const int numberPadEquals
 
static const int numberPadDelete
 
static const int playKey
 
static const int stopKey
 
static const int fastForwardKey
 
static const int rewindKey
 

Detailed Description

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

Constructor & Destructor Documentation

KeyPress::KeyPress ( )
noexcept

Creates an (invalid) KeyPress.

See also
isValid
KeyPress::KeyPress ( int  keyCode,
ModifierKeys  modifiers,
juce_wchar  textCharacter 
)
noexcept

Creates a KeyPress for a key and some modifiers.

e.g. CTRL+C would be: KeyPress ('c', ModifierKeys::ctrlModifier) SHIFT+Escape would be: KeyPress (KeyPress::escapeKey, ModifierKeys::shiftModifier)

Parameters
keyCodea 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'.
modifiersthe modifiers to associate with the keystroke
textCharacterthe 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::KeyPress ( int  keyCode)
explicitnoexcept

Creates a keypress with a keyCode but no modifiers or text character.

KeyPress::KeyPress ( const KeyPress other)
noexcept

Creates a copy of another KeyPress.

Member Function Documentation

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 "SPACE".

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
int juce::KeyPress::getKeyCode ( ) const
inlinenoexcept

Returns the key code itself.

This will either be one of the special constants defined in this class, or an 8-bit character code.

ModifierKeys juce::KeyPress::getModifiers ( ) const
inlinenoexcept

Returns the key modifiers.

See also
ModifierKeys
juce_wchar juce::KeyPress::getTextCharacter ( ) const
inlinenoexcept

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.

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.

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()

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.

bool juce::KeyPress::isKeyCode ( int  keyCodeToCompare) const
inlinenoexcept

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
static bool juce::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.

bool juce::KeyPress::isValid ( ) const
inlinenoexcept

Returns true if this is a valid KeyPress.

A null keypress can be created by the default constructor, in case it's needed.

bool KeyPress::operator!= ( const KeyPress other) const
noexcept

Compares two KeyPress objects.

bool KeyPress::operator!= ( int  keyCode) const
noexcept

Returns true if this keypress is not for the given keycode without any modifiers.

KeyPress & KeyPress::operator= ( const KeyPress other)
noexcept

Copies this KeyPress from another one.

bool KeyPress::operator== ( const KeyPress other) const
noexcept

Compares two KeyPress objects.

bool KeyPress::operator== ( int  keyCode) const
noexcept

Returns true if this keypress is for the given keycode without any modifiers.

Member Data Documentation

const int juce::KeyPress::backspaceKey
static

key-code for the backspace key

const int juce::KeyPress::deleteKey
static

key-code for the delete key (not backspace)

const int juce::KeyPress::downKey
static

key-code for the cursor-down key

const int juce::KeyPress::endKey
static

key-code for the end key

const int juce::KeyPress::escapeKey
static

key-code for the escape key

const int juce::KeyPress::F10Key
static

key-code for the F10 key

const int juce::KeyPress::F11Key
static

key-code for the F11 key

const int juce::KeyPress::F12Key
static

key-code for the F12 key

const int juce::KeyPress::F13Key
static

key-code for the F13 key

const int juce::KeyPress::F14Key
static

key-code for the F14 key

const int juce::KeyPress::F15Key
static

key-code for the F15 key

const int juce::KeyPress::F16Key
static

key-code for the F16 key

const int juce::KeyPress::F1Key
static

key-code for the F1 key

const int juce::KeyPress::F2Key
static

key-code for the F2 key

const int juce::KeyPress::F3Key
static

key-code for the F3 key

const int juce::KeyPress::F4Key
static

key-code for the F4 key

const int juce::KeyPress::F5Key
static

key-code for the F5 key

const int juce::KeyPress::F6Key
static

key-code for the F6 key

const int juce::KeyPress::F7Key
static

key-code for the F7 key

const int juce::KeyPress::F8Key
static

key-code for the F8 key

const int juce::KeyPress::F9Key
static

key-code for the F9 key

const int juce::KeyPress::fastForwardKey
static

key-code for a multimedia 'fast-forward' key, (not all keyboards will have one)

const int juce::KeyPress::homeKey
static

key-code for the home key

const int juce::KeyPress::insertKey
static

key-code for the insert key

const int juce::KeyPress::leftKey
static

key-code for the cursor-left key

const int juce::KeyPress::numberPad0
static

key-code for the 0 on the numeric keypad.

const int juce::KeyPress::numberPad1
static

key-code for the 1 on the numeric keypad.

const int juce::KeyPress::numberPad2
static

key-code for the 2 on the numeric keypad.

const int juce::KeyPress::numberPad3
static

key-code for the 3 on the numeric keypad.

const int juce::KeyPress::numberPad4
static

key-code for the 4 on the numeric keypad.

const int juce::KeyPress::numberPad5
static

key-code for the 5 on the numeric keypad.

const int juce::KeyPress::numberPad6
static

key-code for the 6 on the numeric keypad.

const int juce::KeyPress::numberPad7
static

key-code for the 7 on the numeric keypad.

const int juce::KeyPress::numberPad8
static

key-code for the 8 on the numeric keypad.

const int juce::KeyPress::numberPad9
static

key-code for the 9 on the numeric keypad.

const int juce::KeyPress::numberPadAdd
static

key-code for the add sign on the numeric keypad.

const int juce::KeyPress::numberPadDecimalPoint
static

key-code for the decimal point sign on the numeric keypad.

const int juce::KeyPress::numberPadDelete
static

key-code for the delete key on the numeric keypad.

const int juce::KeyPress::numberPadDivide
static

key-code for the divide sign on the numeric keypad.

const int juce::KeyPress::numberPadEquals
static

key-code for the equals key on the numeric keypad.

const int juce::KeyPress::numberPadMultiply
static

key-code for the multiply sign on the numeric keypad.

const int juce::KeyPress::numberPadSeparator
static

key-code for the comma on the numeric keypad.

const int juce::KeyPress::numberPadSubtract
static

key-code for the subtract sign on the numeric keypad.

const int juce::KeyPress::pageDownKey
static

key-code for the page-down key

const int juce::KeyPress::pageUpKey
static

key-code for the page-up key

const int juce::KeyPress::playKey
static

key-code for a multimedia 'play' key, (not all keyboards will have one)

const int juce::KeyPress::returnKey
static

key-code for the return key

const int juce::KeyPress::rewindKey
static

key-code for a multimedia 'rewind' key, (not all keyboards will have one)

const int juce::KeyPress::rightKey
static

key-code for the cursor-right key

const int juce::KeyPress::spaceKey
static

key-code for the space bar

const int juce::KeyPress::stopKey
static

key-code for a multimedia 'stop' key, (not all keyboards will have one)

const int juce::KeyPress::tabKey
static

key-code for the tab key

const int juce::KeyPress::upKey
static

key-code for the cursor-up key


The documentation for this class was generated from the following files: