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.

191 lines
7.0KB

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