LMMS
Loading...
Searching...
No Matches
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) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
40{
41public:
42 //==============================================================================
47 KeyPress() = default;
48
50 ~KeyPress() = default;
51
71 KeyPress (int keyCode,
72 ModifierKeys modifiers,
73 juce_wchar textCharacter) noexcept;
74
76 explicit KeyPress (int keyCode) noexcept;
77
79 KeyPress (const KeyPress&) = default;
80
82 KeyPress& operator= (const KeyPress&) = default;
83
85 bool operator== (const KeyPress& other) const noexcept;
86
88 bool operator!= (const KeyPress& other) const noexcept;
89
91 bool operator== (int keyCode) const noexcept;
92
94 bool operator!= (int keyCode) const noexcept;
95
96 //==============================================================================
102 bool isValid() const noexcept { return keyCode != 0; }
103
110
116
123
132 bool isKeyCode (int keyCodeToCompare) const noexcept { return keyCode == keyCodeToCompare; }
133
134 //==============================================================================
146 static KeyPress createFromDescription (const String& textVersion);
147
155 String getTextDescription() const;
156
162 String getTextDescriptionWithIcons() const;
163
164 //==============================================================================
172 bool isCurrentlyDown() const;
173
179 static bool isKeyCurrentlyDown (int keyCode);
180
181 //==============================================================================
182 // Key codes
183 //
184 // Note that the actual values of these are platform-specific and may change
185 // without warning, so don't store them anywhere as constants. For persisting/retrieving
186 // KeyPress objects, use getTextDescription() and createFromDescription() instead.
187 //
188
189 static const int spaceKey;
190 static const int escapeKey;
191 static const int returnKey;
192 static const int tabKey;
193
194 static const int deleteKey;
195 static const int backspaceKey;
196 static const int insertKey;
197
198 static const int upKey;
199 static const int downKey;
200 static const int leftKey;
201 static const int rightKey;
202 static const int pageUpKey;
203 static const int pageDownKey;
204 static const int homeKey;
205 static const int endKey;
206
207 static const int F1Key;
208 static const int F2Key;
209 static const int F3Key;
210 static const int F4Key;
211 static const int F5Key;
212 static const int F6Key;
213 static const int F7Key;
214 static const int F8Key;
215 static const int F9Key;
216 static const int F10Key;
217 static const int F11Key;
218 static const int F12Key;
219 static const int F13Key;
220 static const int F14Key;
221 static const int F15Key;
222 static const int F16Key;
223 static const int F17Key;
224 static const int F18Key;
225 static const int F19Key;
226 static const int F20Key;
227 static const int F21Key;
228 static const int F22Key;
229 static const int F23Key;
230 static const int F24Key;
231 static const int F25Key;
232 static const int F26Key;
233 static const int F27Key;
234 static const int F28Key;
235 static const int F29Key;
236 static const int F30Key;
237 static const int F31Key;
238 static const int F32Key;
239 static const int F33Key;
240 static const int F34Key;
241 static const int F35Key;
242
243 static const int numberPad0;
244 static const int numberPad1;
245 static const int numberPad2;
246 static const int numberPad3;
247 static const int numberPad4;
248 static const int numberPad5;
249 static const int numberPad6;
250 static const int numberPad7;
251 static const int numberPad8;
252 static const int numberPad9;
253
254 static const int numberPadAdd;
255 static const int numberPadSubtract;
256 static const int numberPadMultiply;
257 static const int numberPadDivide;
258 static const int numberPadSeparator;
259 static const int numberPadDecimalPoint;
260 static const int numberPadEquals;
261 static const int numberPadDelete;
262
263 static const int playKey;
264 static const int stopKey;
265 static const int fastForwardKey;
266 static const int rewindKey;
267
268private:
269 //==============================================================================
270 int keyCode = 0;
273
275};
276
277} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_KeyPress.h:40
static const int numberPadMultiply
Definition juce_KeyPress.h:256
static const int F32Key
Definition juce_KeyPress.h:238
static const int numberPad8
Definition juce_KeyPress.h:251
static const int playKey
Definition juce_KeyPress.h:263
static const int numberPad6
Definition juce_KeyPress.h:249
static const int F35Key
Definition juce_KeyPress.h:241
static const int F9Key
Definition juce_KeyPress.h:215
static const int F14Key
Definition juce_KeyPress.h:220
static const int F11Key
Definition juce_KeyPress.h:217
static const int homeKey
Definition juce_KeyPress.h:204
static const int numberPad2
Definition juce_KeyPress.h:245
static const int numberPad4
Definition juce_KeyPress.h:247
static const int F24Key
Definition juce_KeyPress.h:230
static const int numberPadEquals
Definition juce_KeyPress.h:260
static const int upKey
Definition juce_KeyPress.h:198
KeyPress()=default
static const int numberPad7
Definition juce_KeyPress.h:250
static const int F16Key
Definition juce_KeyPress.h:222
static const int F19Key
Definition juce_KeyPress.h:225
static const int fastForwardKey
Definition juce_KeyPress.h:265
static const int F20Key
Definition juce_KeyPress.h:226
static const int stopKey
Definition juce_KeyPress.h:264
static const int numberPadSeparator
Definition juce_KeyPress.h:258
static const int numberPad5
Definition juce_KeyPress.h:248
static const int F6Key
Definition juce_KeyPress.h:212
static const int endKey
Definition juce_KeyPress.h:205
static const int F1Key
Definition juce_KeyPress.h:207
static const int tabKey
Definition juce_KeyPress.h:192
static const int F21Key
Definition juce_KeyPress.h:227
static const int numberPad0
Definition juce_KeyPress.h:243
juce_wchar getTextCharacter() const noexcept
Definition juce_KeyPress.h:122
static const int numberPad9
Definition juce_KeyPress.h:252
static const int numberPadAdd
Definition juce_KeyPress.h:254
static const int F33Key
Definition juce_KeyPress.h:239
bool isKeyCode(int keyCodeToCompare) const noexcept
Definition juce_KeyPress.h:132
static const int rightKey
Definition juce_KeyPress.h:201
static const int F17Key
Definition juce_KeyPress.h:223
static const int rewindKey
Definition juce_KeyPress.h:266
ModifierKeys mods
Definition juce_KeyPress.h:271
static const int F27Key
Definition juce_KeyPress.h:233
static const int deleteKey
Definition juce_KeyPress.h:194
bool isValid() const noexcept
Definition juce_KeyPress.h:102
static const int insertKey
Definition juce_KeyPress.h:196
int keyCode
Definition juce_KeyPress.h:270
static const int F31Key
Definition juce_KeyPress.h:237
static const int F4Key
Definition juce_KeyPress.h:210
static const int F2Key
Definition juce_KeyPress.h:208
static const int F7Key
Definition juce_KeyPress.h:213
static const int F25Key
Definition juce_KeyPress.h:231
static const int F30Key
Definition juce_KeyPress.h:236
static const int F5Key
Definition juce_KeyPress.h:211
static const int F8Key
Definition juce_KeyPress.h:214
static const int F22Key
Definition juce_KeyPress.h:228
ModifierKeys getModifiers() const noexcept
Definition juce_KeyPress.h:115
static const int F10Key
Definition juce_KeyPress.h:216
KeyPress(const KeyPress &)=default
static const int downKey
Definition juce_KeyPress.h:199
static const int numberPadDelete
Definition juce_KeyPress.h:261
int getKeyCode() const noexcept
Definition juce_KeyPress.h:109
static const int numberPad3
Definition juce_KeyPress.h:246
static const int F15Key
Definition juce_KeyPress.h:221
static const int spaceKey
Definition juce_KeyPress.h:189
static const int F3Key
Definition juce_KeyPress.h:209
static const int F13Key
Definition juce_KeyPress.h:219
static const int F26Key
Definition juce_KeyPress.h:232
static const int escapeKey
Definition juce_KeyPress.h:190
static const int numberPadDivide
Definition juce_KeyPress.h:257
static const int returnKey
Definition juce_KeyPress.h:191
static const int F23Key
Definition juce_KeyPress.h:229
static const int F29Key
Definition juce_KeyPress.h:235
static const int leftKey
Definition juce_KeyPress.h:200
static const int F34Key
Definition juce_KeyPress.h:240
~KeyPress()=default
static const int F12Key
Definition juce_KeyPress.h:218
static const int F18Key
Definition juce_KeyPress.h:224
static const int pageUpKey
Definition juce_KeyPress.h:202
static const int F28Key
Definition juce_KeyPress.h:234
static const int pageDownKey
Definition juce_KeyPress.h:203
static const int numberPad1
Definition juce_KeyPress.h:244
static const int numberPadDecimalPoint
Definition juce_KeyPress.h:259
static const int backspaceKey
Definition juce_KeyPress.h:195
static const int numberPadSubtract
Definition juce_KeyPress.h:255
juce_wchar textCharacter
Definition juce_KeyPress.h:272
Definition juce_ModifierKeys.h:41
Definition juce_String.h:53
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition juce_LeakedObjectDetector.h:138
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
wchar_t juce_wchar
Definition juce_CharacterFunctions.h:42
#define const
Definition zconf.h:137