forked from Wirless/IdlersMapEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhotkey_manager.h
More file actions
45 lines (37 loc) · 1.22 KB
/
hotkey_manager.h
File metadata and controls
45 lines (37 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef RME_HOTKEY_MANAGER_H
#define RME_HOTKEY_MANAGER_H
#include <map>
#include <string>
#include <functional>
#include <wx/accel.h>
#include <pugixml.hpp>
#include <set>
class HotkeyManager {
public:
HotkeyManager();
struct HotkeyInfo {
std::string key;
std::string description;
std::function<void()> callback;
};
void RegisterHotkey(const std::string& name, const std::string& defaultKey,
const std::string& description, std::function<void()> callback);
void LoadHotkeys();
void SaveHotkeys();
void ShowHotkeyDialog(wxWindow* parent);
std::map<std::string, HotkeyInfo> GetAllHotkeys() const;
// Convert between wxKeyCode and string representation
static wxString KeyCodeToString(int keyCode);
static int StringToKeyCode(const wxString& keyString);
private:
std::map<std::string, HotkeyInfo> hotkeys;
std::set<int> currentModifiers;
void ApplyHotkeys();
void LoadHotkeysFromNode(pugi::xml_node& node);
void UpdateHotkeyString(wxTextCtrl* hotkeyEdit);
// Helper methods for hotkey dialog
void UpdateHotkeyList();
bool ValidateHotkeys();
};
extern HotkeyManager g_hotkey_manager;
#endif // RME_HOTKEY_MANAGER_H