GUI: use Native File Dialog on Windows/macOS
latter is untested
This commit is contained in:
parent
d5d381328b
commit
d8513e0856
3 changed files with 114 additions and 0 deletions
|
|
@ -3,10 +3,19 @@
|
|||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
#if defined(_WIN32) || defined(__APPLE__)
|
||||
#define USE_NFD
|
||||
#endif
|
||||
|
||||
#ifdef USE_NFD
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
#else
|
||||
namespace pfd {
|
||||
class open_file;
|
||||
class save_file;
|
||||
}
|
||||
#endif
|
||||
|
||||
typedef std::function<void(const char*)> FileDialogSelectCallback;
|
||||
|
||||
|
|
@ -16,8 +25,15 @@ class FurnaceGUIFileDialog {
|
|||
bool saving;
|
||||
String curPath;
|
||||
String fileName;
|
||||
#ifdef USE_NFD
|
||||
std::thread* dialogO;
|
||||
std::thread* dialogS;
|
||||
std::atomic<bool> dialogOK;
|
||||
String nfdResult;
|
||||
#else
|
||||
pfd::open_file* dialogO;
|
||||
pfd::save_file* dialogS;
|
||||
#endif
|
||||
public:
|
||||
bool openLoad(String header, std::vector<String> filter, const char* noSysFilter, String path, double dpiScale, FileDialogSelectCallback clickCallback=NULL);
|
||||
bool openSave(String header, std::vector<String> filter, const char* noSysFilter, String path, double dpiScale);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue