xoreos  0.0.5
charfeats.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_CHARFEATS_H
26 #define ENGINES_NWN_GUI_CHARGEN_CHARFEATS_H
27 
28 #include <vector>
29 #include <list>
30 #include <map>
31 
32 #include "src/common/scopedptr.h"
33 
36 
37 namespace Engines {
38 
39 namespace NWN {
40 
41 class CharHelp;
42 class CharFeatsPopup;
43 class WidgetListBox;
44 class WidgetButton;
45 
47 public:
50 
51  void callbackHelp();
52 
53 private:
54  void subActive(Widget &widget);
56 
57  friend class CharFeats;
58 };
59 
60 typedef std::map<FeatItem, std::vector<FeatItem> > MasterFeatsMap;
61 
62 class CharFeats : public CharGenBase {
63 public:
64  CharFeats(CharGenChoices &choices, ::Engines::Console *console = 0);
65  ~CharFeats();
66 
67  void reset();
68  void fixWidgetType(const Common::UString &tag, NWN::GUI::WidgetType &type);
69 
70  void showFeatHelp(FeatItem &feat);
71  void moveFeat(FeatItem feat, bool toKnownFeats, bool rebuild = true);
72  void moveFeat(WidgetListItemFeat *item);
73 
74 private:
75  void callbackActive(Widget &widget);
76  void callbackRun();
77 
78  void makeAvailList(uint8 list);
79  void makeKnownList();
80 
81  void changeAvailFeats(int8 diff, bool normalFeat, bool rebuild = true);
82 
83  void setRecommendedFeats();
84 
87 
90 
91  std::list<FeatItem> _availFeats;
92  std::list<FeatItem> _knownFeats;
93 
94  std::vector<WidgetListItemFeat *> _featsTrash;
95 
99 };
100 
101 } // End of namespace NWN
102 
103 } // End of namespace Engines
104 
105 #endif // ENGINES_NWN_GUI_CHARGEN_CHARFEATS_H
A class holding an UTF-8 string.
Definition: ustring.h:48
void makeAvailList(uint8 list)
Definition: charfeats.cpp:264
Common::ScopedPtr< CharFeatsPopup > _featsPopup
Definition: charfeats.h:86
uint8_t uint8
Definition: types.h:200
std::list< FeatItem > _availFeats
Definition: charfeats.h:91
std::list< FeatItem > _knownFeats
Definition: charfeats.h:92
A simple scoped smart pointer template.
A GUI.
Definition: gui.h:43
WidgetListBox * _availListBox
Definition: charfeats.h:88
void subActive(Widget &widget)
A sub-widget was activated.
Definition: charfeats.cpp:70
CharFeats(CharGenChoices &choices, ::Engines::Console *console=0)
Definition: charfeats.cpp:77
WidgetListItemFeat(::Engines::GUI &gui, FeatItem &feat)
Definition: charfeats.cpp:51
A NWN listbox widget.
Definition: listbox.h:116
Common::ScopedPtr< CharHelp > _featHelp
Definition: charfeats.h:85
A scoped plain pointer, allowing pointer-y access and normal deletion.
Definition: scopedptr.h:120
std::map< FeatItem, std::vector< FeatItem > > MasterFeatsMap
Definition: charfeats.h:60
void moveFeat(FeatItem feat, bool toKnownFeats, bool rebuild=true)
Definition: charfeats.cpp:131
Button items used in WidgetListBox.
The character generator base class.
A widget in a GUI.
Definition: widget.h:40
int8_t int8
Definition: types.h:199
void fixWidgetType(const Common::UString &tag, NWN::GUI::WidgetType &type)
Definition: charfeats.cpp:118
void callbackRun()
Callback that&#39;s triggered periodically in the run() method.
Definition: charfeats.cpp:253
WidgetListBox * _knownListBox
Definition: charfeats.h:89
std::vector< WidgetListItemFeat * > _featsTrash
Definition: charfeats.h:94
void showFeatHelp(FeatItem &feat)
Definition: charfeats.cpp:123
void changeAvailFeats(int8 diff, bool normalFeat, bool rebuild=true)
Definition: charfeats.cpp:348
void callbackActive(Widget &widget)
Callback that&#39;s triggered when a widget was activated.
Definition: charfeats.cpp:218