Start implementing untested ui_browser_window_cocoa_open function

This commit is contained in:
Twinaphex 2016-06-08 16:11:06 +02:00
parent d9e61e5153
commit 9e5ad14da0
2 changed files with 21 additions and 0 deletions

View File

@ -25,6 +25,25 @@
static bool ui_browser_window_cocoa_open(ui_browser_window_state_t *state)
{
NSOpenPanel* panel = (NSOpenPanel*)[NSOpenPanel openPanel];
NSArray *filetypes = [[NSArray alloc] initWithObjects:BOXSTRING("dylib"), BOXSTRING("Core"), nil];
[panel setAllowedFileTypes:filetypes];
#if defined(MAC_OS_X_VERSION_10_6)
[panel setMessage:BOXSTRING(state->title)];
if ([panel runModalForDirectory:BOXSTRING(state->path) file:nil] == 1)
return true;
#else
[panel setTitle:NSLocalizedString(BOXSTRING(string->title), BOXSTRING("open panel"))];
[panel setDirectory:BOXSTRING(state->startdir)];
[panel setCanChooseDirectories:NO];
[panel setCanChooseFiles:YES];
[panel setAllowsMultipleSelection:NO];
[panel setTreatsFilePackagesAsDirectories:NO];
NSInteger result = [panel runModal];
if (result == 1)
return true;
#endif
return false;
}

View File

@ -65,7 +65,9 @@ typedef struct ui_msg_window_state
typedef struct ui_browser_window_state
{
void *window;
char *filters;
char *startdir;
char *path;
char *title;
} ui_browser_window_state_t;