fix some ui glitch with NodeButton, start implementing working dir option

This commit is contained in:
2018-10-06 16:17:42 +02:00
parent 739784b0d1
commit 05decb6a05
9 changed files with 74 additions and 16 deletions

View File

@@ -61,6 +61,26 @@ std::mutex task_mutex;
}
return ret;
}
- (std::string)pick_dir
{
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseFiles:NO];
[panel setCanChooseDirectories:YES];
[panel setAllowsMultipleSelection:NO]; // yes if more than one dir is allowed
NSInteger clicked = [panel runModal];
std::string ret;
if (clicked == NSFileHandlingPanelOKButton)
{
for (NSURL *url in [panel URLs])
{
LOG("selected path: %s", [[url path] cStringUsingEncoding:NSUTF8StringEncoding]);
ret = [[url path] cStringUsingEncoding:NSUTF8StringEncoding];
}
}
return ret;
}
- (instancetype)initWithFrame:(NSRect)frameRect
{
gl_ready = false;

View File

@@ -23,4 +23,5 @@
- (void)async_unlock;
- (void)async_swap;
- (std::string)pick_file:(NSArray<NSString*>*)types;
- (std::string)pick_dir;
@end