/* RetroArch - A frontend for libretro. * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. * * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with RetroArch. * If not, see . */ #include #include #include #include #include #include #include "cocoa_common_metal.h" #include "../../ui_companion_driver.h" static bool ui_browser_window_cocoa_open(ui_browser_window_state_t *state) { NSOpenPanel *panel = [NSOpenPanel openPanel]; if (!string_is_empty(state->filters)) { [panel setAllowedFileTypes:@[BOXSTRING(state->filters), BOXSTRING(state->filters_title)]]; } panel.title = NSLocalizedString(BOXSTRING(state->title), BOXSTRING("open panel")); panel.directoryURL = [NSURL fileURLWithPath:BOXSTRING(state->startdir)]; panel.canChooseDirectories = NO; panel.canChooseFiles = YES; panel.allowsMultipleSelection = NO; panel.treatsFilePackagesAsDirectories = NO; NSModalResponse result = [panel runModal]; if (result != NSModalResponseOK) return false; const char *res_path = [panel.URL.path UTF8String]; state->result = strdup(res_path); return true; } static bool ui_browser_window_cocoa_save(ui_browser_window_state_t *state) { return false; } ui_browser_window_t ui_browser_window_cocoa = { ui_browser_window_cocoa_open, ui_browser_window_cocoa_save, "cocoa" };