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.

117 lines
4.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2020 - 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 6 End-User License
  8. Agreement and JUCE Privacy Policy (both effective as of the 16th June 2020).
  9. End User License Agreement: www.juce.com/juce-6-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. A base class for components that display a list of the files in a directory.
  23. @see DirectoryContentsList
  24. @tags{GUI}
  25. */
  26. class JUCE_API DirectoryContentsDisplayComponent
  27. {
  28. public:
  29. //==============================================================================
  30. /** Creates a DirectoryContentsDisplayComponent for a given list of files. */
  31. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  32. /** Destructor. */
  33. virtual ~DirectoryContentsDisplayComponent();
  34. //==============================================================================
  35. /** The list that this component is displaying */
  36. DirectoryContentsList& directoryContentsList;
  37. //==============================================================================
  38. /** Returns the number of files the user has got selected.
  39. @see getSelectedFile
  40. */
  41. virtual int getNumSelectedFiles() const = 0;
  42. /** Returns one of the files that the user has currently selected.
  43. The index should be in the range 0 to (getNumSelectedFiles() - 1).
  44. @see getNumSelectedFiles
  45. */
  46. virtual File getSelectedFile (int index) const = 0;
  47. /** Deselects any selected files. */
  48. virtual void deselectAllFiles() = 0;
  49. /** Scrolls this view to the top. */
  50. virtual void scrollToTop() = 0;
  51. /** If the specified file is in the list, it will become the only selected item
  52. (and if the file isn't in the list, all other items will be deselected). */
  53. virtual void setSelectedFile (const File&) = 0;
  54. //==============================================================================
  55. /** Adds a listener to be told when files are selected or clicked.
  56. @see removeListener
  57. */
  58. void addListener (FileBrowserListener* listener);
  59. /** Removes a listener.
  60. @see addListener
  61. */
  62. void removeListener (FileBrowserListener* listener);
  63. //==============================================================================
  64. /** A set of colour IDs to use to change the colour of various aspects of the list.
  65. These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
  66. methods.
  67. @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
  68. */
  69. enum ColourIds
  70. {
  71. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  72. textColourId = 0x1000541, /**< The colour for the text. */
  73. highlightedTextColourId = 0x1000542 /**< The colour with which to draw the text in highlighted sections. */
  74. };
  75. //==============================================================================
  76. /** @internal */
  77. void sendSelectionChangeMessage();
  78. /** @internal */
  79. void sendDoubleClickMessage (const File&);
  80. /** @internal */
  81. void sendMouseClickMessage (const File&, const MouseEvent&);
  82. protected:
  83. //==============================================================================
  84. ListenerList<FileBrowserListener> listeners;
  85. private:
  86. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DirectoryContentsDisplayComponent)
  87. };
  88. } // namespace juce