|
OpenTTD Source 20251117-master-g7398d2e290
|
List of hotkeys for a window. More...
#include <hotkeys.h>
Public Types | |
| typedef EventState(* | GlobalHotkeyHandlerFunc) (int hotkey) |
Public Member Functions | |
| HotkeyList (const std::string &ini_group, const std::vector< Hotkey > &items, GlobalHotkeyHandlerFunc global_hotkey_handler=nullptr) | |
| void | Load (const IniFile &ini) |
| Load HotkeyList from IniFile. | |
| void | Save (IniFile &ini) const |
| Save HotkeyList to IniFile. | |
| int | CheckMatch (uint16_t keycode, bool global_only=false) const |
| Check if a keycode is bound to something. | |
Data Fields | |
| GlobalHotkeyHandlerFunc | global_hotkey_handler |
Private Member Functions | |
| HotkeyList (const HotkeyList &other) | |
| Dummy private copy constructor to prevent compilers from copying the structure, which fails due to _hotkey_lists. | |
Private Attributes | |
| const std::string | ini_group |
| std::vector< Hotkey > | items |
| typedef EventState(* HotkeyList::GlobalHotkeyHandlerFunc) (int hotkey) |
| HotkeyList::HotkeyList | ( | const std::string & | ini_group, |
| const std::vector< Hotkey > & | items, | ||
| GlobalHotkeyHandlerFunc | global_hotkey_handler = nullptr |
||
| ) |
Definition at line 253 of file hotkeys.cpp.
| HotkeyList::~HotkeyList | ( | ) |
Definition at line 260 of file hotkeys.cpp.
| int HotkeyList::CheckMatch | ( | uint16_t | keycode, |
| bool | global_only = false |
||
| ) | const |
Check if a keycode is bound to something.
| keycode | The keycode that was pressed |
| global_only | Limit the search to hotkeys defined as 'global'. |
Definition at line 301 of file hotkeys.cpp.
References WKC_GLOBAL_HOTKEY.
Referenced by HandleKeypress(), and IsQuitKey().
| void HotkeyList::Load | ( | const IniFile & | ini | ) |
Load HotkeyList from IniFile.
| ini | IniFile to load from. |
Definition at line 269 of file hotkeys.cpp.
References IniLoadFile::GetGroup(), IniGroup::GetItem(), ParseHotkeys(), and IniItem::value.
| void HotkeyList::Save | ( | IniFile & | ini | ) | const |
Save HotkeyList to IniFile.
| ini | IniFile to save to. |
Definition at line 286 of file hotkeys.cpp.
References IniLoadFile::GetOrCreateGroup(), IniGroup::GetOrCreateItem(), SaveKeycodes(), and IniItem::SetValue().