30 : maxNumberOfItems (10)
37 maxNumberOfItems =
jmax (1, newMaxNumber);
49 return File (files [index]);
80 const bool showFullPaths,
81 const bool dontAddNonExistentFiles,
82 const File** filesToAvoid)
90 if ((! dontAddNonExistentFiles) || f.
exists())
92 bool needsAvoiding =
false;
94 if (filesToAvoid !=
nullptr)
96 for (
const File** avoid = filesToAvoid; *avoid !=
nullptr; ++avoid)
100 needsAvoiding =
true;
108 menuToAddTo.
addItem (baseItemId + i,
128 files.
addLines (stringifiedVersion);
140 [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: createNSURLFromFile (file)];
154 auto sharedDocController = [NSDocumentController sharedDocumentController];
155 auto recentDocumentURLs = [sharedDocController recentDocumentURLs];
157 [sharedDocController clearRecentDocuments: nil];
159 auto* nsFile = createNSURLFromFile (file);
161 auto reverseEnumerator = [recentDocumentURLs reverseObjectEnumerator];
163 for (NSURL* url : reverseEnumerator)
164 if (! [url isEqual:nsFile])
165 [sharedDocController noteNewRecentDocumentURL:url];
175 [[NSDocumentController sharedDocumentController] clearRecentDocuments: nil];
Represents a local file or directory.
const String & getFullPathName() const noexcept
Returns the complete, absolute path of this file.
String getFileName() const
Returns the last section of the pathname.
bool exists() const
Checks whether the file actually exists.
static void forgetRecentFileNatively(const File &file)
Tells the OS to remove a file from the OS-managed list of recent documents for this app.
int getNumFiles() const
Returns the number of files in the list.
String toString() const
Returns a string that encapsulates all the files in the list.
void removeNonExistentFiles()
Checks each of the files in the list, removing any that don't exist.
RecentlyOpenedFilesList()
Creates an empty list.
int createPopupMenuItems(PopupMenu &menuToAddItemsTo, int baseItemId, bool showFullPaths, bool dontAddNonExistentFiles, const File **filesToAvoid=nullptr)
Adds entries to a menu, representing each of the files in the list.
void restoreFromString(const String &stringifiedVersion)
Restores the list from a previously stringified version of the list.
static void registerRecentFileNatively(const File &file)
Tells the OS to add a file to the OS-managed list of recent documents for this app.
File getFile(int index) const
Returns one of the files in the list.
void clear()
Clears all the files from the list.
static void clearRecentFilesNatively()
Tells the OS to clear the OS-managed list of recent documents for this app.
void addFile(const File &file)
Adds a file to the list.
void setMaxNumberOfItems(int newMaxNumber)
Sets a limit for the number of files that will be stored in the list.
void removeFile(const File &file)
Removes a file from the list.
String joinIntoString(StringRef separatorString, int startIndex=0, int numberOfElements=-1) const
Joins the strings in the array together into one string.
void insert(int index, String stringToAdd)
Inserts a string into the array.
void clear()
Removes all elements from the array.
void removeString(StringRef stringToRemove, bool ignoreCase=false)
Finds a string in the array and removes it.
int size() const noexcept
Returns the number of strings in the array.
int addLines(StringRef stringToBreakUp)
Breaks up a string into lines and adds them to this array.
void removeRange(int startIndex, int numberToRemove)
Removes a range of elements from the array.
void remove(int index)
Removes a string from the array.
#define JUCE_AUTORELEASEPOOL
A macro that can be used to easily declare a local ScopedAutoReleasePool object for RAII-based obj-C ...
constexpr Type jmax(Type a, Type b)
Returns the larger of two values.