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.

109 lines
4.4KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  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 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. namespace juce
  20. {
  21. //==============================================================================
  22. /**
  23. A factory object which can create ToolbarItemComponent objects.
  24. A subclass of ToolbarItemFactory publishes a set of types of toolbar item
  25. that it can create.
  26. Each type of item is identified by a unique ID, and multiple instances of an
  27. item type can exist at once (even on the same toolbar, e.g. spacers or separator
  28. bars).
  29. @see Toolbar, ToolbarItemComponent, ToolbarButton
  30. */
  31. class JUCE_API ToolbarItemFactory
  32. {
  33. public:
  34. //==============================================================================
  35. ToolbarItemFactory();
  36. /** Destructor. */
  37. virtual ~ToolbarItemFactory();
  38. //==============================================================================
  39. /** A set of reserved item ID values, used for the built-in item types.
  40. */
  41. enum SpecialItemIds
  42. {
  43. separatorBarId = -1, /**< The item ID for a vertical (or horizontal) separator bar that
  44. can be placed between sets of items to break them into groups. */
  45. spacerId = -2, /**< The item ID for a fixed-width space that can be placed between
  46. items.*/
  47. flexibleSpacerId = -3 /**< The item ID for a gap that pushes outwards against the things on
  48. either side of it, filling any available space. */
  49. };
  50. //==============================================================================
  51. /** Must return a list of the IDs for all the item types that this factory can create.
  52. The ids should be added to the array that is passed-in.
  53. An item ID can be any integer you choose, except for 0, which is considered a null ID,
  54. and the predefined IDs in the SpecialItemIds enum.
  55. You should also add the built-in types (separatorBarId, spacerId and flexibleSpacerId)
  56. to this list if you want your toolbar to be able to contain those items.
  57. The list returned here is used by the ToolbarItemPalette class to obtain its list
  58. of available items, and their order on the palette will reflect the order in which
  59. they appear on this list.
  60. @see ToolbarItemPalette
  61. */
  62. virtual void getAllToolbarItemIds (Array <int>& ids) = 0;
  63. /** Must return the set of items that should be added to a toolbar as its default set.
  64. This method is used by Toolbar::addDefaultItems() to determine which items to
  65. create.
  66. The items that your method adds to the array that is passed-in will be added to the
  67. toolbar in the same order. Items can appear in the list more than once.
  68. */
  69. virtual void getDefaultItemSet (Array <int>& ids) = 0;
  70. /** Must create an instance of one of the items that the factory lists in its
  71. getAllToolbarItemIds() method.
  72. The itemId parameter can be any of the values listed by your getAllToolbarItemIds()
  73. method, except for the built-in item types from the SpecialItemIds enum, which
  74. are created internally by the toolbar code.
  75. Try not to keep a pointer to the object that is returned, as it will be deleted
  76. automatically by the toolbar, and remember that multiple instances of the same
  77. item type are likely to exist at the same time.
  78. */
  79. virtual ToolbarItemComponent* createItem (int itemId) = 0;
  80. };
  81. } // namespace juce