LMMS
Loading...
Searching...
No Matches
juce_ApplicationCommandManager.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//==============================================================================
88{
89public:
90 //==============================================================================
98
105
106 //==============================================================================
110 void clearCommands();
111
115 void registerCommand (const ApplicationCommandInfo& newCommand);
116
126
130 void removeCommand (CommandID commandID);
131
143
144 //==============================================================================
148 int getNumCommands() const noexcept { return commands.size(); }
149
153 const ApplicationCommandInfo* getCommandForIndex (int index) const noexcept { return commands [index]; }
154
161 const ApplicationCommandInfo* getCommandForID (CommandID commandID) const noexcept;
162
168 String getNameOfCommand (CommandID commandID) const noexcept;
169
177 String getDescriptionOfCommand (CommandID commandID) const noexcept;
178
186 StringArray getCommandCategories() const;
187
191 Array<CommandID> getCommandsInCategory (const String& categoryName) const;
192
193 //==============================================================================
203
204
205 //==============================================================================
210 bool invokeDirectly (CommandID commandID, bool asynchronously);
211
227 bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
228 bool asynchronously);
229
230
231 //==============================================================================
248 virtual ApplicationCommandTarget* getFirstCommandTarget (CommandID commandID);
249
258 void setFirstCommandTarget (ApplicationCommandTarget* newTarget) noexcept;
259
273 ApplicationCommandTarget* getTargetForCommand (CommandID commandID,
274 ApplicationCommandInfo& upToDateInfo);
275
276 //==============================================================================
278 void addListener (ApplicationCommandManagerListener* listener);
279
281 void removeListener (ApplicationCommandManagerListener* listener);
282
283 //==============================================================================
292 static ApplicationCommandTarget* findDefaultComponentTarget();
293
300 static ApplicationCommandTarget* findTargetForComponent (Component*);
301
302
303private:
304 //==============================================================================
307 std::unique_ptr<KeyPressMappingSet> keyMappings;
309
311 void handleAsyncUpdate() override;
312 void globalFocusChanged (Component*) override;
314
316};
317
318
319//==============================================================================
330{
331public:
332 //==============================================================================
335
338
347};
348
349} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
void globalFocusChanged(Component *) override
Definition juce_ApplicationCommandManager.cpp:317
int getNumCommands() const noexcept
Definition juce_ApplicationCommandManager.h:148
std::unique_ptr< KeyPressMappingSet > keyMappings
Definition juce_ApplicationCommandManager.h:307
void registerCommand(const ApplicationCommandInfo &newCommand)
Definition juce_ApplicationCommandManager.cpp:49
ApplicationCommandManager()
Definition juce_ApplicationCommandManager.cpp:29
void removeCommand(CommandID commandID)
Definition juce_ApplicationCommandManager.cpp:99
OwnedArray< ApplicationCommandInfo > commands
Definition juce_ApplicationCommandManager.h:305
ApplicationCommandInfo * getMutableCommandForID(CommandID) const noexcept
Definition juce_ApplicationCommandManager.cpp:122
const ApplicationCommandInfo * getCommandForIndex(int index) const noexcept
Definition juce_ApplicationCommandManager.h:153
void commandStatusChanged()
Definition juce_ApplicationCommandManager.cpp:116
KeyPressMappingSet * getKeyMappings() const noexcept
Definition juce_ApplicationCommandManager.h:202
ListenerList< ApplicationCommandManagerListener > listeners
Definition juce_ApplicationCommandManager.h:306
void clearCommands()
Definition juce_ApplicationCommandManager.cpp:42
void sendListenerInvokeCallback(const ApplicationCommandTarget::InvocationInfo &)
Definition juce_ApplicationCommandManager.cpp:307
ApplicationCommandTarget * firstTarget
Definition juce_ApplicationCommandManager.h:308
void handleAsyncUpdate() override
Definition juce_ApplicationCommandManager.cpp:312
void registerAllCommandsForTarget(ApplicationCommandTarget *target)
Definition juce_ApplicationCommandManager.cpp:82
Definition juce_ApplicationCommandManager.h:330
virtual void applicationCommandInvoked(const ApplicationCommandTarget::InvocationInfo &)=0
virtual ~ApplicationCommandManagerListener()=default
Definition juce_ApplicationCommandTarget.h:47
Definition juce_Array.h:56
AsyncUpdater()
Definition juce_AsyncUpdater.cpp:44
Definition juce_Component.h:36
Definition juce_Desktop.h:39
Definition juce_KeyPressMappingSet.h:89
Definition juce_ListenerList.h:70
Definition juce_OwnedArray.h:51
Definition juce_StringArray.h:35
Definition juce_String.h:53
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
#define JUCE_API
Definition juce_StandardHeader.h:152
Definition carla_juce.cpp:31
int CommandID
Definition juce_ApplicationCommandID.h:37
Definition juce_ApplicationCommandInfo.h:45
Definition juce_ApplicationCommandTarget.h:61
#define const
Definition zconf.h:137