18 #ifndef INC_C4KeyboardInput
19 #define INC_C4KeyboardInput
123 return ((uint32_t)key >> 8) & 0xff;
128 return ((uint32_t)key) & 0xff;
173 return ((uint32_t)key >> 8) & 0xff;
178 return ((uint32_t)key) & uint8_t(0xff);
184 #define TOUPPERIFX11(key) (key)
186 #define TOUPPERIFX11(key) toupper(key)
239 static C4KeyCode GetKeyByScanCode(
const char *scan_code);
283 inline void Ref() { ++iRef; }
284 inline void Deref() {
if (!--iRef)
delete this; }
312 default:
return false;
343 default:
return false;
375 default:
return false;
406 default:
return false;
426 typedef std::vector<C4KeyboardCallbackInterface *> CBVec;
427 unsigned int uiPriority;
494 bool operator()(
const char *p,
const char *q)
const {
return p && q && (strcmp(p,q)<0); }
497 typedef std::multimap<C4KeyCode, C4CustomKey *> KeyCodeMap;
498 typedef std::map<const char *, C4CustomKey *, szLess> KeyNameMap;
500 KeyCodeMap KeysByCode;
501 KeyNameMap KeysByName;
const CodeList & GetCodes() const
std::vector< C4KeyCodeEx > CodeList
C4CustomKey(const C4KeyCodeEx &DefCode, const char *szName, C4KeyScope Scope, C4KeyboardCallbackInterface *pCallback, unsigned int uiPriority=PRIO_Base)
unsigned int GetPriority() const
const StdStrBuf & GetName() const
void CompileFunc(StdCompiler *pComp)
bool Execute(C4KeyEventType eEv, C4KeyCodeEx key)
void Update(const C4CustomKey *pByKey)
bool IsCodeMatched(const C4KeyCodeEx &key) const
void KillCallbacks(const C4CustomKey *pOfKey)
C4KeyScope GetScope() const
CallbackFunc pFuncPressed
bool(TargetClass::* CallbackFunc)(ParameterType par)
C4KeyCBEx(TargetClass &rTarget, const ParameterType &par, CallbackFunc pFuncDown, CallbackFunc pFuncUp=nullptr, CallbackFunc pFuncPressed=nullptr, CallbackFunc pFuncMoved=nullptr)
bool OnKeyEvent(const C4KeyCodeEx &key, C4KeyEventType eEv) override
virtual bool CheckCondition()
bool OnKeyEvent(const C4KeyCodeEx &key, C4KeyEventType eEv) override
bool(TargetClass::* CallbackFunc)(const C4KeyCodeEx &key, const ParameterType &par)
C4KeyCBExPassKey(TargetClass &rTarget, const ParameterType &par, CallbackFunc pFuncDown, CallbackFunc pFuncUp=nullptr, CallbackFunc pFuncPressed=nullptr, CallbackFunc pFuncMoved=nullptr)
virtual bool CheckCondition()
CallbackFunc pFuncPressed
C4KeyCB(TargetClass &rTarget, CallbackFunc pFuncDown, CallbackFunc pFuncUp=nullptr, CallbackFunc pFuncPressed=nullptr, CallbackFunc pFuncMoved=nullptr)
bool(TargetClass::* CallbackFunc)()
virtual bool CheckCondition()
bool OnKeyEvent(const C4KeyCodeEx &key, C4KeyEventType eEv) override
CallbackFunc pFuncPressed
CallbackFunc pFuncPressed
C4KeyCBPassKey(TargetClass &rTarget, CallbackFunc pFuncDown, CallbackFunc pFuncUp=nullptr, CallbackFunc pFuncPressed=nullptr, CallbackFunc pFuncMoved=nullptr)
bool(TargetClass::* CallbackFunc)(const C4KeyCodeEx &key)
virtual bool CheckCondition()
bool OnKeyEvent(const C4KeyCodeEx &key, C4KeyEventType eEv) override
friend class C4KeyboardMapping
virtual ~C4KeyboardCallbackInterface()=default
virtual bool OnKeyEvent(const C4KeyCodeEx &key, C4KeyEventType eEv)=0
class C4CustomKey * pOriginalKey
C4KeyboardCallbackInterface()=default
bool IsOriginalKey(const class C4CustomKey *pCheckKey) const
static C4KeyCode String2KeyCode(const StdStrBuf &sName)
static C4KeyCodeEx FromC4MC(int8_t mouse_id, int32_t button, DWORD param, bool *is_down=nullptr)
static StdStrBuf KeyCode2String(C4KeyCode wCode, bool fHumanReadable, bool fShort)
bool operator==(const C4KeyCodeEx &v2) const
StdStrBuf ToString(bool fHumanReadable, bool fShort) const
bool operator<(const C4KeyCodeEx &v2) const
C4KeyCodeEx(C4KeyCode Key=KEY_Default, DWORD Shift=KEYS_None, bool fIsRepeated=false, int32_t deviceId=-1)
static C4KeyShiftState String2KeyShift(const StdStrBuf &sName)
static StdStrBuf KeyShift2String(C4KeyShiftState eShift)
void CompileFunc(StdCompiler *pComp, StdStrBuf *pOutBuf=nullptr)
void CompileFunc(StdCompiler *pComp)
C4KeyEventData(int32_t iStrength, int32_t game_x, int32_t game_y, int32_t vp_x, int32_t vp_y)
bool operator==(const struct C4KeyEventData &cmp) const