1 /* 2 * 3 * Iter Vehemens ad Necem (IVAN) 4 * Copyright (C) Timo Kiviluoto 5 * Released under the GNU General 6 * Public License 7 * 8 * See LICENSING which should be included 9 * along with this file for more details 10 * 11 */ 12 13 #ifndef MAIN_INCLUDE_SPECIALKEYS_H_ 14 #define MAIN_INCLUDE_SPECIALKEYS_H_ 15 16 #include "SDL.h" 17 18 class festring; 19 20 typedef void (*specialkeyhandler)(); 21 22 class specialkeys 23 { 24 public: 25 enum SKEvent{ 26 Filter, 27 ClearStringInput, 28 CopyToClipboard, 29 PasteFromClipboard, 30 FocusedElementHelp, 31 }; 32 33 static void init(); 34 35 static bool FunctionKeyHandler(SDL_Keycode); 36 static bool ControlKeyHandler(SDL_Keycode); 37 static void AddCtrlOrFuncKeyHandler(SDL_Keycode key, specialkeyhandler Handler); 38 39 static cfestring FilterListQuestion(cfestring What); ClearRequest()40 static void ClearRequest(){Request=-1;} 41 ConsumeEvent(SKEvent k)42 static bool ConsumeEvent(SKEvent k){festring fsDummy;return ConsumeEvent(k,fsDummy);} 43 static bool ConsumeEvent(SKEvent,festring& fsInOut); 44 static bool IsConsumingEvent(); 45 static bool IsRequestedEvent(SKEvent e); HasEvent()46 static bool HasEvent(){return Request>=0;} 47 48 private: 49 static int Request; 50 }; 51 52 53 #endif /* MAIN_INCLUDE_SPECIALKEYS_H_ */ 54