openshot-audio  0.1.2
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) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_FILENAMECOMPONENT_H_INCLUDED
26 #define JUCE_FILENAMECOMPONENT_H_INCLUDED
27 
28 
29 //==============================================================================
39 {
40 public:
43 
45  virtual void filenameComponentChanged (FilenameComponent* fileComponentThatHasChanged) = 0;
46 };
47 
48 
49 //==============================================================================
64  public SettableTooltipClient,
65  public FileDragAndDropTarget,
66  private AsyncUpdater,
67  private ButtonListener, // (can't use Button::Listener due to idiotic VC2005 bug)
68  private ComboBoxListener
69 {
70 public:
71  //==============================================================================
90  FilenameComponent (const String& name,
91  const File& currentFile,
92  bool canEditFilename,
93  bool isDirectory,
94  bool isForSaving,
95  const String& fileBrowserWildcard,
96  const String& enforcedSuffix,
97  const String& textWhenNothingSelected);
98 
101 
102  //==============================================================================
104  File getCurrentFile() const;
105 
107  String getCurrentFileText() const;
108 
116  void setCurrentFile (File newFile,
117  bool addToRecentlyUsedList,
118  NotificationType notification = sendNotificationAsync);
119 
122  void setFilenameIsEditable (bool shouldBeEditable);
123 
128  void setDefaultBrowseTarget (const File& newDefaultDirectory);
129 
135  virtual File getLocationToBrowse();
136 
144  StringArray getRecentlyUsedFilenames() const;
145 
153  void setRecentlyUsedFilenames (const StringArray& filenames);
154 
162  void addRecentlyUsedFile (const File& file);
163 
166  void setMaxNumberOfRecentFiles (int newMaximum);
167 
174  void setBrowseButtonText (const String& browseButtonText);
175 
176  //==============================================================================
178  void addListener (FilenameComponentListener* listener);
179 
181  void removeListener (FilenameComponentListener* listener);
182 
184  void setTooltip (const String& newTooltip) override;
185 
186  //==============================================================================
189  {
190  virtual ~LookAndFeelMethods() {}
191 
192  virtual Button* createFilenameComponentBrowseButton (const String& text) = 0;
193  virtual void layoutFilenameComponent (FilenameComponent&, ComboBox* filenameBox, Button* browseButton) = 0;
194  };
195 
196  //==============================================================================
198  void paintOverChildren (Graphics&) override;
200  void resized() override;
202  void lookAndFeelChanged() override;
204  bool isInterestedInFileDrag (const StringArray&) override;
206  void filesDropped (const StringArray&, int, int) override;
208  void fileDragEnter (const StringArray&, int, int) override;
210  void fileDragExit (const StringArray&) override;
212  KeyboardFocusTraverser* createFocusTraverser() override;
213 
214 private:
215  //==============================================================================
216  ComboBox filenameBox;
217  String lastFilename;
218  ScopedPointer<Button> browseButton;
219  int maxRecentFiles;
220  bool isDir, isSaving, isFileDragOver;
221  String wildcard, enforcedSuffix, browseButtonText;
223  File defaultBrowseFile;
224 
225  void comboBoxChanged (ComboBox*) override;
226  void buttonClicked (Button*) override;
227  void handleAsyncUpdate() override;
228 
230 };
231 
232 
233 
234 #endif // JUCE_FILENAMECOMPONENT_H_INCLUDED
void removeListener(Listener *listener)
Definition: juce_Button.cpp:389
Definition: juce_NotificationType.h:38
Definition: juce_FileDragAndDropTarget.h:33
virtual ~LookAndFeelMethods()
Definition: juce_FilenameComponent.h:190
Definition: juce_Button.h:39
Definition: juce_String.h:43
virtual ~FilenameComponentListener()
Definition: juce_FilenameComponent.h:42
void addListener(Listener *newListener)
Definition: juce_Button.cpp:384
#define JUCE_API
Definition: juce_StandardHeader.h:139
Definition: juce_AsyncUpdater.h:39
NotificationType
Definition: juce_NotificationType.h:33
Definition: juce_TooltipClient.h:63
Definition: juce_ComboBox.h:284
Definition: juce_KeyboardFocusTraverser.h:49
Definition: juce_Component.h:33
Definition: juce_Button.h:162
Definition: juce_FilenameComponent.h:188
Definition: juce_StringArray.h:39
Definition: juce_FilenameComponent.h:38
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
Definition: juce_PlatformDefs.h:198
Definition: juce_GraphicsContext.h:42
void setTooltip(const String &newTooltip) override
Definition: juce_Button.cpp:122
Definition: juce_ComboBox.h:44
Definition: juce_File.h:45
Definition: juce_FilenameComponent.h:63