VST3: fetch midi mappings all at once, use it for note/sound-off
[carla.git] / source / modules / juce_gui_basics / filebrowser / juce_FileTreeComponent.h
blobb021bc7582932e39c2044b074c4ac853addefc0c
1 /*
2 ==============================================================================
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
23 ==============================================================================
26 namespace juce
29 //==============================================================================
30 /**
31 A component that displays the files in a directory as a treeview.
33 This implements the DirectoryContentsDisplayComponent base class so that
34 it can be used in a FileBrowserComponent.
36 To attach a listener to it, use its DirectoryContentsDisplayComponent base
37 class and the FileBrowserListener class.
39 @see DirectoryContentsList, FileListComponent
41 @tags{GUI}
43 class JUCE_API FileTreeComponent : public TreeView,
44 public DirectoryContentsDisplayComponent
46 public:
47 //==============================================================================
48 /** Creates a listbox to show the contents of a specified directory.
50 FileTreeComponent (DirectoryContentsList& listToShow);
52 /** Destructor. */
53 ~FileTreeComponent() override;
55 //==============================================================================
56 /** Returns the number of files the user has got selected.
57 @see getSelectedFile
59 int getNumSelectedFiles() const override { return TreeView::getNumSelectedItems(); }
61 /** Returns one of the files that the user has currently selected.
62 The index should be in the range 0 to (getNumSelectedFiles() - 1).
63 @see getNumSelectedFiles
65 File getSelectedFile (int index = 0) const override;
67 /** Deselects any files that are currently selected. */
68 void deselectAllFiles() override;
70 /** Scrolls the list to the top. */
71 void scrollToTop() override;
73 /** If the specified file is in the list, it will become the only selected item
74 (and if the file isn't in the list, all other items will be deselected). */
75 void setSelectedFile (const File&) override;
77 /** Updates the files in the list. */
78 void refresh();
80 /** Setting a name for this allows tree items to be dragged.
82 The string that you pass in here will be returned by the getDragSourceDescription()
83 of the items in the tree. For more info, see TreeViewItem::getDragSourceDescription().
85 void setDragAndDropDescription (const String& description);
87 /** Returns the last value that was set by setDragAndDropDescription().
89 const String& getDragAndDropDescription() const noexcept { return dragAndDropDescription; }
91 /** Changes the height of the treeview items. */
92 void setItemHeight (int newHeight);
94 /** Returns the height of the treeview items. */
95 int getItemHeight() const noexcept { return itemHeight; }
97 private:
98 //==============================================================================
99 String dragAndDropDescription;
100 int itemHeight;
102 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileTreeComponent)
105 } // namespace juce