mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
added a flag to FileBrowserComponent so it can optionally use a treeview to show the files
This commit is contained in:
parent
205304c3a9
commit
e45d1fb725
3 changed files with 22 additions and 9 deletions
|
|
@ -10,7 +10,7 @@ Changelist for version 1.44
|
||||||
- changed the MouseEvent structure so that it now contains a pointer to the event component and also the original component.
|
- changed the MouseEvent structure so that it now contains a pointer to the event component and also the original component.
|
||||||
- added a PopupMenu::dismissAllActiveMenus() method.
|
- added a PopupMenu::dismissAllActiveMenus() method.
|
||||||
- added the JUCE_LOG_ASSERTIONS flag, which can automatically log assertion failures, even in release builds.
|
- added the JUCE_LOG_ASSERTIONS flag, which can automatically log assertion failures, even in release builds.
|
||||||
- new classes DirectoryContentsDisplayComponent and FileTreeComponent, allow a view of a directory as either a list or treeview. I've added a demo of the FileTreeComponent to the treeviews section of the Juce Demo.
|
- new classes DirectoryContentsDisplayComponent and FileTreeComponent, allow a view of a directory as either a list or treeview. I've added a demo of the FileTreeComponent to the treeviews section of the Juce Demo. There's also now an option in the FileBrowserComponent constructor to use a treeview.
|
||||||
- small change to the strictness of the way TreeViews handle their root items. Be careful now to never delete a tree's root item until either the treeview has been deleted, or until you've removed the root from the tree using setRootItem (0). Not doing this can now cause a crash in the tree's destructor, where it expects the root to still be valid.
|
- small change to the strictness of the way TreeViews handle their root items. Be careful now to never delete a tree's root item until either the treeview has been deleted, or until you've removed the root from the tree using setRootItem (0). Not doing this can now cause a crash in the tree's destructor, where it expects the root to still be valid.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ BEGIN_JUCE_NAMESPACE
|
||||||
#include "../../../../juce_core/text/juce_LocalisedStrings.h"
|
#include "../../../../juce_core/text/juce_LocalisedStrings.h"
|
||||||
#include "../../../../juce_core/basics/juce_SystemStats.h"
|
#include "../../../../juce_core/basics/juce_SystemStats.h"
|
||||||
#include "juce_FileListComponent.h"
|
#include "juce_FileListComponent.h"
|
||||||
|
#include "juce_FileTreeComponent.h"
|
||||||
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
@ -56,7 +57,8 @@ public:
|
||||||
FileBrowserComponent::FileBrowserComponent (FileChooserMode mode_,
|
FileBrowserComponent::FileBrowserComponent (FileChooserMode mode_,
|
||||||
const File& initialFileOrDirectory,
|
const File& initialFileOrDirectory,
|
||||||
const FileFilter* fileFilter,
|
const FileFilter* fileFilter,
|
||||||
FilePreviewComponent* previewComp_)
|
FilePreviewComponent* previewComp_,
|
||||||
|
const bool useTreeView)
|
||||||
: directoriesOnlyFilter (0),
|
: directoriesOnlyFilter (0),
|
||||||
mode (mode_),
|
mode (mode_),
|
||||||
listeners (2),
|
listeners (2),
|
||||||
|
|
@ -84,13 +86,21 @@ FileBrowserComponent::FileBrowserComponent (FileChooserMode mode_,
|
||||||
|
|
||||||
fileList = new DirectoryContentsList (fileFilter, thread);
|
fileList = new DirectoryContentsList (fileFilter, thread);
|
||||||
|
|
||||||
// this component could alternatively be a FileTreeComponent
|
if (useTreeView)
|
||||||
FileListComponent* const list = new FileListComponent (*fileList);
|
{
|
||||||
list->setOutlineThickness (1);
|
FileTreeComponent* const tree = new FileTreeComponent (*fileList);
|
||||||
|
addAndMakeVisible (tree);
|
||||||
|
fileListComponent = tree;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FileListComponent* const list = new FileListComponent (*fileList);
|
||||||
|
list->setOutlineThickness (1);
|
||||||
|
addAndMakeVisible (list);
|
||||||
|
fileListComponent = list;
|
||||||
|
}
|
||||||
|
|
||||||
fileListComponent = list;
|
fileListComponent->addListener (this);
|
||||||
addAndMakeVisible (list);
|
|
||||||
list->addListener (this);
|
|
||||||
|
|
||||||
addAndMakeVisible (currentPathBox = new ComboBox (T("path")));
|
addAndMakeVisible (currentPathBox = new ComboBox (T("path")));
|
||||||
currentPathBox->setEditableText (true);
|
currentPathBox->setEditableText (true);
|
||||||
|
|
|
||||||
|
|
@ -89,11 +89,14 @@ public:
|
||||||
is deleted.
|
is deleted.
|
||||||
@param previewComp an optional preview component that will be used to
|
@param previewComp an optional preview component that will be used to
|
||||||
show previews of files that the user selects
|
show previews of files that the user selects
|
||||||
|
@param useTreeView if this is false, the files are shown in a list; if true,
|
||||||
|
they are shown in a treeview
|
||||||
*/
|
*/
|
||||||
FileBrowserComponent (FileChooserMode browserMode,
|
FileBrowserComponent (FileChooserMode browserMode,
|
||||||
const File& initialFileOrDirectory,
|
const File& initialFileOrDirectory,
|
||||||
const FileFilter* fileFilter,
|
const FileFilter* fileFilter,
|
||||||
FilePreviewComponent* previewComp);
|
FilePreviewComponent* previewComp,
|
||||||
|
const bool useTreeView = false);
|
||||||
|
|
||||||
/** Destructor. */
|
/** Destructor. */
|
||||||
~FileBrowserComponent();
|
~FileBrowserComponent();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue