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

#include <juce_KeyPress.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 = XK_space & 0xff
 
static const int escapeKey = XK_Escape & 0xff
 
static const int returnKey = XK_Return & 0xff
 
static const int tabKey = XK_Tab & 0xff
 
static const int deleteKey = (XK_Delete & 0xff) | Keys::extendedKeyModifier
 
static const int backspaceKey = XK_BackSpace & 0xff
 
static const int insertKey = (XK_Insert & 0xff) | Keys::extendedKeyModifier
 
static const int upKey = (XK_Up & 0xff) | Keys::extendedKeyModifier
 
static const int downKey = (XK_Down & 0xff) | Keys::extendedKeyModifier
 
static const int leftKey = (XK_Left & 0xff) | Keys::extendedKeyModifier
 
static const int rightKey = (XK_Right & 0xff) | Keys::extendedKeyModifier
 
static const int pageUpKey = (XK_Page_Up & 0xff) | Keys::extendedKeyModifier
 
static const int pageDownKey = (XK_Page_Down & 0xff) | Keys::extendedKeyModifier
 
static const int homeKey = (XK_Home & 0xff) | Keys::extendedKeyModifier
 
static const int endKey = (XK_End & 0xff) | Keys::extendedKeyModifier
 
static const int F1Key = (XK_F1 & 0xff) | Keys::extendedKeyModifier
 
static const int F2Key = (XK_F2 & 0xff) | Keys::extendedKeyModifier
 
static const int F3Key = (XK_F3 & 0xff) | Keys::extendedKeyModifier
 
static const int F4Key = (XK_F4 & 0xff) | Keys::extendedKeyModifier
 
static const int F5Key = (XK_F5 & 0xff) | Keys::extendedKeyModifier
 
static const int F6Key = (XK_F6 & 0xff) | Keys::extendedKeyModifier
 
static const int F7Key = (XK_F7 & 0xff) | Keys::extendedKeyModifier
 
static const int F8Key = (XK_F8 & 0xff) | Keys::extendedKeyModifier
 
static const int F9Key = (XK_F9 & 0xff) | Keys::extendedKeyModifier
 
static const int F10Key = (XK_F10 & 0xff) | Keys::extendedKeyModifier
 
static const int F11Key = (XK_F11 & 0xff) | Keys::extendedKeyModifier
 
static const int F12Key = (XK_F12 & 0xff) | Keys::extendedKeyModifier
 
static const int F13Key = (XK_F13 & 0xff) | Keys::extendedKeyModifier
 
static const int F14Key = (XK_F14 & 0xff) | Keys::extendedKeyModifier
 
static const int F15Key = (XK_F15 & 0xff) | Keys::extendedKeyModifier
 
static const int F16Key = (XK_F16 & 0xff) | Keys::extendedKeyModifier
 
static const int numberPad0 = (XK_KP_0 & 0xff) | Keys::extendedKeyModifier
 
static const int numberPad1 = (XK_KP_1 & 0xff) | Keys::extendedKeyModifier
 
static const int numberPad2 = (XK_KP_2 & 0xff) | Keys::extendedKeyModifier
 
static const int numberPad3 = (XK_KP_3 & 0xff) | Keys::extendedKeyModifier
 
static const int numberPad4 = (XK_KP_4 & 0xff) | Keys::extendedKeyModifier
 
static const int numberPad5 = (XK_KP_5 & 0xff) | Keys::extendedKeyModifier
 
static const int numberPad6 = (XK_KP_6 & 0xff) | Keys::extendedKeyModifier
 
static const int numberPad7 = (XK_KP_7 & 0xff)| Keys::extendedKeyModifier
 
static const int numberPad8 = (XK_KP_8 & 0xff)| Keys::extendedKeyModifier
 
static const int numberPad9 = (XK_KP_9 & 0xff)| Keys::extendedKeyModifier
 
static const int numberPadAdd = (XK_KP_Add & 0xff)| Keys::extendedKeyModifier
 
static const int numberPadSubtract = (XK_KP_Subtract & 0xff)| Keys::extendedKeyModifier
 
static const int numberPadMultiply = (XK_KP_Multiply & 0xff)| Keys::extendedKeyModifier
 
static const int numberPadDivide = (XK_KP_Divide & 0xff)| Keys::extendedKeyModifier
 
static const int numberPadSeparator = (XK_KP_Separator & 0xff)| Keys::extendedKeyModifier
 
static const int numberPadDecimalPoint = (XK_KP_Decimal & 0xff)| Keys::extendedKeyModifier
 
static const int numberPadEquals = (XK_KP_Equal & 0xff)| Keys::extendedKeyModifier
 
static const int numberPadDelete = (XK_KP_Delete & 0xff)| Keys::extendedKeyModifier
 
static const int playKey = ((int) 0xffeeff00) | Keys::extendedKeyModifier
 
static const int stopKey = ((int) 0xffeeff01) | Keys::extendedKeyModifier
 
static const int fastForwardKey = ((int) 0xffeeff02) | Keys::extendedKeyModifier
 
static const int rewindKey = ((int) 0xffeeff03) | Keys::extendedKeyModifier
 

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() [1/4]

KeyPress::KeyPress ( )
noexcept

Creates an (invalid) KeyPress.

See also
isValid

◆ KeyPress() [2/4]

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() [3/4]

KeyPress::KeyPress ( int  keyCode)
explicitnoexcept

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

◆ KeyPress() [4/4]

KeyPress::KeyPress ( const KeyPress other)
noexcept

Creates a copy of another KeyPress.

Member Function Documentation

◆ createFromDescription()

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

◆ getKeyCode()

int 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.

◆ getModifiers()

ModifierKeys KeyPress::getModifiers ( ) const
inlinenoexcept

Returns the key modifiers.

See also
ModifierKeys

◆ getTextCharacter()

juce_wchar 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.

◆ 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.

◆ isKeyCode()

bool 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

◆ isKeyCurrentlyDown()

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.

◆ isValid()

bool 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.

◆ operator!=() [1/2]

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

Compares two KeyPress objects.

◆ operator!=() [2/2]

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

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

◆ operator=()

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

Copies this KeyPress from another one.

◆ operator==() [1/2]

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

Compares two KeyPress objects.

◆ operator==() [2/2]

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

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

Member Data Documentation

◆ backspaceKey

const int KeyPress::backspaceKey = XK_BackSpace & 0xff
static

key-code for the backspace key

◆ deleteKey

const int KeyPress::deleteKey = (XK_Delete & 0xff) | Keys::extendedKeyModifier
static

key-code for the delete key (not backspace)

◆ downKey

const int KeyPress::downKey = (XK_Down & 0xff) | Keys::extendedKeyModifier
static

key-code for the cursor-down key

◆ endKey

const int KeyPress::endKey = (XK_End & 0xff) | Keys::extendedKeyModifier
static

key-code for the end key

◆ escapeKey

const int KeyPress::escapeKey = XK_Escape & 0xff
static

key-code for the escape key

◆ F10Key

const int KeyPress::F10Key = (XK_F10 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F10 key

◆ F11Key

const int KeyPress::F11Key = (XK_F11 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F11 key

◆ F12Key

const int KeyPress::F12Key = (XK_F12 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F12 key

◆ F13Key

const int KeyPress::F13Key = (XK_F13 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F13 key

◆ F14Key

const int KeyPress::F14Key = (XK_F14 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F14 key

◆ F15Key

const int KeyPress::F15Key = (XK_F15 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F15 key

◆ F16Key

const int KeyPress::F16Key = (XK_F16 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F16 key

◆ F1Key

const int KeyPress::F1Key = (XK_F1 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F1 key

◆ F2Key

const int KeyPress::F2Key = (XK_F2 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F2 key

◆ F3Key

const int KeyPress::F3Key = (XK_F3 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F3 key

◆ F4Key

const int KeyPress::F4Key = (XK_F4 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F4 key

◆ F5Key

const int KeyPress::F5Key = (XK_F5 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F5 key

◆ F6Key

const int KeyPress::F6Key = (XK_F6 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F6 key

◆ F7Key

const int KeyPress::F7Key = (XK_F7 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F7 key

◆ F8Key

const int KeyPress::F8Key = (XK_F8 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F8 key

◆ F9Key

const int KeyPress::F9Key = (XK_F9 & 0xff) | Keys::extendedKeyModifier
static

key-code for the F9 key

◆ fastForwardKey

const int KeyPress::fastForwardKey = ((int) 0xffeeff02) | Keys::extendedKeyModifier
static

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

◆ homeKey

const int KeyPress::homeKey = (XK_Home & 0xff) | Keys::extendedKeyModifier
static

key-code for the home key

◆ insertKey

const int KeyPress::insertKey = (XK_Insert & 0xff) | Keys::extendedKeyModifier
static

key-code for the insert key

◆ leftKey

const int KeyPress::leftKey = (XK_Left & 0xff) | Keys::extendedKeyModifier
static

key-code for the cursor-left key

◆ numberPad0

const int KeyPress::numberPad0 = (XK_KP_0 & 0xff) | Keys::extendedKeyModifier
static

key-code for the 0 on the numeric keypad.

◆ numberPad1

const int KeyPress::numberPad1 = (XK_KP_1 & 0xff) | Keys::extendedKeyModifier
static

key-code for the 1 on the numeric keypad.

◆ numberPad2

const int KeyPress::numberPad2 = (XK_KP_2 & 0xff) | Keys::extendedKeyModifier
static

key-code for the 2 on the numeric keypad.

◆ numberPad3

const int KeyPress::numberPad3 = (XK_KP_3 & 0xff) | Keys::extendedKeyModifier
static

key-code for the 3 on the numeric keypad.

◆ numberPad4

const int KeyPress::numberPad4 = (XK_KP_4 & 0xff) | Keys::extendedKeyModifier
static

key-code for the 4 on the numeric keypad.

◆ numberPad5

const int KeyPress::numberPad5 = (XK_KP_5 & 0xff) | Keys::extendedKeyModifier
static

key-code for the 5 on the numeric keypad.

◆ numberPad6

const int KeyPress::numberPad6 = (XK_KP_6 & 0xff) | Keys::extendedKeyModifier
static

key-code for the 6 on the numeric keypad.

◆ numberPad7

const int KeyPress::numberPad7 = (XK_KP_7 & 0xff)| Keys::extendedKeyModifier
static

key-code for the 7 on the numeric keypad.

◆ numberPad8

const int KeyPress::numberPad8 = (XK_KP_8 & 0xff)| Keys::extendedKeyModifier
static

key-code for the 8 on the numeric keypad.

◆ numberPad9

const int KeyPress::numberPad9 = (XK_KP_9 & 0xff)| Keys::extendedKeyModifier
static

key-code for the 9 on the numeric keypad.

◆ numberPadAdd

const int KeyPress::numberPadAdd = (XK_KP_Add & 0xff)| Keys::extendedKeyModifier
static

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

◆ numberPadDecimalPoint

const int KeyPress::numberPadDecimalPoint = (XK_KP_Decimal & 0xff)| Keys::extendedKeyModifier
static

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

◆ numberPadDelete

const int KeyPress::numberPadDelete = (XK_KP_Delete & 0xff)| Keys::extendedKeyModifier
static

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

◆ numberPadDivide

const int KeyPress::numberPadDivide = (XK_KP_Divide & 0xff)| Keys::extendedKeyModifier
static

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

◆ numberPadEquals

const int KeyPress::numberPadEquals = (XK_KP_Equal & 0xff)| Keys::extendedKeyModifier
static

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

◆ numberPadMultiply

const int KeyPress::numberPadMultiply = (XK_KP_Multiply & 0xff)| Keys::extendedKeyModifier
static

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

◆ numberPadSeparator

const int KeyPress::numberPadSeparator = (XK_KP_Separator & 0xff)| Keys::extendedKeyModifier
static

key-code for the comma on the numeric keypad.

◆ numberPadSubtract

const int KeyPress::numberPadSubtract = (XK_KP_Subtract & 0xff)| Keys::extendedKeyModifier
static

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

◆ pageDownKey

const int KeyPress::pageDownKey = (XK_Page_Down & 0xff) | Keys::extendedKeyModifier
static

key-code for the page-down key

◆ pageUpKey

const int KeyPress::pageUpKey = (XK_Page_Up & 0xff) | Keys::extendedKeyModifier
static

key-code for the page-up key

◆ playKey

const int KeyPress::playKey = ((int) 0xffeeff00) | Keys::extendedKeyModifier
static

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

◆ returnKey

const int KeyPress::returnKey = XK_Return & 0xff
static

key-code for the return key

◆ rewindKey

const int KeyPress::rewindKey = ((int) 0xffeeff03) | Keys::extendedKeyModifier
static

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

◆ rightKey

const int KeyPress::rightKey = (XK_Right & 0xff) | Keys::extendedKeyModifier
static

key-code for the cursor-right key

◆ spaceKey

const int KeyPress::spaceKey = XK_space & 0xff
static

key-code for the space bar

◆ stopKey

const int KeyPress::stopKey = ((int) 0xffeeff01) | Keys::extendedKeyModifier
static

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

◆ tabKey

const int KeyPress::tabKey = XK_Tab & 0xff
static

key-code for the tab key

◆ upKey

const int KeyPress::upKey = (XK_Up & 0xff) | Keys::extendedKeyModifier
static

key-code for the cursor-up key


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