The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

73 lines
2.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI 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. #pragma once
  18. //==============================================================================
  19. /**
  20. A component containing a list of toolbar items, which the user can drag onto
  21. a toolbar to add them.
  22. You can use this class directly, but it's a lot easier to call Toolbar::showCustomisationDialog(),
  23. which automatically shows one of these in a dialog box with lots of extra controls.
  24. @see Toolbar
  25. */
  26. class JUCE_API ToolbarItemPalette : public Component,
  27. public DragAndDropContainer
  28. {
  29. public:
  30. //==============================================================================
  31. /** Creates a palette of items for a given factory, with the aim of adding them
  32. to the specified toolbar.
  33. The ToolbarItemFactory::getAllToolbarItemIds() method is used to create the
  34. set of items that are shown in this palette.
  35. The toolbar and factory must not be deleted while this object exists.
  36. */
  37. ToolbarItemPalette (ToolbarItemFactory& factory,
  38. Toolbar& toolbar);
  39. /** Destructor. */
  40. ~ToolbarItemPalette();
  41. //==============================================================================
  42. /** @internal */
  43. void resized() override;
  44. private:
  45. ToolbarItemFactory& factory;
  46. Toolbar& toolbar;
  47. Viewport viewport;
  48. OwnedArray <ToolbarItemComponent> items;
  49. friend class Toolbar;
  50. void replaceComponent (ToolbarItemComponent&);
  51. void addComponent (int itemId, int index);
  52. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ToolbarItemPalette)
  53. };