openshot-audio  0.1.7
juce_KeyPress.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_KEYPRESS_H_INCLUDED
26 #define JUCE_KEYPRESS_H_INCLUDED
27 
28 
29 //==============================================================================
38 {
39 public:
40  //==============================================================================
46 
66  KeyPress (int keyCode,
67  ModifierKeys modifiers,
68  juce_wchar textCharacter) noexcept;
69 
71  explicit KeyPress (int keyCode) noexcept;
72 
74  KeyPress (const KeyPress& other) noexcept;
75 
77  KeyPress& operator= (const KeyPress& other) noexcept;
78 
80  bool operator== (const KeyPress& other) const noexcept;
81 
83  bool operator!= (const KeyPress& other) const noexcept;
84 
86  bool operator== (int keyCode) const noexcept;
87 
89  bool operator!= (int keyCode) const noexcept;
90 
91  //==============================================================================
97  bool isValid() const noexcept { return keyCode != 0; }
98 
104  int getKeyCode() const noexcept { return keyCode; }
105 
110  ModifierKeys getModifiers() const noexcept { return mods; }
111 
117  juce_wchar getTextCharacter() const noexcept { return textCharacter; }
118 
127  bool isKeyCode (int keyCodeToCompare) const noexcept { return keyCode == keyCodeToCompare; }
128 
129  //==============================================================================
141  static KeyPress createFromDescription (const String& textVersion);
142 
150  String getTextDescription() const;
151 
157  String getTextDescriptionWithIcons() const;
158 
159  //==============================================================================
167  bool isCurrentlyDown() const;
168 
174  static bool isKeyCurrentlyDown (int keyCode);
175 
176  //==============================================================================
177  // Key codes
178  //
179  // Note that the actual values of these are platform-specific and may change
180  // without warning, so don't store them anywhere as constants. For persisting/retrieving
181  // KeyPress objects, use getTextDescription() and createFromDescription() instead.
182  //
183 
184  static const int spaceKey;
185  static const int escapeKey;
186  static const int returnKey;
187  static const int tabKey;
189  static const int deleteKey;
190  static const int backspaceKey;
191  static const int insertKey;
193  static const int upKey;
194  static const int downKey;
195  static const int leftKey;
196  static const int rightKey;
197  static const int pageUpKey;
198  static const int pageDownKey;
199  static const int homeKey;
200  static const int endKey;
202  static const int F1Key;
203  static const int F2Key;
204  static const int F3Key;
205  static const int F4Key;
206  static const int F5Key;
207  static const int F6Key;
208  static const int F7Key;
209  static const int F8Key;
210  static const int F9Key;
211  static const int F10Key;
212  static const int F11Key;
213  static const int F12Key;
214  static const int F13Key;
215  static const int F14Key;
216  static const int F15Key;
217  static const int F16Key;
219  static const int numberPad0;
220  static const int numberPad1;
221  static const int numberPad2;
222  static const int numberPad3;
223  static const int numberPad4;
224  static const int numberPad5;
225  static const int numberPad6;
226  static const int numberPad7;
227  static const int numberPad8;
228  static const int numberPad9;
230  static const int numberPadAdd;
231  static const int numberPadSubtract;
232  static const int numberPadMultiply;
233  static const int numberPadDivide;
234  static const int numberPadSeparator;
235  static const int numberPadDecimalPoint;
236  static const int numberPadEquals;
237  static const int numberPadDelete;
239  static const int playKey;
240  static const int stopKey;
241  static const int fastForwardKey;
242  static const int rewindKey;
244 private:
245  //==============================================================================
246  int keyCode;
247  ModifierKeys mods;
248  juce_wchar textCharacter;
249 
251 };
252 
253 
254 #endif // JUCE_KEYPRESS_H_INCLUDED
static const int pageUpKey
Definition: juce_KeyPress.h:197
static const int endKey
Definition: juce_KeyPress.h:200
static const int numberPadSubtract
Definition: juce_KeyPress.h:231
static const int numberPad2
Definition: juce_KeyPress.h:221
static const int deleteKey
Definition: juce_KeyPress.h:189
Definition: juce_KeyPress.h:37
static const int rewindKey
Definition: juce_KeyPress.h:242
#define noexcept
Definition: juce_CompilerSupport.h:141
static const int insertKey
Definition: juce_KeyPress.h:191
static const int leftKey
Definition: juce_KeyPress.h:195
static const int numberPad7
Definition: juce_KeyPress.h:226
static const int F3Key
Definition: juce_KeyPress.h:204
static const int downKey
Definition: juce_KeyPress.h:194
static const int numberPadSeparator
Definition: juce_KeyPress.h:234
Definition: juce_ModifierKeys.h:38
static const int numberPadAdd
Definition: juce_KeyPress.h:230
static const int F12Key
Definition: juce_KeyPress.h:213
static const int F8Key
Definition: juce_KeyPress.h:209
static const int F10Key
Definition: juce_KeyPress.h:211
Definition: juce_String.h:43
static const int backspaceKey
Definition: juce_KeyPress.h:190
static const int numberPad4
Definition: juce_KeyPress.h:223
static const int numberPadDecimalPoint
Definition: juce_KeyPress.h:235
static const int numberPadMultiply
Definition: juce_KeyPress.h:232
static const int F11Key
Definition: juce_KeyPress.h:212
juce_wchar getTextCharacter() const noexcept
Definition: juce_KeyPress.h:117
#define JUCE_API
Definition: juce_StandardHeader.h:139
static const int F9Key
Definition: juce_KeyPress.h:210
static const int F7Key
Definition: juce_KeyPress.h:208
static const int returnKey
Definition: juce_KeyPress.h:186
static const int numberPad6
Definition: juce_KeyPress.h:225
static const int F5Key
Definition: juce_KeyPress.h:206
static const int numberPadDelete
Definition: juce_KeyPress.h:237
static const int F13Key
Definition: juce_KeyPress.h:214
static const int tabKey
Definition: juce_KeyPress.h:187
static const int F2Key
Definition: juce_KeyPress.h:203
int getKeyCode() const noexcept
Definition: juce_KeyPress.h:104
static const int fastForwardKey
Definition: juce_KeyPress.h:241
static const int F4Key
Definition: juce_KeyPress.h:205
static const int numberPad9
Definition: juce_KeyPress.h:228
static const int homeKey
Definition: juce_KeyPress.h:199
static const int F14Key
Definition: juce_KeyPress.h:215
static const int pageDownKey
Definition: juce_KeyPress.h:198
static const int spaceKey
Definition: juce_KeyPress.h:184
static const int numberPadEquals
Definition: juce_KeyPress.h:236
static const int numberPad5
Definition: juce_KeyPress.h:224
static const int numberPad0
Definition: juce_KeyPress.h:219
static const int escapeKey
Definition: juce_KeyPress.h:185
static const int rightKey
Definition: juce_KeyPress.h:196
static const int stopKey
Definition: juce_KeyPress.h:240
bool operator==(const var &v1, const var &v2) noexcept
Definition: juce_Variant.cpp:565
static const int F1Key
Definition: juce_KeyPress.h:202
static const int upKey
Definition: juce_KeyPress.h:193
bool isValid() const noexcept
Definition: juce_KeyPress.h:97
static const int F6Key
Definition: juce_KeyPress.h:207
static const int playKey
Definition: juce_KeyPress.h:239
ModifierKeys getModifiers() const noexcept
Definition: juce_KeyPress.h:110
static const int F16Key
Definition: juce_KeyPress.h:217
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition: juce_LeakedObjectDetector.h:141
bool operator!=(const var &v1, const var &v2) noexcept
Definition: juce_Variant.cpp:566
static const int numberPadDivide
Definition: juce_KeyPress.h:233
wchar_t juce_wchar
Definition: juce_CharacterFunctions.h:49
static const int numberPad3
Definition: juce_KeyPress.h:222
bool isKeyCode(int keyCodeToCompare) const noexcept
Definition: juce_KeyPress.h:127
static const int F15Key
Definition: juce_KeyPress.h:216
static const int numberPad1
Definition: juce_KeyPress.h:220
static const int numberPad8
Definition: juce_KeyPress.h:227