ScummVM API documentation
mouse_boxes.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 CRYOMNI3D_MOUSE_BOXES_H
23 #define CRYOMNI3D_MOUSE_BOXES_H
24 
25 #include "common/array.h"
26 #include "common/str.h"
27 
28 namespace Common {
29 struct Point;
30 struct Rect;
31 }
32 
33 namespace CryOmni3D {
34 
35 class FontManager;
36 
37 class MouseBoxes {
38 public:
39  MouseBoxes(uint size);
40  virtual ~MouseBoxes();
41 
42  void reset();
43  void setupBox(int box_id, int left, int top, int right, int bottom,
44  const Common::String *text = nullptr);
45  void setupBox(int box_id, int left, int top, int right, int bottom, const char *text);
46  Common::Rect getBoxRect(int box_id) const;
47  Common::Point getBoxOrigin(int box_id) const;
48  bool hitTest(int box_id, const Common::Point &pt);
49  void display(int box_id, const FontManager &font_manager);
50 
51 private:
52  struct MouseBox {
53  MouseBox() : left(-1), top(-1), right(-1), bottom(-1), string(nullptr), isChar(false) {}
54 
55  int left;
56  int top;
57  int right;
58  int bottom;
59  // Can be nullptr
60  bool isChar;
61  union {
62  const Common::String *string;
63  const char *charp;
64  };
65  };
66 
68 };
69 
70 } // End of namespace CryOmni3D
71 
72 #endif
Definition: cryomni3d.h:62
Definition: str.h:59
Definition: display_client.h:58
Definition: rect.h:144
Definition: font_manager.h:40
Definition: algorithm.h:29
Definition: rect.h:45
Definition: mouse_boxes.h:37