/* $Id$ *//* * This file is part of OpenTTD. * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. *//** @file hotkeys.h %Hotkey related functions. */#ifndef HOTKEYS_H#define HOTKEYS_H#include"core/smallvec_type.hpp"#include"gfx_type.h"#include"window_type.h"#include"string_type.h"/** * All data for a single hotkey. The name (for saving/loading a configfile), * a list of keycodes and a number to help identifying this hotkey. */structHotkey{Hotkey(uint16default_keycode,constchar*name,intnum);Hotkey(constuint16*default_keycodes,constchar*name,intnum);voidAddKeycode(uint16keycode);constchar*name;intnum;SmallVector<uint16,1>keycodes;};#define HOTKEY_LIST_END Hotkey((uint16)0, NULL, -1)structIniFile;/** * List of hotkeys for a window. */structHotkeyList{typedefEventState(*GlobalHotkeyHandlerFunc)(inthotkey);HotkeyList(constchar*ini_group,Hotkey*items,GlobalHotkeyHandlerFuncglobal_hotkey_handler=NULL);~HotkeyList();voidLoad(IniFile*ini);voidSave(IniFile*ini)const;intCheckMatch(uint16keycode,boolglobal_only=false)const;GlobalHotkeyHandlerFuncglobal_hotkey_handler;private:constchar*ini_group;Hotkey*items;/** * Dummy private copy constructor to prevent compilers from * copying the structure, which fails due to _hotkey_lists. */HotkeyList(constHotkeyList&other);};boolIsQuitKey(uint16keycode);voidLoadHotkeysFromConfig();voidSaveHotkeysToConfig();voidHandleGlobalHotkeys(WCharkey,uint16keycode);#endif /* HOTKEYS_H */