Blindly add a few stuff from VST
[juce-lv2.git] / juce / source / src / application / juce_ApplicationCommandInfo.h
bloba0b336b80047e3669b4bc72f9f1cad01c3c2425f
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #ifndef __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
27 #define __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__
29 #include "../text/juce_String.h"
30 #include "../containers/juce_Array.h"
31 #include "../gui/components/keyboard/juce_KeyPress.h"
32 #include "juce_ApplicationCommandID.h"
35 //==============================================================================
36 /**
37 Holds information describing an application command.
39 This object is used to pass information about a particular command, such as its
40 name, description and other usage flags.
42 When an ApplicationCommandTarget is asked to provide information about the commands
43 it can perform, this is the structure gets filled-in to describe each one.
45 @see ApplicationCommandTarget, ApplicationCommandTarget::getCommandInfo(),
46 ApplicationCommandManager
48 struct JUCE_API ApplicationCommandInfo
50 //==============================================================================
51 explicit ApplicationCommandInfo (CommandID commandID) noexcept;
53 //==============================================================================
54 /** Sets a number of the structures values at once.
56 The meanings of each of the parameters is described below, in the appropriate
57 member variable's description.
59 void setInfo (const String& shortName,
60 const String& description,
61 const String& categoryName,
62 int flags) noexcept;
64 /** An easy way to set or remove the isDisabled bit in the structure's flags field.
66 If isActive is true, the flags member has the isDisabled bit cleared; if isActive
67 is false, the bit is set.
69 void setActive (bool isActive) noexcept;
71 /** An easy way to set or remove the isTicked bit in the structure's flags field.
73 void setTicked (bool isTicked) noexcept;
75 /** Handy method for adding a keypress to the defaultKeypresses array.
77 This is just so you can write things like:
78 @code
79 myinfo.addDefaultKeypress ('s', ModifierKeys::commandModifier);
80 @endcode
81 instead of
82 @code
83 myinfo.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier));
84 @endcode
86 void addDefaultKeypress (int keyCode,
87 const ModifierKeys& modifiers) noexcept;
89 //==============================================================================
90 /** The command's unique ID number.
92 CommandID commandID;
94 /** A short name to describe the command.
96 This should be suitable for use in menus, on buttons that trigger the command, etc.
98 You can use the setInfo() method to quickly set this and some of the command's
99 other properties.
101 String shortName;
103 /** A longer description of the command.
105 This should be suitable for use in contexts such as a KeyMappingEditorComponent or
106 pop-up tooltip describing what the command does.
108 You can use the setInfo() method to quickly set this and some of the command's
109 other properties.
111 String description;
113 /** A named category that the command fits into.
115 You can give your commands any category you like, and these will be displayed in
116 contexts such as the KeyMappingEditorComponent, where the category is used to group
117 commands together.
119 You can use the setInfo() method to quickly set this and some of the command's
120 other properties.
122 String categoryName;
124 /** A list of zero or more keypresses that should be used as the default keys for
125 this command.
127 Methods such as KeyPressMappingSet::resetToDefaultMappings() will use the keypresses in
128 this list to initialise the default set of key-to-command mappings.
130 @see addDefaultKeypress
132 Array <KeyPress> defaultKeypresses;
134 //==============================================================================
135 /** Flags describing the ways in which this command should be used.
137 A bitwise-OR of these values is stored in the ApplicationCommandInfo::flags
138 variable.
140 enum CommandFlags
142 /** Indicates that the command can't currently be performed.
144 The ApplicationCommandTarget::getCommandInfo() method must set this flag if it's
145 not currently permissable to perform the command. If the flag is set, then
146 components that trigger the command, e.g. PopupMenu, may choose to grey-out the
147 command or show themselves as not being enabled.
149 @see ApplicationCommandInfo::setActive
151 isDisabled = 1 << 0,
153 /** Indicates that the command should have a tick next to it on a menu.
155 If your command is shown on a menu and this is set, it'll show a tick next to
156 it. Other components such as buttons may also use this flag to indicate that it
157 is a value that can be toggled, and is currently in the 'on' state.
159 @see ApplicationCommandInfo::setTicked
161 isTicked = 1 << 1,
163 /** If this flag is present, then when a KeyPressMappingSet invokes the command,
164 it will call the command twice, once on key-down and again on key-up.
166 @see ApplicationCommandTarget::InvocationInfo
168 wantsKeyUpDownCallbacks = 1 << 2,
170 /** If this flag is present, then a KeyMappingEditorComponent will not display the
171 command in its list.
173 hiddenFromKeyEditor = 1 << 3,
175 /** If this flag is present, then a KeyMappingEditorComponent will display the
176 command in its list, but won't allow the assigned keypress to be changed.
178 readOnlyInKeyEditor = 1 << 4,
180 /** If this flag is present and the command is invoked from a keypress, then any
181 buttons or menus that are also connected to the command will not flash to
182 indicate that they've been triggered.
184 dontTriggerVisualFeedback = 1 << 5
187 /** A bitwise-OR of the values specified in the CommandFlags enum.
189 You can use the setInfo() method to quickly set this and some of the command's
190 other properties.
192 int flags;
196 #endif // __JUCE_APPLICATIONCOMMANDINFO_JUCEHEADER__