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.

115 lines
4.1KB

  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 base class for components that display a list of the files in a directory.
  24. @see DirectoryContentsList
  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. };
  74. //==============================================================================
  75. /** @internal */
  76. void sendSelectionChangeMessage();
  77. /** @internal */
  78. void sendDoubleClickMessage (const File&);
  79. /** @internal */
  80. void sendMouseClickMessage (const File&, const MouseEvent&);
  81. protected:
  82. //==============================================================================
  83. ListenerList<FileBrowserListener> listeners;
  84. private:
  85. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DirectoryContentsDisplayComponent)
  86. };
  87. } // namespace juce