RetroArch/ui/drivers/win32/ui_win32_browser_window.c

63 lines
1.9 KiB
C
Raw Normal View History

/* RetroArch - A frontend for libretro.
2017-01-22 13:40:32 +01:00
* 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 <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <boolean.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include "../../ui_companion_driver.h"
2016-07-10 00:43:42 +02:00
static bool ui_browser_window_win32_core(ui_browser_window_state_t *state, bool save)
{
2016-07-09 20:39:02 +02:00
OPENFILENAME ofn = {};
2016-06-09 12:34:39 +02:00
2016-12-02 23:36:23 -05:00
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = (HWND)state->window;
ofn.lpstrFilter = state->filters; /* actually const */
2016-06-09 12:34:39 +02:00
ofn.lpstrFile = state->path;
ofn.lpstrTitle = state->title;
ofn.lpstrInitialDir = state->startdir;
2016-12-02 23:36:23 -05:00
ofn.lpstrDefExt = "";
2016-06-09 12:34:39 +02:00
ofn.nMaxFile = PATH_MAX;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_NOCHANGEDIR;
if (!save && !GetOpenFileName(&ofn))
2016-12-02 23:36:23 -05:00
return false;
if ( save && !GetSaveFileName(&ofn))
2016-12-02 23:36:23 -05:00
return false;
2016-06-09 12:34:39 +02:00
2016-12-02 23:36:23 -05:00
return true;
}
2016-07-09 20:39:02 +02:00
static bool ui_browser_window_win32_open(ui_browser_window_state_t *state)
{
2016-07-10 00:43:42 +02:00
return ui_browser_window_win32_core(state, false);
2016-07-09 20:39:02 +02:00
}
static bool ui_browser_window_win32_save(ui_browser_window_state_t *state)
{
2016-07-10 00:43:42 +02:00
return ui_browser_window_win32_core(state, true);
}
const ui_browser_window_t ui_browser_window_win32 = {
ui_browser_window_win32_open,
ui_browser_window_win32_save,
"win32"
};