ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

action.h

Go to the documentation of this file.
00001 /* ScummVM - Graphic Adventure Engine
00002  *
00003  * ScummVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef COMMON_ACTION_H
00024 #define COMMON_ACTION_H
00025 
00026 #include "common/scummsys.h"
00027 
00028 #ifdef ENABLE_KEYMAPPER
00029 
00030 #include "common/events.h"
00031 #include "common/func.h"
00032 #include "common/list.h"
00033 #include "common/str.h"
00034 
00035 namespace Common {
00036 
00037 struct HardwareInput;
00038 class Keymap;
00039 
00040 #define ACTION_ID_SIZE (5)
00041 
00042 struct KeyActionEntry {
00043     const KeyState ks;
00044     const char *id;
00045     const char *description;
00046 };
00047 
00048 struct Action {
00050     char id[ACTION_ID_SIZE];
00052     String description;
00053 
00055     List<Event> events;
00056 
00057 private:
00059     const HardwareInput *_hwInput;
00060     Keymap *_boss;
00061 
00062 public:
00063     Action(Keymap *boss, const char *id, String des = "");
00064 
00065     void addEvent(const Event &evt) {
00066         events.push_back(evt);
00067     }
00068 
00069     void addEvent(const EventType evtType) {
00070         Event evt;
00071 
00072         evt.type = evtType;
00073         events.push_back(evt);
00074     }
00075 
00076     void addKeyEvent(const KeyState &ks) {
00077         Event evt;
00078 
00079         evt.type = EVENT_KEYDOWN;
00080         evt.kbd = ks;
00081         addEvent(evt);
00082     }
00083 
00084     void addLeftClickEvent() {
00085         addEvent(EVENT_LBUTTONDOWN);
00086     }
00087 
00088     void addMiddleClickEvent() {
00089         addEvent(EVENT_MBUTTONDOWN);
00090     }
00091 
00092     void addRightClickEvent() {
00093         addEvent(EVENT_RBUTTONDOWN);
00094     }
00095 
00096     Keymap *getParent() {
00097         return _boss;
00098     }
00099 
00100     void mapInput(const HardwareInput *input);
00101     const HardwareInput *getMappedInput() const;
00102 
00103 };
00104 
00105 } // End of namespace Common
00106 
00107 #endif // #ifdef ENABLE_KEYMAPPER
00108 
00109 #endif // #ifndef COMMON_ACTION_H


Generated on Sat May 18 2019 05:00:54 for ResidualVM by doxygen 1.7.1
curved edge   curved edge