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.

113 lines
4.3KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-11 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #ifndef __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  19. #define __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__
  20. #include "../components/juce_Component.h"
  21. #include "juce_DirectoryContentsList.h"
  22. #include "juce_FileBrowserListener.h"
  23. //==============================================================================
  24. /**
  25. A base class for components that display a list of the files in a directory.
  26. @see DirectoryContentsList
  27. */
  28. class JUCE_API DirectoryContentsDisplayComponent
  29. {
  30. public:
  31. //==============================================================================
  32. /** Creates a DirectoryContentsDisplayComponent for a given list of files. */
  33. DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
  34. /** Destructor. */
  35. virtual ~DirectoryContentsDisplayComponent();
  36. //==============================================================================
  37. /** Returns the number of files the user has got selected.
  38. @see getSelectedFile
  39. */
  40. virtual int getNumSelectedFiles() const = 0;
  41. /** Returns one of the files that the user has currently selected.
  42. The index should be in the range 0 to (getNumSelectedFiles() - 1).
  43. @see getNumSelectedFiles
  44. */
  45. virtual File getSelectedFile (int index) const = 0;
  46. /** Deselects any selected files. */
  47. virtual void deselectAllFiles() = 0;
  48. /** Scrolls this view to the top. */
  49. virtual void scrollToTop() = 0;
  50. //==============================================================================
  51. /** Adds a listener to be told when files are selected or clicked.
  52. @see removeListener
  53. */
  54. void addListener (FileBrowserListener* listener);
  55. /** Removes a listener.
  56. @see addListener
  57. */
  58. void removeListener (FileBrowserListener* listener);
  59. //==============================================================================
  60. /** A set of colour IDs to use to change the colour of various aspects of the list.
  61. These constants can be used either via the Component::setColour(), or LookAndFeel::setColour()
  62. methods.
  63. @see Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
  64. */
  65. enum ColourIds
  66. {
  67. highlightColourId = 0x1000540, /**< The colour to use to fill a highlighted row of the list. */
  68. textColourId = 0x1000541, /**< The colour for the text. */
  69. };
  70. //==============================================================================
  71. /** @internal */
  72. void sendSelectionChangeMessage();
  73. /** @internal */
  74. void sendDoubleClickMessage (const File& file);
  75. /** @internal */
  76. void sendMouseClickMessage (const File& file, const MouseEvent& e);
  77. protected:
  78. //==============================================================================
  79. DirectoryContentsList& fileList;
  80. ListenerList <FileBrowserListener> listeners;
  81. private:
  82. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (DirectoryContentsDisplayComponent);
  83. };
  84. #endif // __JUCE_DIRECTORYCONTENTSDISPLAYCOMPONENT_JUCEHEADER__