1 #ifndef _platform__wxwidgets__settings_common__hpp__included__
2 #define _platform__wxwidgets__settings_common__hpp__included__
6 #include "platform/wxwidgets/platform.hpp"
8 #include <wx/notebook.h>
9 #include <wx/treectrl.h>
11 #include <wx/control.h>
12 #include <wx/combobox.h>
13 #include <wx/spinctrl.h>
18 class emulator_instance
;
20 struct settings_tab
: public wxPanel
22 settings_tab(wxWindow
* parent
, emulator_instance
& _inst
) : wxPanel(parent
, -1), inst(_inst
),
23 closing_flag(false) {}
25 void notify_close() { closing_flag
= true; }
26 bool closing() { return closing_flag
; }
27 virtual void on_close() {}
28 virtual void on_notify() {}
29 void set_notify(std::function
<void()> _notify
) { notify
= _notify
; }
30 void do_notify() { notify(); }
32 emulator_instance
& inst
;
35 std::function
<void()> notify
;
38 struct settings_tab_factory
40 settings_tab_factory(const std::string
& tabname
, std::function
<settings_tab
*(wxWindow
* parent
,
41 emulator_instance
& inst
)> create_fn
);
42 ~settings_tab_factory();
43 settings_tab
* create(wxWindow
* parent
, emulator_instance
& inst
) { return _create_fn(parent
, inst
); }
44 std::string
get_name() { return _tabname
; }
45 static std::list
<settings_tab_factory
*> factories();
48 std::function
<settings_tab
*(wxWindow
* parent
, emulator_instance
& inst
)> _create_fn
;
51 struct settings_menu
: public wxMenu
53 settings_menu(wxWindow
* win
, emulator_instance
& _inst
, int wxid_low
);
54 void on_selected(wxCommandEvent
& e
);
56 emulator_instance
& inst
;
58 std::map
<int, settings_tab_factory
*> items
;
61 void display_settings_dialog(wxWindow
* parent
, emulator_instance
& inst
, settings_tab_factory
* singletab
= NULL
);
62 void settings_activate_keygrab(emulator_instance
& inst
, std::function
<void(std::string key
)> callback
);
63 void settings_deactivate_keygrab(emulator_instance
& inst
);