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_FilenameComponent.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//==============================================================================
41{
42public:
44 virtual ~FilenameComponentListener() = default;
45
47 virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
48};
49
50
51//==============================================================================
67class JUCE_API FilenameComponent : public Component,
70 private AsyncUpdater
71{
72public:
73 //==============================================================================
92 FilenameComponent (const String& name,
93 const File& currentFile,
94 bool canEditFilename,
95 bool isDirectory,
96 bool isForSaving,
97 const String& fileBrowserWildcard,
98 const String& enforcedSuffix,
99 const String& textWhenNothingSelected);
100
102 ~FilenameComponent() override;
103
104 //==============================================================================
106 File getCurrentFile() const;
107
109 String getCurrentFileText() const;
110
119 void setCurrentFile (File newFile,
120 bool addToRecentlyUsedList,
122
125 void setFilenameIsEditable (bool shouldBeEditable);
126
131 void setDefaultBrowseTarget (const File& newDefaultDirectory);
132
138 virtual File getLocationToBrowse();
139
147 StringArray getRecentlyUsedFilenames() const;
148
156 void setRecentlyUsedFilenames (const StringArray& filenames);
157
165 void addRecentlyUsedFile (const File& file);
166
169 void setMaxNumberOfRecentFiles (int newMaximum);
170
177 void setBrowseButtonText (const String& browseButtonText);
178
179 //==============================================================================
181 void addListener (FilenameComponentListener* listener);
182
184 void removeListener (FilenameComponentListener* listener);
185
187 void setTooltip (const String& newTooltip) override;
188
189 //==============================================================================
191 struct JUCE_API LookAndFeelMethods
192 {
193 virtual ~LookAndFeelMethods() = default;
194
195 virtual Button* createFilenameComponentBrowseButton (const String& text) = 0;
196 virtual void layoutFilenameComponent (FilenameComponent&, ComboBox* filenameBox, Button* browseButton) = 0;
197 };
198
199 //==============================================================================
201 void paintOverChildren (Graphics&) override;
203 void resized() override;
205 void lookAndFeelChanged() override;
207 bool isInterestedInFileDrag (const StringArray&) override;
209 void filesDropped (const StringArray&, int, int) override;
211 void fileDragEnter (const StringArray&, int, int) override;
213 void fileDragExit (const StringArray&) override;
215 std::unique_ptr<ComponentTraverser> createKeyboardFocusTraverser() override;
216
217private:
218 //==============================================================================
219 void handleAsyncUpdate() override;
220
221 void showChooser();
222
223 ComboBox filenameBox;
224 String lastFilename;
225 std::unique_ptr<Button> browseButton;
226 int maxRecentFiles = 30;
227 bool isDir, isSaving, isFileDragOver = false;
228 String wildcard, enforcedSuffix, browseButtonText;
229 ListenerList <FilenameComponentListener> listeners;
230 File defaultBrowseFile;
232
234};
235
236} // namespace juce
Has a callback method that is triggered asynchronously.
A base class for buttons.
Definition juce_Button.h:43
A component that lets the user choose from a drop-down list of choices.
The base class for all JUCE user-interface objects.
Components derived from this class can have files dropped onto them by an external application.
Represents a local file or directory.
Definition juce_File.h:45
Listens for events happening to a FilenameComponent.
virtual void filenameComponentChanged(FilenameComponent *fileComponentThatHasChanged)=0
This method is called after the FilenameComponent's file has been changed.
virtual ~FilenameComponentListener()=default
Destructor.
Shows a filename as an editable text box, with a 'browse' button and a drop-down list for recently se...
A graphics context, used for drawing a component or image.
An implementation of TooltipClient that stores the tooltip string and a method for changing it.
A special array for holding a list of strings.
The JUCE String class!
Definition juce_String.h:53
#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.
NotificationType
These enums are used in various classes to indicate whether a notification event should be sent out.
@ sendNotificationAsync
Requests an asynchronous notification.
This abstract base class is implemented by LookAndFeel classes.