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