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.

juce_DirectoryContentsDisplayComponent.h 4.0KB

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