diff options
| author | Tim Redfern <tim@getdrop.com> | 2018-09-10 23:24:49 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@getdrop.com> | 2018-09-10 23:24:49 +0100 |
| commit | a0b504d11542097843db77653d3e26516a892593 (patch) | |
| tree | 5bec9beb2a84a831059ada24c5523f27193ee8e2 /gui/src/threadedSystemDialogs.cpp | |
| parent | fa5fc1eeaf7925024575f7154be1684534a62071 (diff) | |
lut blend
Diffstat (limited to 'gui/src/threadedSystemDialogs.cpp')
| -rw-r--r-- | gui/src/threadedSystemDialogs.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gui/src/threadedSystemDialogs.cpp b/gui/src/threadedSystemDialogs.cpp new file mode 100644 index 0000000..597312f --- /dev/null +++ b/gui/src/threadedSystemDialogs.cpp @@ -0,0 +1,29 @@ + +#include "threadedSystemDialogs.h" +#include "ofMain.h" + +void threadedSystemLoadDialog::load(std::string _caption,std::function<bool(std::string)> _callback){ //bool (*_callback)(std::string filename)){ + caption=_caption; + load_callback=_callback; + startThread(); +} + +void threadedSystemLoadDialog::threadedFunction() { + setThreadName("threadedSystemLoadDialog " + ofToString(thread.get_id())); + ofFileDialogResult openFileResult= ofSystemLoadDialog(caption); + + //Check if the user opened a file + if (openFileResult.bSuccess){ + + + bool success=load_callback(openFileResult.fileName); + + ofLogVerbose("Load %s %s\n", + openFileResult.filePath.c_str(), + success?"succeeded":"failed"); + + + }else { + ofLogVerbose("User hit cancel"); + } +}
\ No newline at end of file |
