Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef HOTKEYS_H
00013 #define HOTKEYS_H
00014
00015 #include "core/smallvec_type.hpp"
00016 #include "gfx_type.h"
00017 #include "window_type.h"
00018 #include "string_type.h"
00019
00024 struct Hotkey {
00025 Hotkey(uint16 default_keycode, const char *name, int num);
00026 Hotkey(const uint16 *default_keycodes, const char *name, int num);
00027
00028 void AddKeycode(uint16 keycode);
00029
00030 const char *name;
00031 int num;
00032 SmallVector<uint16, 1> keycodes;
00033 };
00034
00035 #define HOTKEY_LIST_END Hotkey((uint16)0, NULL, -1)
00036
00037 struct IniFile;
00038
00042 struct HotkeyList {
00043 typedef EventState (*GlobalHotkeyHandlerFunc)(int hotkey);
00044
00045 HotkeyList(const char *ini_group, Hotkey *items, GlobalHotkeyHandlerFunc global_hotkey_handler = NULL);
00046 ~HotkeyList();
00047
00048 void Load(IniFile *ini);
00049 void Save(IniFile *ini) const;
00050
00051 int CheckMatch(uint16 keycode, bool global_only = false) const;
00052
00053 GlobalHotkeyHandlerFunc global_hotkey_handler;
00054 private:
00055 const char *ini_group;
00056 Hotkey *items;
00057
00062 HotkeyList(const HotkeyList &other);
00063 };
00064
00065 bool IsQuitKey(uint16 keycode);
00066
00067 void LoadHotkeysFromConfig();
00068 void SaveHotkeysToConfig();
00069
00070
00071 void HandleGlobalHotkeys(WChar key, uint16 keycode);
00072
00073 #endif