Diffstat (limited to 'noncore/applets/keyhelper/keyhelperapplet/misc/KeyMappings.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/keyhelper/keyhelperapplet/misc/KeyMappings.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/noncore/applets/keyhelper/keyhelperapplet/misc/KeyMappings.h b/noncore/applets/keyhelper/keyhelperapplet/misc/KeyMappings.h new file mode 100644 index 0000000..9705c8c --- a/dev/null +++ b/noncore/applets/keyhelper/keyhelperapplet/misc/KeyMappings.h | |||
@@ -0,0 +1,72 @@ | |||
1 | #ifndef _KEY_MAPPINGS_H_ | ||
2 | #define _KEY_MAPPINGS_H_ | ||
3 | |||
4 | #include <qwindowsystem_qws.h> | ||
5 | #include <qmap.h> | ||
6 | |||
7 | #include <qintdict.h> | ||
8 | |||
9 | class MapInfo | ||
10 | { | ||
11 | public: | ||
12 | MapInfo(){}; | ||
13 | MapInfo(int code, int mod = 0, int uni = 0, | ||
14 | int shift_uni = 0, int ctrl_uni = 0); | ||
15 | |||
16 | static const QWSServer::KeyMap* findKeyMap(int code); | ||
17 | |||
18 | int keycode; | ||
19 | int modifiers; | ||
20 | int unicode; | ||
21 | int shift_unicode; | ||
22 | int ctrl_unicode; | ||
23 | bool isDefined; | ||
24 | }; | ||
25 | |||
26 | class KeyMappings | ||
27 | { | ||
28 | public: | ||
29 | typedef QWSServer::KeyMap KeyMap; | ||
30 | typedef QMap<int, MapInfo> CodeMaps; | ||
31 | |||
32 | KeyMappings(); | ||
33 | virtual ~KeyMappings(); | ||
34 | |||
35 | void setOriginal(int unicode, int modifiers); | ||
36 | void setModifiers(int modifiers); | ||
37 | void setUnicode(int unicode); | ||
38 | void setKeycode(int keycode); | ||
39 | |||
40 | int getUnicode(); | ||
41 | int getKeycode(); | ||
42 | int getModifiers(); | ||
43 | bool isDefined(); | ||
44 | |||
45 | void assign(int keycode, int keymask, int mapcode, int mapmodifiers = 0, | ||
46 | int unicode = 0, int shift_unicode = 0, int ctrl_unicode = 0); | ||
47 | void assignModifier(const QString& type, const QString& state); | ||
48 | void assignUnicode(const QString& kind, const QString& ch); | ||
49 | void assignUnicode(int unicode); | ||
50 | bool apply(int unicode, int keycode, int modifiers, int keymask, bool isPress); | ||
51 | bool apply(int keycode, int keymask, bool isPress); | ||
52 | void setCapsLock(bool on=true){ | ||
53 | m_capslock = on; | ||
54 | } | ||
55 | |||
56 | void reset(); | ||
57 | |||
58 | void statistics(); | ||
59 | private: | ||
60 | QMap<int, CodeMaps*> m_keymaps; | ||
61 | MapInfo m_keyinfo; | ||
62 | int m_modifiers; | ||
63 | CodeMaps::Iterator m_it; | ||
64 | |||
65 | bool m_capslock; | ||
66 | bool m_isMapped; | ||
67 | |||
68 | void init(); | ||
69 | void clear(); | ||
70 | }; | ||
71 | |||
72 | #endif /* _KEY_MAPPINGS_H_ */ | ||