00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef IKEYSTATE_H
00016 #define IKEYSTATE_H
00017
00018 #include "IInterface.h"
00019 #include "KeyTypes.h"
00020 #include "CEvent.h"
00021 #include "CString.h"
00022 #include "stdset.h"
00023
00025
00029 class IKeyState : public IInterface {
00030 public:
00031 enum {
00032 kNumButtons = 0x200
00033 };
00034
00036 class CKeyInfo {
00037 public:
00038 static CKeyInfo* alloc(KeyID, KeyModifierMask, KeyButton, SInt32 count);
00039 static CKeyInfo* alloc(KeyID, KeyModifierMask, KeyButton, SInt32 count,
00040 const std::set<CString>& destinations);
00041 static CKeyInfo* alloc(const CKeyInfo&);
00042
00043 static bool isDefault(const char* screens);
00044 static bool contains(const char* screens, const CString& name);
00045 static bool equal(const CKeyInfo*, const CKeyInfo*);
00046 static CString join(const std::set<CString>& destinations);
00047 static void split(const char* screens, std::set<CString>&);
00048
00049 public:
00050 KeyID m_key;
00051 KeyModifierMask m_mask;
00052 KeyButton m_button;
00053 SInt32 m_count;
00054 char* m_screens;
00055 char m_screensBuffer[1];
00056 };
00057
00058 typedef std::set<KeyButton> KeyButtonSet;
00059
00061
00062
00064
00068 virtual void updateKeyMap() = 0;
00069
00071
00075 virtual void updateKeyState() = 0;
00076
00078
00083 virtual void setHalfDuplexMask(KeyModifierMask) = 0;
00084
00086
00089 virtual void fakeKeyDown(KeyID id, KeyModifierMask mask,
00090 KeyButton button) = 0;
00091
00093
00096 virtual void fakeKeyRepeat(KeyID id, KeyModifierMask mask,
00097 SInt32 count, KeyButton button) = 0;
00098
00100
00103 virtual void fakeKeyUp(KeyButton button) = 0;
00104
00106
00110 virtual void fakeAllKeysUp() = 0;
00111
00113
00117 virtual bool fakeCtrlAltDel() = 0;
00118
00120
00121
00122
00124
00128 virtual bool isKeyDown(KeyButton) const = 0;
00129
00131
00135 virtual KeyModifierMask
00136 getActiveModifiers() const = 0;
00137
00139
00143 virtual KeyModifierMask
00144 pollActiveModifiers() const = 0;
00145
00147
00150 virtual SInt32 pollActiveGroup() const = 0;
00151
00153
00157 virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const = 0;
00158
00160 static CEvent::Type getKeyDownEvent();
00162 static CEvent::Type getKeyUpEvent();
00164 static CEvent::Type getKeyRepeatEvent();
00165
00167
00168 private:
00169 static CEvent::Type s_keyDownEvent;
00170 static CEvent::Type s_keyUpEvent;
00171 static CEvent::Type s_keyRepeatEvent;
00172 };
00173
00174 #endif