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 #include "common/array.h"
00029 #include "common/events.h"
00030 #include "common/str.h"
00031 
00032 namespace Common {
00033 
00034 struct KeyActionEntry {
00035     const char *id;
00036     const KeyState ks;
00037     const char *defaultHwId;
00038     const char *description;
00039 };
00040 
00041 struct Action {
00043     const char *id;
00045     String description;
00046 
00048     Event event;
00049 
00050 private:
00051     Array<String> _defaultInputMapping;
00052     bool _shouldTriggerOnKbdRepeats;
00053 
00054 public:
00055     Action(const char *id, const String &description);
00056 
00057     void setEvent(const Event &evt) {
00058         event = evt;
00059     }
00060 
00061     void setEvent(const EventType evtType) {
00062         event = Event();
00063         event.type = evtType;
00064     }
00065 
00066     void setCustomBackendActionEvent(const CustomEventType evtType) {
00067         event = Event();
00068         event.type = EVENT_CUSTOM_BACKEND_ACTION_START;
00069         event.customType = evtType;
00070     }
00071 
00072     void setCustomBackendActionAxisEvent(const CustomEventType evtType) {
00073         event = Event();
00074         event.type = EVENT_CUSTOM_BACKEND_ACTION_AXIS;
00075         event.customType = evtType;
00076     }
00077 
00078     void setCustomEngineActionEvent(const CustomEventType evtType) {
00079         event = Event();
00080         event.type = EVENT_CUSTOM_ENGINE_ACTION_START;
00081         event.customType = evtType;
00082     }
00083 
00084     void setKeyEvent(const KeyState &ks) {
00085         event = Event();
00086         event.type = EVENT_KEYDOWN;
00087         event.kbd = ks;
00088     }
00089 
00090     void setLeftClickEvent() {
00091         setEvent(EVENT_LBUTTONDOWN);
00092     }
00093 
00094     void setMiddleClickEvent() {
00095         setEvent(EVENT_MBUTTONDOWN);
00096     }
00097 
00098     void setRightClickEvent() {
00099         setEvent(EVENT_RBUTTONDOWN);
00100     }
00101 
00102     void setMouseWheelUpEvent() {
00103         setEvent(EVENT_WHEELUP);
00104     }
00105 
00106     void setMouseWheelDownEvent() {
00107         setEvent(EVENT_WHEELDOWN);
00108     }
00109 
00110     void setX1ClickEvent() {
00111         setEvent(EVENT_X1BUTTONDOWN);
00112     }
00113 
00114     void setX2ClickEvent() {
00115         setEvent(EVENT_X2BUTTONDOWN);
00116     }
00117 
00128     void allowKbdRepeats() {
00129         _shouldTriggerOnKbdRepeats = true;
00130     }
00131 
00132     bool shouldTriggerOnKbdRepeats() const { return _shouldTriggerOnKbdRepeats; }
00133 
00143     void addDefaultInputMapping(const String &hwId);
00144 
00145     const Array<String> &getDefaultInputMapping() const {
00146         return _defaultInputMapping;
00147     }
00148 
00149 };
00150 
00151 } // End of namespace Common
00152 
00153 #endif // #ifndef COMMON_ACTION_H


Generated on Sat Aug 1 2020 05:01:03 for ResidualVM by doxygen 1.7.1
curved edge   curved edge