Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

190 lines
7.2KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #ifndef JUCE_APPLICATIONCOMMANDINFO_H_INCLUDED
  18. #define JUCE_APPLICATIONCOMMANDINFO_H_INCLUDED
  19. //==============================================================================
  20. /**
  21. Holds information describing an application command.
  22. This object is used to pass information about a particular command, such as its
  23. name, description and other usage flags.
  24. When an ApplicationCommandTarget is asked to provide information about the commands
  25. it can perform, this is the structure gets filled-in to describe each one.
  26. @see ApplicationCommandTarget, ApplicationCommandTarget::getCommandInfo(),
  27. ApplicationCommandManager
  28. */
  29. struct JUCE_API ApplicationCommandInfo
  30. {
  31. //==============================================================================
  32. explicit ApplicationCommandInfo (CommandID commandID) noexcept;
  33. //==============================================================================
  34. /** Sets a number of the structures values at once.
  35. The meanings of each of the parameters is described below, in the appropriate
  36. member variable's description.
  37. */
  38. void setInfo (const String& shortName,
  39. const String& description,
  40. const String& categoryName,
  41. int flags) noexcept;
  42. /** An easy way to set or remove the isDisabled bit in the structure's flags field.
  43. If isActive is true, the flags member has the isDisabled bit cleared; if isActive
  44. is false, the bit is set.
  45. */
  46. void setActive (bool isActive) noexcept;
  47. /** An easy way to set or remove the isTicked bit in the structure's flags field.
  48. */
  49. void setTicked (bool isTicked) noexcept;
  50. /** Handy method for adding a keypress to the defaultKeypresses array.
  51. This is just so you can write things like:
  52. @code
  53. myinfo.addDefaultKeypress ('s', ModifierKeys::commandModifier);
  54. @endcode
  55. instead of
  56. @code
  57. myinfo.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier));
  58. @endcode
  59. */
  60. void addDefaultKeypress (int keyCode, ModifierKeys modifiers) noexcept;
  61. //==============================================================================
  62. /** The command's unique ID number.
  63. */
  64. CommandID commandID;
  65. /** A short name to describe the command.
  66. This should be suitable for use in menus, on buttons that trigger the command, etc.
  67. You can use the setInfo() method to quickly set this and some of the command's
  68. other properties.
  69. */
  70. String shortName;
  71. /** A longer description of the command.
  72. This should be suitable for use in contexts such as a KeyMappingEditorComponent or
  73. pop-up tooltip describing what the command does.
  74. You can use the setInfo() method to quickly set this and some of the command's
  75. other properties.
  76. */
  77. String description;
  78. /** A named category that the command fits into.
  79. You can give your commands any category you like, and these will be displayed in
  80. contexts such as the KeyMappingEditorComponent, where the category is used to group
  81. commands together.
  82. You can use the setInfo() method to quickly set this and some of the command's
  83. other properties.
  84. */
  85. String categoryName;
  86. /** A list of zero or more keypresses that should be used as the default keys for
  87. this command.
  88. Methods such as KeyPressMappingSet::resetToDefaultMappings() will use the keypresses in
  89. this list to initialise the default set of key-to-command mappings.
  90. @see addDefaultKeypress
  91. */
  92. Array<KeyPress> defaultKeypresses;
  93. //==============================================================================
  94. /** Flags describing the ways in which this command should be used.
  95. A bitwise-OR of these values is stored in the ApplicationCommandInfo::flags
  96. variable.
  97. */
  98. enum CommandFlags
  99. {
  100. /** Indicates that the command can't currently be performed.
  101. The ApplicationCommandTarget::getCommandInfo() method must set this flag if it's
  102. not currently permissable to perform the command. If the flag is set, then
  103. components that trigger the command, e.g. PopupMenu, may choose to grey-out the
  104. command or show themselves as not being enabled.
  105. @see ApplicationCommandInfo::setActive
  106. */
  107. isDisabled = 1 << 0,
  108. /** Indicates that the command should have a tick next to it on a menu.
  109. If your command is shown on a menu and this is set, it'll show a tick next to
  110. it. Other components such as buttons may also use this flag to indicate that it
  111. is a value that can be toggled, and is currently in the 'on' state.
  112. @see ApplicationCommandInfo::setTicked
  113. */
  114. isTicked = 1 << 1,
  115. /** If this flag is present, then when a KeyPressMappingSet invokes the command,
  116. it will call the command twice, once on key-down and again on key-up.
  117. @see ApplicationCommandTarget::InvocationInfo
  118. */
  119. wantsKeyUpDownCallbacks = 1 << 2,
  120. /** If this flag is present, then a KeyMappingEditorComponent will not display the
  121. command in its list.
  122. */
  123. hiddenFromKeyEditor = 1 << 3,
  124. /** If this flag is present, then a KeyMappingEditorComponent will display the
  125. command in its list, but won't allow the assigned keypress to be changed.
  126. */
  127. readOnlyInKeyEditor = 1 << 4,
  128. /** If this flag is present and the command is invoked from a keypress, then any
  129. buttons or menus that are also connected to the command will not flash to
  130. indicate that they've been triggered.
  131. */
  132. dontTriggerVisualFeedback = 1 << 5
  133. };
  134. /** A bitwise-OR of the values specified in the CommandFlags enum.
  135. You can use the setInfo() method to quickly set this and some of the command's
  136. other properties.
  137. */
  138. int flags;
  139. };
  140. #endif // JUCE_APPLICATIONCOMMANDINFO_H_INCLUDED