ScummVM API documentation
controls.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 /*
23  * Based on
24  * WebVenture (c) 2010, Sean Kasun
25  * https://github.com/mrkite/webventure, http://seancode.com/webventure/
26  *
27  * Used with explicit permission from the author
28  */
29 
30 #ifndef MACVENTURE_CONTROLS_H
31 #define MACVENTURE_CONTROLS_H
32 
33 namespace MacVenture {
34 
35 class Gui;
36 
37 enum ControlType { // HACK, should correspond exactly with the types of controls (sliders etc)
38  kControlExitBox = 0,
39  kControlExamine = 1,
40  kControlOpen = 2,
41  kControlClose = 3,
42  kControlSpeak = 4,
43  kControlOperate = 5,
44  kControlGo = 6,
45  kControlHit = 7,
46  kControlConsume = 8,
47  kControlClickToContinue = 9
48 };
49 
50 enum ControlAction {
51  kNoCommand = 0,
52  kStartOrResume = 1,
53  kClose = 2,
54  kTick = 3,
55  kActivateObject = 4,
56  kMoveObject = 5,
57  kConsume = 6,
58  kExamine = 7,
59  kGo = 8,
60  kHit = 9,
61  kOpen = 10,
62  kOperate = 11,
63  kSpeak = 12,
64  kBabble = 13,
65  kTargetName = 14,
66  kDebugObject = 15,
67  kClickToContinue = 16
68 };
69 
70 struct ControlData {
71  Common::Rect bounds;
72  uint16 scrollValue;
73  uint8 visible;
74  uint16 scrollMax;
75  uint16 scrollMin;
76  uint16 cdef;
77  ControlAction refcon;
78  ControlType type;
79  uint8 titleLength;
80  Common::String title;
81  uint16 border;
82 };
83 
85 
86 enum {
87  kCommandsLeftPadding = 0,
88  kCommandsTopPadding = 0
89 };
90 
91 public:
92 
93  CommandButton();
94 
95  CommandButton(ControlData data, Gui *g);
96  ~CommandButton() {}
97 
98  void draw(Graphics::ManagedSurface &surface) const;
99  bool isInsideBounds(const Common::Point point) const;
100  const ControlData &getData() const;
101  void select();
102  void unselect();
103  bool isSelected();
104 
105 private:
106  bool _selected;
107  ControlData _data;
108  Gui *_gui;
109 };
110 
111 } // End of namespace MacVenture
112 
113 #endif
Definition: managed_surface.h:51
Definition: str.h:59
Definition: controls.h:70
Definition: gui.h:92
Definition: rect.h:144
Definition: controls.h:84
Definition: rect.h:45
Definition: container.h:38