author | alwin <alwin> | 2005-02-28 09:40:30 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-02-28 09:40:30 (UTC) |
commit | 2b64a84d39eeed5681d0ee5068c7d11a01527750 (patch) (side-by-side diff) | |
tree | c8693340dbc5ef5e2f9afa90b690829ddff2c4bd /noncore/applets/keyhelper/keyhelperapplet/misc/KeyModifiers.h | |
parent | 61fa699140c5efbb6ba0bf2a62f7e8fbf62976be (diff) | |
download | opie-2b64a84d39eeed5681d0ee5068c7d11a01527750.zip opie-2b64a84d39eeed5681d0ee5068c7d11a01527750.tar.gz opie-2b64a84d39eeed5681d0ee5068c7d11a01527750.tar.bz2 |
other keymapping tool - not working this moment, I have to check it out
- the reason is that the config file is somewhat easier to understand than
from zkbapplet and has a nice config tool.
Please don't put it into any repositories this moment.
Diffstat (limited to 'noncore/applets/keyhelper/keyhelperapplet/misc/KeyModifiers.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/applets/keyhelper/keyhelperapplet/misc/KeyModifiers.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/noncore/applets/keyhelper/keyhelperapplet/misc/KeyModifiers.h b/noncore/applets/keyhelper/keyhelperapplet/misc/KeyModifiers.h new file mode 100644 index 0000000..a99c181 --- a/dev/null +++ b/noncore/applets/keyhelper/keyhelperapplet/misc/KeyModifiers.h @@ -0,0 +1,80 @@ +#ifndef _KEY_MODIFIERS_H_ +#define _KEY_MODIFIERS_H_ + +#include <qmap.h> +#include <qtimer.h> +#include <qvaluelist.h> +#include <qnamespace.h> + +#include <qpe/config.h> +#include "ConfigEx.h" + +struct ModifierInfo { +public: + ModifierInfo(const QString& tp, int code, int mask, bool mode) + { + type = tp; + keycode = code; + keymask = mask; + pressed = false; + toggled = false; + toggle_mode = mode; + } + QString type; + int keycode; + int keymask; + bool pressed; + bool toggled; + bool toggle_mode; +private: +} ; + +class KeyModifiers : public QObject +{ + Q_OBJECT +public: + typedef QValueList<ModifierInfo*> ModifierList; + + KeyModifiers(); + virtual ~KeyModifiers(); + void addType(const QString& type); + ModifierInfo* assign(const QString& type, int keycode, + int keymask = 0, bool toggle = false); + void assignRelease(int keycode); + void assignRelease(ModifierInfo* info, int keycode); + void setToggle(); + void setToggle(ModifierInfo* info); + + bool isToggled(); + void resetStates(); + void keepToggles(); + + bool pressKey(int keycode, int modifiers); + void releaseKey(int keycode); + int getState(); + int getState(int modifiers, bool reset = false); + int getMask(const QString& type); + int getModifiers(int modifiers); + + bool isModifier(int keycode); + + void statistics(); + + void reset(); +public slots: + void resetToggles(); +private: + QMap<QString, int> m_types; + int m_bitmask; + ModifierList m_modifiers; + QMap<int, ModifierList*> m_releasekeys; + ModifierList m_togglekeys; + ModifierInfo* m_info; + QTimer* m_pTimer; + int m_timeout; + + void clear(); + void init(); +}; + +#endif /* _KEY_MODIFIERS_H_ */ |