ScummVM API documentation
TraitMenu.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_TRAITMENU_H
32 #define CRAB_TRAITMENU_H
33 
34 #include "crab/people/person.h"
35 #include "crab/ui/menu.h"
36 #include "crab/ui/ParagraphData.h"
37 #include "crab/ui/TraitButton.h"
38 
39 namespace Crab {
40 
41 namespace pyrodactyl {
42 namespace ui {
43 class TraitMenu {
44  // The menu for displaying all the traits
45  Menu<TraitButton> _menu;
46 
47  // The reference button (from which all buttons are initialized)
48  TraitButton _ref;
49 
50  // This vector stores the increments in x,y for each new button
51  Vector2i _inc;
52 
53  // How to draw the selected trait description
54  ParagraphData _desc;
55 
56  // The selected trait, and size of the menu
57  int _select;
58 
59  // The size and dimensions of the menu
60  uint _size, _rows, _cols;
61 
62 public:
63  TraitMenu() {
64  _select = -1;
65  _size = 1;
66  _rows = 1;
67  _cols = 1;
68  }
69 
70  ~TraitMenu() {}
71 
72  void reset() {
73  _select = -1;
74  }
75 
76  void clear();
77 
78  void load(rapidxml::xml_node<char> *node);
79  void draw(const pyrodactyl::people::Person *obj);
80 
81  void handleEvents(pyrodactyl::people::Person *obj, const Common::Event &event);
82 
83  void cache(const pyrodactyl::people::Person &obj);
84  void setUI();
85 };
86 } // End of namespace ui
87 } // End of namespace pyrodactyl
88 
89 } // End of namespace Crab
90 
91 #endif // CRAB_TRAITMENU_H
Definition: ParagraphData.h:40
Definition: menu.h:47
Definition: person.h:43
Definition: events.h:199
Definition: moveeffect.h:37
Definition: TraitButton.h:41
Definition: TraitMenu.h:43