ScummVM API documentation
items_view.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 MM1_VIEWS_ENH_ITEMS_VIEW_H
23 #define MM1_VIEWS_ENH_ITEMS_VIEW_H
24 
25 #include "mm/mm1/views_enh/party_view.h"
26 
27 namespace MM {
28 namespace MM1 {
29 namespace ViewsEnh {
30 
31 class ItemsView : public PartyView {
32 protected:
33  enum CostMode { SHOW_COST, SHOW_VALUE, NO_COST };
34  int _selectedItem = -1;
35  CostMode _costMode = NO_COST;
36  Common::Array<int> _items;
37  const Common::Rect _buttonsArea;
38  Shared::Xeen::SpriteResource _btnSprites;
39  Common::StringArray _btnText;
40 
44  void addButton(int frame, const Common::String &text,
45  Common::KeyCode keycode);
46 
50  void backpackFull();
51 
55  void notEnoughGold();
56 
60  void displayMessage(const Common::String &msg);
61 
65  virtual int getLineColor() const {
66  return 0;
67  }
68 
72  virtual void itemSelected() = 0;
73 
77  void clearButtons() {
78  _btnText.clear();
80  }
81 
82 public:
83  ItemsView(const Common::String &name);
84  virtual ~ItemsView() {}
85 
86  bool msgFocus(const FocusMessage &msg) override;
87  void draw() override;
88  bool msgKeypress(const KeypressMessage &msg) override;
89  bool msgMouseDown(const MouseDownMessage &msg) override;
90  bool msgAction(const ActionMessage &msg) override;
91  void timeout() override;
92 };
93 
94 } // namespace ViewsEnh
95 } // namespace MM1
96 } // namespace MM
97 
98 #endif
Definition: str.h:59
void clearButtons()
Definition: scroll_view.h:116
virtual void itemSelected()=0
void clear()
Definition: array.h:320
Definition: sprites.h:52
Definition: rect.h:144
Definition: party_view.h:32
Definition: messages.h:56
void addButton(int frame, const Common::String &text, Common::KeyCode keycode)
Definition: messages.h:49
Definition: messages.h:72
Definition: detection.h:27
Definition: items_view.h:31
virtual int getLineColor() const
Definition: items_view.h:65
void displayMessage(const Common::String &msg)
Definition: messages.h:41
void clearButtons()
Definition: items_view.h:77