|
@@ -1,16 +1,16 @@
|
|
|
/*
|
|
/*
|
|
|
Copyright (C) 2012 by Ivan Safrin
|
|
Copyright (C) 2012 by Ivan Safrin
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
in the Software without restriction, including without limitation the rights
|
|
in the Software without restriction, including without limitation the rights
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
furnished to do so, subject to the following conditions:
|
|
furnished to do so, subject to the following conditions:
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
all copies or substantial portions of the Software.
|
|
all copies or substantial portions of the Software.
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
@@ -31,7 +31,7 @@
|
|
|
#include "PolyInputEvent.h"
|
|
#include "PolyInputEvent.h"
|
|
|
|
|
|
|
|
namespace Polycode {
|
|
namespace Polycode {
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
class CreateFolderWindow : public UIWindow {
|
|
class CreateFolderWindow : public UIWindow {
|
|
|
public:
|
|
public:
|
|
|
CreateFolderWindow();
|
|
CreateFolderWindow();
|
|
@@ -57,22 +57,54 @@ namespace Polycode {
|
|
|
ScreenImage *icon;
|
|
ScreenImage *icon;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * A dialog that allows the user to choose a file or directory from a
|
|
|
|
|
+ * file system.
|
|
|
|
|
+ */
|
|
|
class UIFileDialog : public UIWindow {
|
|
class UIFileDialog : public UIWindow {
|
|
|
public:
|
|
public:
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Create a new file dialog.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param baseDir The top-level directory, only entries in this directory and below can be selected.
|
|
|
|
|
+ * @param foldersOnly If true, directories will be selected. If false, files will be selected.
|
|
|
|
|
+ * @param extensions A list of accepted file extensions.
|
|
|
|
|
+ * @param allowMultiple If true, multiple entries can be selected at once.
|
|
|
|
|
+ */
|
|
|
UIFileDialog(String baseDir, bool foldersOnly, std::vector<String> extensions, bool allowMultiple);
|
|
UIFileDialog(String baseDir, bool foldersOnly, std::vector<String> extensions, bool allowMultiple);
|
|
|
virtual ~UIFileDialog();
|
|
virtual ~UIFileDialog();
|
|
|
|
|
|
|
|
void onClose();
|
|
void onClose();
|
|
|
void handleEvent(Event *event);
|
|
void handleEvent(Event *event);
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Clears all entries in the file dialog.
|
|
|
|
|
+ */
|
|
|
void clearEntries();
|
|
void clearEntries();
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Set a new top-level directory to display.
|
|
|
|
|
+ */
|
|
|
void showFolder(String folderPath);
|
|
void showFolder(String folderPath);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Returns whether a file with a specific file extension
|
|
|
|
|
+ * can be selected.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param extension The file extension to be tested.
|
|
|
|
|
+ */
|
|
|
bool canOpen(String extension);
|
|
bool canOpen(String extension);
|
|
|
|
|
|
|
|
void addToSidebar(String path, String name);
|
|
void addToSidebar(String path, String name);
|
|
|
|
|
|
|
|
void Update();
|
|
void Update();
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Get the selected entry.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return Full path of the selected entry
|
|
|
|
|
+ * (base path + relative path to top level directory)
|
|
|
|
|
+ */
|
|
|
String getSelection();
|
|
String getSelection();
|
|
|
protected:
|
|
protected:
|
|
|
|
|
|
|
@@ -99,7 +131,7 @@ namespace Polycode {
|
|
|
std::vector<String> extensions;
|
|
std::vector<String> extensions;
|
|
|
std::vector<UIFileDialogEntry*> entries;
|
|
std::vector<UIFileDialogEntry*> entries;
|
|
|
std::vector<UIFileDialogEntry*> sideBarEntries;
|
|
std::vector<UIFileDialogEntry*> sideBarEntries;
|
|
|
- UIElement *entryHolder;
|
|
|
|
|
|
|
+ UIElement *entryHolder;
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|