ScummVM API documentation
mouseMap.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 MOUSE_MAP_H
23 #define MOUSE_MAP_H
24 
25 #include "common/array.h"
26 #include "common/ptr.h"
27 #include "common/rect.h"
28 #include "common/str.h"
29 
30 namespace AGDS {
31 
32 class AGDSEngine;
33 struct Region;
34 using RegionPtr = Common::SharedPtr<Region>;
35 
36 struct MouseRegion {
37  int id = -1;
38  RegionPtr region = nullptr;
39  bool enabled = true;
40  bool visible = false;
41 
42  Common::String onEnter;
43  Common::String onLeave;
44 
45  void enable() {
46  enabled = true;
47  }
48 
49  void disable() {
50  enabled = false;
51  }
52 
53  MouseRegion() {}
54 
55  MouseRegion(RegionPtr reg, const Common::String &enter, const Common::String &leave) : region(reg), onEnter(enter), onLeave(leave) {
56  }
57 
58  void hide(AGDSEngine *engine);
59  void show(AGDSEngine *engine);
60 };
62 
63 class MouseMap {
64  Common::Array<MouseRegionPtr> _mouseRegions;
65  bool _disabled;
66 
67 public:
68  MouseMap() : _mouseRegions(100), _disabled(false) {}
69 
70  void disable(bool disabled) {
71  _disabled = disabled;
72  }
73 
74  bool disabled() const {
75  return _disabled;
76  }
77 
78  int findFree() const;
79  int add(MouseRegion area);
80  void remove(int id);
81 
82  void hideAll(AGDSEngine *engine);
83 
84  void hideInactive(AGDSEngine *engine, Common::Point pos);
85  MouseRegion *find(int id);
86 };
87 
88 } // End of namespace AGDS
89 
90 #endif /* AGDS_SCREEN_H */
Definition: str.h:59
Definition: array.h:52
In find(In first, In last, const T &v)
Definition: algorithm.h:225
Definition: ptr.h:572
Definition: agds.h:58
Definition: rect.h:144
Definition: mouseMap.h:36
Definition: mouseMap.h:63
Definition: agds.h:81