JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
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//==============================================================================
86class JUCE_API ApplicationCommandManager : private AsyncUpdater,
88{
89public:
90 //==============================================================================
98
105
106 //==============================================================================
110 void clearCommands();
111
115 void registerCommand (const ApplicationCommandInfo& newCommand);
116
125 void registerAllCommandsForTarget (ApplicationCommandTarget* target);
126
130 void removeCommand (CommandID commandID);
131
142 void commandStatusChanged();
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 //==============================================================================
202 KeyPressMappingSet* getKeyMappings() const noexcept { return keyMappings.get(); }
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 //==============================================================================
308 ApplicationCommandTarget* firstTarget = nullptr;
309
310 void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo&);
311 void handleAsyncUpdate() override;
312 void globalFocusChanged (Component*) override;
313 ApplicationCommandInfo* getMutableCommandForID (CommandID) const noexcept;
314
316};
317
318
319//==============================================================================
330{
331public:
332 //==============================================================================
335
338
347};
348
349} // namespace juce
A listener that receives callbacks from an ApplicationCommandManager when commands are invoked or the...
virtual void applicationCommandInvoked(const ApplicationCommandTarget::InvocationInfo &)=0
Called when an app command is about to be invoked.
virtual void applicationCommandListChanged()=0
Called when commands are registered or deregistered from the command manager, or when commands are ma...
virtual ~ApplicationCommandManagerListener()=default
Destructor.
One of these objects holds a list of all the commands your app can perform, and despatches these comm...
int getNumCommands() const noexcept
Returns the number of commands that have been registered.
const ApplicationCommandInfo * getCommandForIndex(int index) const noexcept
Returns the details about one of the registered commands.
KeyPressMappingSet * getKeyMappings() const noexcept
Returns the manager's internal set of key mappings.
A command target publishes a list of command IDs that it can perform.
Holds a resizable array of primitive or copy-by-value objects.
Definition juce_Array.h:56
Has a callback method that is triggered asynchronously.
The base class for all JUCE user-interface objects.
Classes can implement this interface and register themselves with the Desktop class to receive callba...
Manages and edits a list of keypresses, which it uses to invoke the appropriate command in an Applica...
Holds a set of objects and can invoke a member function callback on each object in the set with a sin...
An array designed for holding objects.
A special array for holding a list of strings.
The JUCE String class!
Definition juce_String.h:53
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.
int CommandID
A type used to hold the unique ID for an application command.
Holds information describing an application command.
Contains contextual details about the invocation of a command.