ScummVM API documentation
locationscreen.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 STARK_UI_MENU_LOCATION_SCREEN_H
23 #define STARK_UI_MENU_LOCATION_SCREEN_H
24 
25 #include "engines/stark/ui/screen.h"
26 #include "engines/stark/ui/window.h"
27 #include "engines/stark/gfx/color.h"
28 
29 namespace Stark {
30 
31 namespace Gfx {
32 class RenderEntry;
33 }
34 
35 namespace Resources {
36 class ItemVisual;
37 class Location;
38 class Sound;
39 }
40 
41 class StaticLocationWidget;
42 
47 public:
48  StaticLocationScreen(Gfx::Driver *gfx, Cursor *cursor, const char *locationName, Screen::Name screenName);
49  ~StaticLocationScreen() override;
50 
51  // Screen API
52  void open() override;
53  void close() override;
54  void onScreenChanged() override;
55 
63  void waitForSoundsToComplete();
64 
65 protected:
66  // Window API
67  void onMouseMove(const Common::Point &pos) override;
68  void onClick(const Common::Point &pos) override;
69  void onGameLoop() override;
70  void onRender() override;
71 
73 
74 private:
75  const char *_locationName;
76  Resources::Location *_location;
77  int _hoveredWidgetIndex;
78 
79  void freeWidgets();
80 };
81 
84 #define CLICK_HANDLER(cls, method) new Common::Functor0Mem<void, cls>(this, &cls::method)
85 #define MOVE_HANDLER(cls, method) new Common::Functor2Mem<StaticLocationWidget &, const Common::Point &, void, cls>(this, &cls::method)
86 
93 public:
94  StaticLocationWidget(const char *renderEntryName, WidgetOnClickCallback *onClickCallback,
95  WidgetOnMouseMoveCallback *onMouseMoveCallback);
96  virtual ~StaticLocationWidget();
97 
99  virtual void render();
100 
102  virtual bool isMouseInside(const Common::Point &mousePos) const;
103 
105  virtual void onClick();
106 
108  virtual void onMouseMove(const Common::Point &mousePos);
109 
111  virtual void onMouseUp() {}
112 
114  virtual void onScreenChanged();
115 
117  void setupSounds(int16 enterSound, int16 clickSound);
118 
124  void setTextColor(const Gfx::Color &textColor);
125 
127  bool isVisible() const;
128  void setVisible(bool visible);
129 
131  void onGameLoop();
132 
134  void onMouseEnter();
135 
137  void onMouseLeave();
138 
139 protected:
140  Common::Point getPosition() const;
141  Gfx::RenderEntry *_renderEntry;
142 
143 private:
144  Resources::ItemVisual *_item;
145  bool _visible;
146 
147  Resources::Sound *_soundMouseEnter;
148  Resources::Sound *_soundMouseClick;
149 
150  WidgetOnClickCallback *_onClick;
151  WidgetOnMouseMoveCallback *_onMouseMove;
152 };
153 
154 } // End of namespace Stark
155 
156  #endif // STARK_UI_MENU_LOCATION_SCREEN_H
Definition: location.h:51
Definition: locationscreen.h:92
Definition: array.h:52
Definition: screen.h:80
Definition: sound.h:47
Definition: item.h:139
Definition: driver.h:44
Definition: cursor.h:45
Definition: locationscreen.h:46
Definition: console.h:27
Definition: rect.h:45
Definition: color.h:30
Definition: func.h:473
Definition: renderentry.h:67
virtual void onMouseUp()
Definition: locationscreen.h:111