Speech bubbles can point down right.
[scummvm-innocent.git] / backends / keymapper / action.cpp
blob3feb593f19a8545ed8276a0e97e212fa7a373424
1 /* ScummVM - Graphic Adventure Engine
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * $URL$
22 * $Id$
26 #include "backends/keymapper/action.h"
28 #ifdef ENABLE_KEYMAPPER
30 #include "backends/keymapper/keymap.h"
32 namespace Common {
34 Action::Action(Keymap *boss, const char *i, String des, ActionType typ,
35 KeyType prefKey, int pri, int flg)
36 : _boss(boss), description(des), type(typ), preferredKey(prefKey),
37 priority(pri), flags(flg), _hwKey(0) {
38 assert(i);
39 assert(_boss);
41 strncpy(id, i, ACTION_ID_SIZE);
43 _boss->addAction(this);
46 void Action::mapKey(const HardwareKey *key) {
47 if (_hwKey)
48 _boss->unregisterMapping(this);
50 _hwKey = key;
52 if (_hwKey)
53 _boss->registerMapping(this, _hwKey);
56 const HardwareKey *Action::getMappedKey() const {
57 return _hwKey;
60 } // end of namespace Common
62 #endif // #ifdef ENABLE_KEYMAPPER