Add remaining files
[juce-lv2.git] / juce / source / src / gui / components / filebrowser / juce_FileListComponent.h
blob45e795de450fc3b6660003a2a6030eff03b35ac0
1 /*
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_FILELISTCOMPONENT_JUCEHEADER__
27 #define __JUCE_FILELISTCOMPONENT_JUCEHEADER__
29 #include "juce_DirectoryContentsDisplayComponent.h"
30 #include "juce_FileBrowserListener.h"
31 #include "../controls/juce_ListBox.h"
32 #include "../controls/juce_TreeView.h"
35 //==============================================================================
36 /**
37 A component that displays the files in a directory as a listbox.
39 This implements the DirectoryContentsDisplayComponent base class so that
40 it can be used in a FileBrowserComponent.
42 To attach a listener to it, use its DirectoryContentsDisplayComponent base
43 class and the FileBrowserListener class.
45 @see DirectoryContentsList, FileTreeComponent
47 class JUCE_API FileListComponent : public ListBox,
48 public DirectoryContentsDisplayComponent,
49 private ListBoxModel,
50 private ChangeListener
52 public:
53 //==============================================================================
54 /** Creates a listbox to show the contents of a specified directory.
56 FileListComponent (DirectoryContentsList& listToShow);
58 /** Destructor. */
59 ~FileListComponent();
61 //==============================================================================
62 /** Returns the number of files the user has got selected.
63 @see getSelectedFile
65 int getNumSelectedFiles() const;
67 /** Returns one of the files that the user has currently selected.
68 The index should be in the range 0 to (getNumSelectedFiles() - 1).
69 @see getNumSelectedFiles
71 const File getSelectedFile (int index = 0) const;
73 /** Deselects any files that are currently selected. */
74 void deselectAllFiles();
76 /** Scrolls to the top of the list. */
77 void scrollToTop();
79 //==============================================================================
80 /** @internal */
81 void changeListenerCallback (ChangeBroadcaster*);
82 /** @internal */
83 int getNumRows();
84 /** @internal */
85 void paintListBoxItem (int, Graphics&, int, int, bool);
86 /** @internal */
87 Component* refreshComponentForRow (int rowNumber, bool isRowSelected, Component* existingComponentToUpdate);
88 /** @internal */
89 void selectedRowsChanged (int lastRowSelected);
90 /** @internal */
91 void deleteKeyPressed (int currentSelectedRow);
92 /** @internal */
93 void returnKeyPressed (int currentSelectedRow);
95 private:
96 //==============================================================================
97 File lastDirectory;
99 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileListComponent);
103 #endif // __JUCE_FILELISTCOMPONENT_JUCEHEADER__