From 227e7d70f958abb0a430d908c15d8608ff157dd6 Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 26 Jun 2013 12:40:16 +0100 Subject: [PATCH] Added method FileBrowserComponent::getDefaultRoots() --- .../filebrowser/juce_FileBrowserComponent.cpp | 7 ++++++- .../filebrowser/juce_FileBrowserComponent.h | 10 +++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp b/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp index e6667223c5..8777ce675e 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp +++ b/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.cpp @@ -497,7 +497,7 @@ void FileBrowserComponent::comboBoxChanged (ComboBox*) } } -void FileBrowserComponent::getRoots (StringArray& rootNames, StringArray& rootPaths) +void FileBrowserComponent::getDefaultRoots (StringArray& rootNames, StringArray& rootPaths) { #if JUCE_WINDOWS Array roots; @@ -571,3 +571,8 @@ void FileBrowserComponent::getRoots (StringArray& rootNames, StringArray& rootPa rootNames.add ("Desktop"); #endif } + +void FileBrowserComponent::getRoots (StringArray& rootNames, StringArray& rootPaths) +{ + getDefaultRoots (rootNames, rootPaths); +} diff --git a/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.h b/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.h index 1122b80569..bf938cedef 100644 --- a/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.h +++ b/modules/juce_gui_basics/filebrowser/juce_FileBrowserComponent.h @@ -176,6 +176,12 @@ public: */ void removeListener (FileBrowserListener* listener); + /** Returns a platform-specific list of names and paths for some suggested places the user + might want to use as root folders. + The list returned contains empty strings to indicate section breaks. + @see getRoots() + */ + static void getDefaultRoots (StringArray& rootNames, StringArray& rootPaths); //============================================================================== /** @internal */ @@ -215,7 +221,9 @@ public: protected: /** Returns a list of names and paths for the default places the user might want to look. - Use an empty string to indicate a section break. + + By default this just calls getDefaultRoots(), but you may want to override it to + return a custom list. */ virtual void getRoots (StringArray& rootNames, StringArray& rootPaths);