ScummVM API documentation
inventorywindow.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_INVENTORY_WINDOW_H
23 #define STARK_UI_INVENTORY_WINDOW_H
24 
25 #include "engines/stark/gfx/renderentry.h"
26 #include "engines/stark/ui/window.h"
27 
28 #include "common/scummsys.h"
29 #include "common/rect.h"
30 #include "common/array.h"
31 
32 namespace Stark {
33 
34 class ActionMenu;
35 
36 namespace Resources {
37 class Anim;
38 }
39 
40 class InventoryWindow : public Window {
41 public:
42  InventoryWindow(Gfx::Driver *gfx, Cursor *cursor, ActionMenu *actionMenu);
43  ~InventoryWindow() override {}
44 
45  void open();
46  void close();
47 
48  void setSelectedInventoryItem(int16 selectedInventoryItem);
49  int16 getSelectedInventoryItem() const;
50 
52  void reset();
53 
55  void scrollDown();
56  void scrollUp();
57 
58 protected:
59  void onMouseMove(const Common::Point &pos) override;
60  void onClick(const Common::Point &pos) override;
61  void onRightClick(const Common::Point &pos) override;
62  void onGameLoop() override;
63  void onRender() override;
64 
65  void checkObjectAtPos(Common::Point pos, Resources::ItemVisual **item, int16 selectedInventoryItem, int16 &singlePossibleAction);
66  Common::Rect getSlotRect(uint32 slot) const;
67  Common::Rect getItemRect(uint32 slot, VisualImageXMG *image) const;
68  bool isSlotVisible(uint32 slot) const;
69  bool canScrollUp() const;
70  bool canScrollDown() const;
71  void drawScrollArrows() const;
72 
73 private:
74  ActionMenu *_actionMenu;
75 
76  VisualImageXMG *_backgroundImage;
77  Common::Rect _backgroundRect;
78 
79  VisualImageXMG *_scrollUpArrowImage;
80  VisualImageXMG *_scrollDownArrowImage;
81  Common::Rect _scrollUpArrowRect;
82  Common::Rect _scrollDownArrowRect;
83 
84  uint32 _firstVisibleSlot;
85  static const uint32 _visibleSlotsCount = 15;
86 
87  Gfx::RenderEntryArray _renderEntries;
88  int16 _selectedInventoryItem;
89 
90  int32 _autoCloseTimeRemaining;
91 };
92 
93 } // End of namespace Stark
94 
95 #endif // STARK_UI_INVENTORY_WINDOW_H
Definition: window.h:54
Definition: array.h:52
Definition: rect.h:144
Definition: item.h:139
Definition: driver.h:44
Definition: cursor.h:45
Definition: console.h:27
Definition: rect.h:45
Definition: actionmenu.h:40
Definition: image.h:45
Definition: inventorywindow.h:40