openshot-audio  0.1.4
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) 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_APPLICATIONCOMMANDMANAGER_H_INCLUDED
26 #define JUCE_APPLICATIONCOMMANDMANAGER_H_INCLUDED
27 
28 
29 //==============================================================================
85  private FocusChangeListener
86 {
87 public:
88  //==============================================================================
96 
102  virtual ~ApplicationCommandManager();
103 
104  //==============================================================================
108  void clearCommands();
109 
113  void registerCommand (const ApplicationCommandInfo& newCommand);
114 
123  void registerAllCommandsForTarget (ApplicationCommandTarget* target);
124 
128  void removeCommand (CommandID commandID);
129 
140  void commandStatusChanged();
141 
142  //==============================================================================
146  int getNumCommands() const noexcept { return commands.size(); }
147 
151  const ApplicationCommandInfo* getCommandForIndex (int index) const noexcept { return commands [index]; }
152 
159  const ApplicationCommandInfo* getCommandForID (CommandID commandID) const noexcept;
160 
166  String getNameOfCommand (CommandID commandID) const noexcept;
167 
175  String getDescriptionOfCommand (CommandID commandID) const noexcept;
176 
184  StringArray getCommandCategories() const;
185 
189  Array<CommandID> getCommandsInCategory (const String& categoryName) const;
190 
191  //==============================================================================
200  KeyPressMappingSet* getKeyMappings() const noexcept { return keyMappings; }
201 
202 
203  //==============================================================================
208  bool invokeDirectly (CommandID commandID, bool asynchronously);
209 
225  bool invoke (const ApplicationCommandTarget::InvocationInfo& invocationInfo,
226  bool asynchronously);
227 
228 
229  //==============================================================================
246  virtual ApplicationCommandTarget* getFirstCommandTarget (CommandID commandID);
247 
256  void setFirstCommandTarget (ApplicationCommandTarget* newTarget) noexcept;
257 
271  ApplicationCommandTarget* getTargetForCommand (CommandID commandID,
272  ApplicationCommandInfo& upToDateInfo);
273 
274  //==============================================================================
276  void addListener (ApplicationCommandManagerListener* listener);
277 
279  void removeListener (ApplicationCommandManagerListener* listener);
280 
281  //==============================================================================
290  static ApplicationCommandTarget* findDefaultComponentTarget();
291 
298  static ApplicationCommandTarget* findTargetForComponent (Component*);
299 
300 
301 private:
302  //==============================================================================
306  ApplicationCommandTarget* firstTarget;
307 
308  void sendListenerInvokeCallback (const ApplicationCommandTarget::InvocationInfo&);
309  void handleAsyncUpdate() override;
310  void globalFocusChanged (Component*) override;
311  ApplicationCommandInfo* getMutableCommandForID (CommandID) const noexcept;
312 
313  #if JUCE_CATCH_DEPRECATED_CODE_MISUSE
314  // This is just here to cause a compile error in old code that hasn't been changed to use the new
315  // version of this method.
316  virtual short getFirstCommandTarget() { return 0; }
317  #endif
318 
320 };
321 
322 
323 //==============================================================================
332 {
333 public:
334  //==============================================================================
337 
339  virtual void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo&) = 0;
340 
348  virtual void applicationCommandListChanged() = 0;
349 };
350 
351 
352 
353 #endif // JUCE_APPLICATIONCOMMANDMANAGER_H_INCLUDED
Definition: juce_ApplicationCommandManager.h:84
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_Desktop.h:36
virtual void handleAsyncUpdate()=0
Definition: juce_String.h:43
#define JUCE_API
Definition: juce_StandardHeader.h:139
const ApplicationCommandInfo * getCommandForIndex(int index) const noexcept
Definition: juce_ApplicationCommandManager.h:151
Definition: juce_AsyncUpdater.h:39
Definition: juce_ApplicationCommandTarget.h:58
Definition: juce_ApplicationCommandTarget.h:44
virtual ~ApplicationCommandManagerListener()
Definition: juce_ApplicationCommandManager.h:336
int getNumCommands() const noexcept
Definition: juce_ApplicationCommandManager.h:146
Definition: juce_Component.h:33
Definition: juce_KeyPressMappingSet.h:84
Definition: juce_StringArray.h:39
Definition: juce_Array.h:60
int CommandID
Definition: juce_ApplicationCommandID.h:37
Definition: juce_ApplicationCommandManager.h:331
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
Definition: juce_ApplicationCommandInfo.h:42
KeyPressMappingSet * getKeyMappings() const noexcept
Definition: juce_ApplicationCommandManager.h:200
virtual void globalFocusChanged(Component *focusedComponent)=0