1#ifndef RME_HOTKEY_MANAGER_H
2#define RME_HOTKEY_MANAGER_H
3
4#include <map>
5#include <string>
6#include <functional>
7#include <wx/accel.h>
8#include "ext/pugixml.hpp"
9#include <set>
10
11class HotkeyManager {
12public:
13 HotkeyManager();
14 struct HotkeyInfo {
15 std::string key;
16 std::string description;
17 std::function<void()> callback;
18 };
19
20 void RegisterHotkey(const std::string& name, const std::string& defaultKey,
21 const std::string& description, std::function<void()> callback);
22 void LoadHotkeys();
23 void SaveHotkeys();
24 void ShowHotkeyDialog(wxWindow* parent);
25 std::map<std::string, HotkeyInfo> GetAllHotkeys() const;
26
27 // Convert between wxKeyCode and string representation
28 static wxString KeyCodeToString(int keyCode);
29 static int StringToKeyCode(const wxString& keyString);
30
31private:
32 std::map<std::string, HotkeyInfo> hotkeys;
33 std::set<int> currentModifiers;
34 void ApplyHotkeys();
35 void LoadHotkeysFromNode(pugi::xml_node& node);
36 void UpdateHotkeyString(wxTextCtrl* hotkeyEdit);
37
38 // Helper methods for hotkey dialog
39 void UpdateHotkeyList();
40 bool ValidateHotkeys();
41};
42
43extern HotkeyManager g_hotkey_manager;
44
45#endif // RME_HOTKEY_MANAGER_H
46