1 #ifndef MWGUI_REVIEW_H
2 #define MWGUI_REVIEW_H
3 
4 #include <components/esm/attr.hpp>
5 #include <components/esm/loadclas.hpp>
6 #include "windowbase.hpp"
7 #include "widgets.hpp"
8 
9 namespace ESM
10 {
11     struct Spell;
12 }
13 
14 namespace MWGui
15 {
16     class ReviewDialog : public WindowModal
17     {
18     public:
19         enum Dialogs {
20             NAME_DIALOG,
21             RACE_DIALOG,
22             CLASS_DIALOG,
23             BIRTHSIGN_DIALOG
24         };
25         typedef std::vector<int> SkillList;
26 
27         ReviewDialog();
28 
exit()29         bool exit() override { return false; }
30 
31         void setPlayerName(const std::string &name);
32         void setRace(const std::string &raceId);
33         void setClass(const ESM::Class& class_);
34         void setBirthSign (const std::string &signId);
35 
36         void setHealth(const MWMechanics::DynamicStat<float>& value);
37         void setMagicka(const MWMechanics::DynamicStat<float>& value);
38         void setFatigue(const MWMechanics::DynamicStat<float>& value);
39 
40         void setAttribute(ESM::Attribute::AttributeID attributeId, const MWMechanics::AttributeValue& value);
41 
42         void configureSkills(const SkillList& major, const SkillList& minor);
43         void setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::SkillValue& value);
44 
45         void onOpen() override;
46 
47         void onFrame(float duration) override;
48 
49         // Events
50         typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
51         typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_Int;
52 
53         /** Event : Back button clicked.\n
54         signature : void method()\n
55         */
56         EventHandle_Void eventBack;
57 
58         /** Event : Dialog finished, OK button clicked.\n
59             signature : void method()\n
60         */
61         EventHandle_WindowBase eventDone;
62 
63         EventHandle_Int eventActivateDialog;
64 
65     protected:
66         void onOkClicked(MyGUI::Widget* _sender);
67         void onBackClicked(MyGUI::Widget* _sender);
68 
69         void onNameClicked(MyGUI::Widget* _sender);
70         void onRaceClicked(MyGUI::Widget* _sender);
71         void onClassClicked(MyGUI::Widget* _sender);
72         void onBirthSignClicked(MyGUI::Widget* _sender);
73 
74         void onMouseWheel(MyGUI::Widget* _sender, int _rel);
75 
76     private:
77         void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
78         void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
79         void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
80         MyGUI::TextBox* addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
81         void addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
82         void addItem(const ESM::Spell* spell, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
83         void updateSkillArea();
84 
85         MyGUI::TextBox *mNameWidget, *mRaceWidget, *mClassWidget, *mBirthSignWidget;
86         MyGUI::ScrollView* mSkillView;
87 
88         Widgets::MWDynamicStatPtr mHealth, mMagicka, mFatigue;
89 
90         std::map<int, Widgets::MWAttributePtr> mAttributeWidgets;
91 
92         SkillList mMajorSkills, mMinorSkills, mMiscSkills;
93         std::map<int, MWMechanics::SkillValue > mSkillValues;
94         std::map<int, MyGUI::TextBox*> mSkillWidgetMap;
95         std::string mName, mRaceId, mBirthSignId;
96         ESM::Class mKlass;
97         std::vector<MyGUI::Widget*> mSkillWidgets; //< Skills and other information
98 
99         bool mUpdateSkillArea;
100     };
101 }
102 #endif
103