ScummVM API documentation
control.h
1 /* ScummVM - Graphic Adventure Engine
2  *
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.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
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.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef ZVISION_CONTROL_H
23 #define ZVISION_CONTROL_H
24 
25 #include "common/keyboard.h"
26 #include "common/str.h"
27 
28 namespace Common {
29 class SeekableReadStream;
30 struct Point;
31 class WriteStream;
32 }
33 
34 namespace ZVision {
35 
36 class ZVision;
37 
43 class Control {
44 public:
45 
46  enum ControlType {
47  CONTROL_UNKNOW,
48  CONTROL_INPUT,
49  CONTROL_PUSHTGL,
50  CONTROL_SLOT,
51  CONTROL_LEVER,
52  CONTROL_SAVE,
53  CONTROL_SAFE,
54  CONTROL_FIST,
55  CONTROL_TITLER,
56  CONTROL_HOTMOV,
57  CONTROL_PAINT
58  };
59 
60  Control(ZVision *engine, uint32 key, ControlType type) : _engine(engine), _key(key), _type(type), _venusId(-1) {}
61  virtual ~Control() {}
62 
63  uint32 getKey() {
64  return _key;
65  }
66 
67  ControlType getType() {
68  return _type;
69  }
70 
71  virtual void focus() {}
72  virtual void unfocus() {}
79  virtual bool onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
80  return false;
81  }
88  virtual bool onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
89  return false;
90  }
98  virtual bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
99  return false;
100  }
106  virtual bool onKeyDown(Common::KeyState keyState) {
107  return false;
108  }
114  virtual bool onKeyUp(Common::KeyState keyState) {
115  return false;
116  }
123  virtual bool process(uint32 deltaTimeInMillis) {
124  return false;
125  }
126 
127  void setVenus();
128 
129 protected:
130  ZVision *_engine;
131  uint32 _key;
132  int32 _venusId;
133 
134  void getParams(const Common::String &inputStr, Common::String &parameter, Common::String &values);
135 // Static member functions
136 public:
137  static void parseFlatControl(ZVision *engine);
138  static void parsePanoramaControl(ZVision *engine, Common::SeekableReadStream &stream);
139  static void parseTiltControl(ZVision *engine, Common::SeekableReadStream &stream);
140 private:
141  ControlType _type;
142 };
143 
144 } // End of namespace ZVision
145 
146 #endif
virtual bool onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos)
Definition: control.h:88
Definition: str.h:59
virtual bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos)
Definition: control.h:98
virtual bool onMouseDown(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos)
Definition: control.h:79
Definition: control.h:43
Definition: display_client.h:58
Definition: stream.h:745
Definition: clock.h:29
virtual bool onKeyUp(Common::KeyState keyState)
Definition: control.h:114
virtual bool onKeyDown(Common::KeyState keyState)
Definition: control.h:106
Definition: algorithm.h:29
Definition: rect.h:45
Definition: keyboard.h:294
virtual bool process(uint32 deltaTimeInMillis)
Definition: control.h:123