LMMS
Loading...
Searching...
No Matches
juce_KeyPressMappingSet.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//==============================================================================
87 public ChangeBroadcaster,
89{
90public:
91 //==============================================================================
105
108
110 ~KeyPressMappingSet() override;
111
112 //==============================================================================
114
115 //==============================================================================
120 Array<KeyPress> getKeyPressesAssignedToCommand (CommandID commandID) const;
121
135 void addKeyPress (CommandID commandID,
136 const KeyPress& newKeyPress,
137 int insertIndex = -1);
138
142 void resetToDefaultMappings();
143
147 void resetToDefaultMapping (CommandID commandID);
148
150 void clearAllKeyPresses();
151
153 void clearAllKeyPresses (CommandID commandID);
154
159 void removeKeyPress (CommandID commandID, int keyPressIndex);
160
162 void removeKeyPress (const KeyPress& keypress);
163
165 bool containsMapping (CommandID commandID, const KeyPress& keyPress) const noexcept;
166
167 //==============================================================================
171 CommandID findCommandForKeyPress (const KeyPress& keyPress) const noexcept;
172
173 //==============================================================================
189 bool restoreFromXml (const XmlElement& xmlVersion);
190
206 std::unique_ptr<XmlElement> createXml (bool saveDifferencesFromDefaultSet) const;
207
208 //==============================================================================
210 bool keyPressed (const KeyPress&, Component*) override;
212 bool keyStateChanged (bool isKeyDown, Component*) override;
214 void globalFocusChanged (Component*) override;
215
216private:
217 //==============================================================================
219
226
228
234
236
237 void invokeCommand (const CommandID, const KeyPress&, const bool isKeyDown,
238 const int millisecsSinceKeyPressed, Component* originator) const;
239
242};
243
244} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
Definition juce_ApplicationCommandManager.h:88
Definition juce_Array.h:56
ChangeBroadcaster() noexcept
Definition juce_ChangeBroadcaster.cpp:26
Definition juce_Component.h:36
Definition juce_Desktop.h:39
Definition juce_KeyListener.h:41
Definition juce_KeyPress.h:40
ApplicationCommandManager & commandManager
Definition juce_KeyPressMappingSet.h:218
ApplicationCommandManager & getCommandManager() const noexcept
Definition juce_KeyPressMappingSet.h:113
OwnedArray< KeyPressTime > keysDown
Definition juce_KeyPressMappingSet.h:235
KeyPressMappingSet(ApplicationCommandManager &)
Definition juce_KeyPressMappingSet.cpp:29
void invokeCommand(const CommandID, const KeyPress &, const bool isKeyDown, const int millisecsSinceKeyPressed, Component *originator) const
Definition juce_KeyPressMappingSet.cpp:195
OwnedArray< CommandMapping > mappings
Definition juce_KeyPressMappingSet.h:227
Definition juce_OwnedArray.h:51
Definition juce_XmlElement.h:83
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition juce_LeakedObjectDetector.h:138
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
unsigned int uint32
Definition juce_MathsFunctions.h:45
int CommandID
Definition juce_ApplicationCommandID.h:37
Definition juce_KeyPressMappingSet.h:221
bool wantsKeyUpDownCallbacks
Definition juce_KeyPressMappingSet.h:224
CommandID commandID
Definition juce_KeyPressMappingSet.h:222
Array< KeyPress > keypresses
Definition juce_KeyPressMappingSet.h:223
Definition juce_KeyPressMappingSet.h:230
KeyPress key
Definition juce_KeyPressMappingSet.h:231
uint32 timeWhenPressed
Definition juce_KeyPressMappingSet.h:232
#define const
Definition zconf.h:137