Fix number of compile errors and warnings with GCC 14
[lsnes.git] / include / platform / wxwidgets / loadsave.hpp
blob6475de48a66b33bdbf5c7c2b0fe09e643d15ab7c
1 #ifndef _platform__wxwidgets__loadsave__hpp__included__
2 #define _platform__wxwidgets__loadsave__hpp__included__
4 #include <string>
5 #include "platform/wxwidgets/platform.hpp"
7 struct filedialog_type_entry
9 filedialog_type_entry(std::string _name, std::string _extensions, std::string _primaryext)
11 name = _name;
12 extensions = _extensions;
13 primaryext = _primaryext;
15 std::string name;
16 std::string extensions;
17 std::string primaryext;
20 struct filedialog_input_params
22 std::vector<filedialog_type_entry> types;
23 int default_type;
24 std::string default_filename;
27 struct filedialog_output_params
29 std::string path;
30 int typechoice;
33 class single_type
35 public:
36 typedef std::string returntype;
37 single_type(const std::string& _ext, const std::string& _desc = "");
38 filedialog_input_params input(bool save) const;
39 std::string output(const filedialog_output_params& p, bool save) const;
40 private:
41 std::string ext;
42 std::string desc;
45 class lua_script_type
47 public:
48 typedef std::string returntype;
49 filedialog_input_params input(bool save) const;
50 std::string output(const filedialog_output_params& p, bool save) const;
53 extern lua_script_type filetype_lua_script;
54 extern single_type filetype_macro;
55 extern single_type filetype_watch;
56 extern single_type filetype_commentary;
57 extern single_type filetype_sox;
58 extern single_type filetype_sub;
59 extern single_type filetype_png;
60 extern single_type filetype_hexbookmarks;
61 extern single_type filetype_memorysearch;
62 extern single_type filetype_textfile;
63 extern single_type filetype_trace;
64 extern single_type filetype_font;
65 extern single_type filetype_disassembly;
66 extern single_type filetype_r16m;
68 filedialog_output_params show_filedialog(wxWindow* parent, const std::string& title, const std::string& basepath,
69 const filedialog_input_params& p, const std::string& defaultname, bool saving);
71 template<typename T>
72 typename T::returntype choose_file_load(wxWindow* parent, const std::string& title, const std::string& basepath,
73 const T& types, const std::string& defaultname = "")
75 filedialog_input_params p = types.input(false);
76 filedialog_output_params q = show_filedialog(parent, title, basepath, p, defaultname, false);
77 return types.output(q, false);
80 template<typename T>
81 typename T::returntype choose_file_save(wxWindow* parent, const std::string& title, const std::string& basepath,
82 const T& types, const std::string& defaultname = "")
84 filedialog_input_params p = types.input(true);
85 filedialog_output_params q = show_filedialog(parent, title, basepath, p, defaultname, true);
86 return types.output(q, true);
90 #endif