scummvm/backends/common/user-action.cpp
Stephen Kennedy dfcdbb0d33 KeymapManager - implemented loading/saving of keymaps
- Refactoring of code to map a key to a UserAction - now we call a method on UserAction to do it (and it then tells the Keymap class)
- General cleanup of code

svn-id: r33262
2008-07-24 10:00:56 +00:00

33 lines
No EOL
683 B
C++

#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