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.

71 lines
2.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. namespace juce
  14. {
  15. //==============================================================================
  16. /**
  17. A component containing a list of toolbar items, which the user can drag onto
  18. a toolbar to add them.
  19. You can use this class directly, but it's a lot easier to call Toolbar::showCustomisationDialog(),
  20. which automatically shows one of these in a dialog box with lots of extra controls.
  21. @see Toolbar
  22. @tags{GUI}
  23. */
  24. class JUCE_API ToolbarItemPalette : public Component,
  25. public DragAndDropContainer
  26. {
  27. public:
  28. //==============================================================================
  29. /** Creates a palette of items for a given factory, with the aim of adding them
  30. to the specified toolbar.
  31. The ToolbarItemFactory::getAllToolbarItemIds() method is used to create the
  32. set of items that are shown in this palette.
  33. The toolbar and factory must not be deleted while this object exists.
  34. */
  35. ToolbarItemPalette (ToolbarItemFactory& factory,
  36. Toolbar& toolbar);
  37. /** Destructor. */
  38. ~ToolbarItemPalette() override;
  39. //==============================================================================
  40. /** @internal */
  41. void resized() override;
  42. private:
  43. ToolbarItemFactory& factory;
  44. Toolbar& toolbar;
  45. Viewport viewport;
  46. OwnedArray<ToolbarItemComponent> items;
  47. friend class Toolbar;
  48. void replaceComponent (ToolbarItemComponent&);
  49. void addComponent (int itemId, int index);
  50. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ToolbarItemPalette)
  51. };
  52. } // namespace juce