ScummVM API documentation
ItemMenu.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  * This code is based on the CRAB engine
24  *
25  * Copyright (c) Arvind Raja Yadav
26  *
27  * Licensed under MIT
28  *
29  */
30 
31 #ifndef CRAB_ITEMMENU_H
32 #define CRAB_ITEMMENU_H
33 
34 #include "crab/item/ItemSlot.h"
35 #include "crab/people/person.h"
36 #include "crab/ui/ItemDesc.h"
37 #include "crab/ui/menu.h"
38 
39 namespace Crab {
40 
41 namespace pyrodactyl {
42 namespace item {
43 // The menu is used to handle interactions like the player clicking on an item to equip it
44 class ItemMenu : public pyrodactyl::ui::Menu<ItemSlot> {
45 protected:
46  int _previewIndex, _selectIndex;
47 
48  // Variable to determine if stats of object need updating
49  bool _update;
50 
51 public:
52  // The preview for selected item and hovered item
53  // StatPreview select, hover;
54 
55  ItemMenu() {
56  _previewIndex = -1;
57  _selectIndex = -1;
58  _update = false;
59  }
60  ~ItemMenu() {}
61 
62  int hoverIndex() { return _hoverIndex; }
63 
64  void draw(pyrodactyl::ui::ItemDesc &itemInfo);
65  /*pyrodactyl::people::Person &obj, pyrodactyl::stat::StatDrawHelper &helper*/
66 
67  void init(const ItemSlot &ref, const Vector2i &inc, const uint &rows,
68  const uint &cols, const bool &keyboard);
69 
70  void handleEvents(const Common::Event &event, const int &xOffset = 0, const int &yOffset = 0);
71 #if 0
72  void handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
73 #endif
74  /* pyrodactyl::people::Person &obj,*/
75 
76  bool swap(ItemMenu &target, int index);
77  bool equip(Item &item);
78  bool del(const Common::String &id);
79  bool has(const Common::String &container, const Common::String &id);
80 
81  // Used to calculate enabled slots
82  // void SetEnable();
83 
84  void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
85  void loadState(rapidxml::xml_node<char> *node);
86 };
87 } // End of namespace item
88 } // End of namespace pyrodactyl
89 
90 } // End of namespace Crab
91 
92 #endif // CRAB_ITEMMENU_H
Definition: ItemDesc.h:40
Definition: str.h:59
Definition: Item.h:42
Definition: menu.h:47
Definition: ItemMenu.h:44
Definition: ItemSlot.h:46
Definition: events.h:199
Definition: moveeffect.h:37