add file picker to osx

This commit is contained in:
2019-09-07 11:39:45 +02:00
parent 14a037e2d3
commit 0d2777c4ae
4 changed files with 37 additions and 10 deletions

View File

@@ -204,15 +204,15 @@ void App::pick_file_save(std::vector<std::string> types, std::function<void (std
// [ios_view pick_photo:callback];
//});
#elif __OSX__
//dispatch_async(dispatch_get_main_queue(), ^{
// //NSArray* fileTypes = [NSArray arrayWithObjects:@"ppi", @"PPI", nil];
// NSMutableArray<NSString*>* fileTypes = [NSMutableArray arrayWithCapacity:types.size()];
// for (const auto& t : types)
// [fileTypes addObject:[NSString stringWithCString:t.c_str() encoding:NSUTF8StringEncoding]];
// std::string path = [osx_view pick_file:fileTypes];
// if (!path.empty())
// callback(path);
//});
dispatch_async(dispatch_get_main_queue(), ^{
//NSArray* fileTypes = [NSArray arrayWithObjects:@"ppi", @"PPI", nil];
NSMutableArray<NSString*>* fileTypes = [NSMutableArray arrayWithCapacity:types.size()];
for (const auto& t : types)
[fileTypes addObject:[NSString stringWithCString:t.c_str() encoding:NSUTF8StringEncoding]];
std::string path = [osx_view pick_file_save:fileTypes];
if (!path.empty())
callback(path);
});
#elif __ANDROID__
//android_pick_file(callback);
#elif _WIN32

View File

@@ -13,7 +13,7 @@ public:
NodeBorder* m_progress;
NodeBorder* m_body;
int m_total = 0;
std::atomic_int m_count = 0;
std::atomic_int m_count{0};
virtual Node* clone_instantiate() const override;
virtual void init() override;
void increment() noexcept;