1 #ifndef _platform__wxwidgets__settings_common__hpp__included__
2 #define _platform__wxwidgets__settings_common__hpp__included__
5 #include "platform/wxwidgets/platform.hpp"
7 #include <wx/notebook.h>
8 #include <wx/treectrl.h>
10 #include <wx/control.h>
11 #include <wx/combobox.h>
12 #include <wx/spinctrl.h>
17 class emulator_instance
;
19 struct settings_tab
: public wxPanel
21 settings_tab(wxWindow
* parent
, emulator_instance
& _inst
) : wxPanel(parent
, -1), inst(_inst
),
22 closing_flag(false) {}
24 void notify_close() { closing_flag
= true; }
25 bool closing() { return closing_flag
; }
26 virtual void on_close() {}
27 virtual void on_notify() {}
28 void set_notify(std::function
<void()> _notify
) { notify
= _notify
; }
29 void do_notify() { notify(); }
31 emulator_instance
& inst
;
34 std::function
<void()> notify
;
37 struct settings_tab_factory
39 settings_tab_factory(const std::string
& tabname
, std::function
<settings_tab
*(wxWindow
* parent
,
40 emulator_instance
& inst
)> create_fn
);
41 ~settings_tab_factory();
42 settings_tab
* create(wxWindow
* parent
, emulator_instance
& inst
) { return _create_fn(parent
, inst
); }
43 std::string
get_name() { return _tabname
; }
44 static std::list
<settings_tab_factory
*> factories();
47 std::function
<settings_tab
*(wxWindow
* parent
, emulator_instance
& inst
)> _create_fn
;
50 struct settings_menu
: public wxMenu
52 settings_menu(wxWindow
* win
, emulator_instance
& _inst
, int wxid_low
);
53 void on_selected(wxCommandEvent
& e
);
55 emulator_instance
& inst
;
57 std::map
<int, settings_tab_factory
*> items
;
60 void display_settings_dialog(wxWindow
* parent
, emulator_instance
& inst
, settings_tab_factory
* singletab
= NULL
);
61 void settings_activate_keygrab(emulator_instance
& inst
, std::function
<void(std::string key
)> callback
);
62 void settings_deactivate_keygrab(emulator_instance
& inst
);