aboutsummaryrefslogtreecommitdiff
path: root/backends/common/user-action.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/common/user-action.cpp')
-rw-r--r--backends/common/user-action.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/backends/common/user-action.cpp b/backends/common/user-action.cpp
new file mode 100644
index 0000000000..f6b24339e9
--- /dev/null
+++ b/backends/common/user-action.cpp
@@ -0,0 +1,33 @@
+#include "backends/common/user-action.h"
+#include "backends/common/keymap.h"
+
+namespace Common {
+
+UserAction::UserAction(String des, UserActionCategory cat, UserActionType ty,
+ int pr, int gr, int fl) {
+ description = des;
+ category = cat;
+ type = ty;
+ priority = pr;
+ group = gr;
+ flags = fl;
+ _hwKey = 0;
+ _parent = 0;
+}
+
+void UserAction::setParent(Keymap *parent) {
+ _parent = parent;
+}
+
+void UserAction::mapKey(const HardwareKey *key) {
+ assert(_parent);
+ if (_hwKey) _parent->unregisterMapping(this);
+ _hwKey = key;
+ if (_hwKey) _parent->registerMapping(this, key);
+}
+
+const HardwareKey *UserAction::getMappedKey() const {
+ return _hwKey;
+}
+
+} // end of namespace Common \ No newline at end of file