xoreos  0.0.5
charspells.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef ENGINES_NWN_GUI_CHARGEN_CHARSPELLS_H
26 #define ENGINES_NWN_GUI_CHARGEN_CHARSPELLS_H
27 
28 #include <vector>
29 
30 #include "src/common/scopedptr.h"
31 
34 
35 namespace Engines {
36 
37 namespace NWN {
38 
39 class CharHelp;
40 class PortraitWidget;
41 
42 struct Spell {
47 };
48 
50 public:
51  WidgetListItemSpell(::Engines::GUI &gui, Spell spell, bool isRight = true);
53 
54 private:
55  void subActive(Widget &widget);
56  void callbackHelp();
57 
59 
60  friend class CharSpells;
61 };
62 
63 class CharSpells : public CharGenBase {
64 public:
65  CharSpells(CharGenChoices &choices, Engines::Console *console);
66  ~CharSpells();
67 
68  void reset();
69  void fixWidgetType(const Common::UString &tag, NWN::GUI::WidgetType &type);
70 
71  void showSpellLevel(size_t spellLevel, bool forceUpdate = false);
72  void moveSpell(WidgetListItemSpell *spellItem);
73  void showSpellHelp(Spell &spell);
74 
75 private:
76  void callbackActive(Widget &widget);
77 
78  void makeSpellsList();
79  void computeRemainingSpells(const Aurora::TwoDARow &classRow);
80  void updateRemainLabel();
81  void setRecommendedSpells();
82 
84 
87 
88  std::vector<std::vector<Spell> > _availSpells;
89  std::vector<std::vector<Spell> > _knownSpells;
90 
91  std::vector<uint8> _remainingSpells;
92 
94  size_t _maxLevel;
95  size_t _abilityLimit;
96 };
97 
98 } // End of namespace NWN
99 
100 } // End of namespace Engines
101 
102 #endif // ENGINES_NWN_GUI_CHARGEN_CHARSPELLS_H
Common::ScopedPtr< CharHelp > _spellHelp
Definition: charspells.h:83
A class holding an UTF-8 string.
Definition: ustring.h:48
WidgetListBox * _availListBox
Definition: charspells.h:85
std::vector< std::vector< Spell > > _availSpells
Definition: charspells.h:88
Common::UString icon
Definition: charspells.h:45
CharSpells(CharGenChoices &choices, Engines::Console *console)
Definition: charspells.cpp:74
Common::UString name
Definition: charspells.h:44
void moveSpell(WidgetListItemSpell *spellItem)
Definition: charspells.cpp:169
void showSpellHelp(Spell &spell)
Definition: charspells.cpp:454
A simple scoped smart pointer template.
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: charspells.cpp:220
std::vector< std::vector< Spell > > _knownSpells
Definition: charspells.h:89
WidgetListItemSpell(::Engines::GUI &gui, Spell spell, bool isRight=true)
Definition: charspells.cpp:49
A GUI.
Definition: gui.h:43
WidgetListBox * _knownListBox
Definition: charspells.h:86
Common::UString desc
Definition: charspells.h:46
uint16_t uint16
Definition: types.h:202
void computeRemainingSpells(const Aurora::TwoDARow &classRow)
Definition: charspells.cpp:388
A NWN listbox widget.
Definition: listbox.h:116
A scoped plain pointer, allowing pointer-y access and normal deletion.
Definition: scopedptr.h:120
void subActive(Widget &widget)
A sub-widget was activated.
Definition: charspells.cpp:65
Button items used in WidgetListBox.
The character generator base class.
A widget in a GUI.
Definition: widget.h:40
std::vector< uint8 > _remainingSpells
Definition: charspells.h:91
void fixWidgetType(const Common::UString &tag, NWN::GUI::WidgetType &type)
Definition: charspells.cpp:114
void showSpellLevel(size_t spellLevel, bool forceUpdate=false)
Definition: charspells.cpp:119
A row within a 2DA file.
Definition: 2dafile.h:61