JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_FileChooser.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
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.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29//==============================================================================
55class JUCE_API FileChooser
56{
57public:
58 //==============================================================================
115 FileChooser (const String& dialogBoxTitle,
116 const File& initialFileOrDirectory = File(),
117 const String& filePatternsAllowed = String(),
118 bool useOSNativeDialogBox = true,
119 bool treatFilePackagesAsDirectories = false,
120 Component* parentComponent = nullptr);
121
123 ~FileChooser();
124
125 //==============================================================================
126 #if JUCE_MODAL_LOOPS_PERMITTED
140 bool browseForFileToOpen (FilePreviewComponent* previewComponent = nullptr);
141
147 bool browseForMultipleFilesToOpen (FilePreviewComponent* previewComponent = nullptr);
148
162 bool browseForFileToSave (bool warnAboutOverwritingExistingFiles);
163
174 bool browseForDirectory();
175
181 bool browseForMultipleFilesOrDirectories (FilePreviewComponent* previewComponent = nullptr);
182
183 //==============================================================================
192 bool showDialog (int flags, FilePreviewComponent* previewComponent);
193 #endif
194
207 void launchAsync (int flags,
208 std::function<void (const FileChooser&)>,
209 FilePreviewComponent* previewComponent = nullptr);
210
211 //==============================================================================
228 File getResult() const;
229
241 Array<File> getResults() const noexcept;
242
243 //==============================================================================
261 URL getURLResult() const;
262
284 const Array<URL>& getURLResults() const noexcept { return results; }
285
286 //==============================================================================
294 static bool isPlatformDialogAvailable();
295
306 static void registerCustomMimeTypeForFileExtension (const String& mimeType,
307 const String& fileExtension);
308
309 //==============================================================================
310 #ifndef DOXYGEN
311 class Native;
312 #endif
313
314private:
315 //==============================================================================
316 String title, filters;
317 File startingFile;
318 Component* parent;
319 Array<URL> results;
320 const bool useNativeDialogBox;
321 const bool treatFilePackagesAsDirs;
322 std::function<void (const FileChooser&)> asyncCallback;
323
324 //==============================================================================
325 void finished (const Array<URL>&);
326
327 //==============================================================================
328 struct Pimpl
329 {
330 virtual ~Pimpl() = default;
331
332 virtual void launch() = 0;
333 virtual void runModally() = 0;
334 };
335
337
338 //==============================================================================
339 std::shared_ptr<Pimpl> createPimpl (int, FilePreviewComponent*);
340 static std::shared_ptr<Pimpl> showPlatformDialog (FileChooser&, int, FilePreviewComponent*);
341
342 class NonNative;
343 friend class NonNative;
344 friend class Native;
345
347};
348
349} // namespace juce
Holds a resizable array of primitive or copy-by-value objects.
Definition juce_Array.h:56
The base class for all JUCE user-interface objects.
Creates a dialog box to choose a file or directory to load or save.
const Array< URL > & getURLResults() const noexcept
Returns a list of all the files that were chosen during the last call to a browse method.
Base class for components that live inside a file chooser dialog box and show previews of the files t...
Represents a local file or directory.
Definition juce_File.h:45
The JUCE String class!
Definition juce_String.h:53
Represents a URL and has a bunch of useful functions to manipulate it.
Definition juce_URL.h:38
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
This is a shorthand way of writing both a JUCE_DECLARE_NON_COPYABLE and JUCE_LEAK_DETECTOR macro for ...
JUCE Namespace.