ScummVM API documentation
actionmenu.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_ACTIONMENU_H
23 #define STARK_UI_ACTIONMENU_H
24 
25 #include "engines/stark/ui/window.h"
26 
27 namespace Stark {
28 
29 class Cursor;
30 class VisualImageXMG;
31 class VisualText;
32 class InventoryWindow;
33 class GameWindow;
34 
35 namespace Resources {
36 class ItemVisual;
37 class Sound;
38 }
39 
40 class ActionMenu : public Window {
41 public:
42  ActionMenu(Gfx::Driver *gfx, Cursor *cursor);
43  ~ActionMenu() override;
44 
45  void setInventory(InventoryWindow *inventory);
46 
47  void open(Resources::ItemVisual *item, const Common::Point &itemRelativePos);
48  void close();
49 
50  void onScreenChanged();
51 
52 protected:
53  Common::Rect computePosition(const Common::Point &mouse) const;
54 
55  void onMouseMove(const Common::Point &pos) override;
56  void onClick(const Common::Point &pos) override;
57  void onGameLoop() override;
58  void onRender() override;
59 
60 private:
61  void clearActions();
62  void enableAction(uint32 action);
63  void updateActionSound();
64 
65  enum ActionMenuType {
66  kActionNone = -1,
67  kActionHand = 0,
68  kActionEye = 1,
69  kActionMouth = 2
70  };
71 
72  struct ActionButton {
73  bool enabled;
74  uint32 action;
75  Common::Rect rect;
76  };
77 
78  bool _fromInventory;
79  ActionButton _buttons[3];
80 
81  VisualImageXMG *_background;
82  VisualText *_itemDescription;
83 
84  Common::Point _itemRelativePos;
85  Resources::ItemVisual *_item;
86 
87  InventoryWindow *_inventory;
88 
89  int32 _autoCloseTimeRemaining;
90 
91  int32 _activeMenuType;
92 
93  Resources::Sound *_actionMouthHoverSound;
94  Resources::Sound *_actionHoverSound;
95 };
96 
97 } // End of namespace Stark
98 
99 #endif
Definition: window.h:54
Definition: sound.h:47
Definition: rect.h:144
Definition: item.h:139
Definition: driver.h:44
Definition: cursor.h:45
Definition: atari-cursor.h:38
Definition: text.h:44
Definition: console.h:27
Definition: rect.h:45
Definition: actionmenu.h:40
Definition: image.h:45
Definition: inventorywindow.h:40