OpenMW
apps/openmw/mwgui/review.hpp
Go to the documentation of this file.
00001 #ifndef MWGUI_REVIEW_H
00002 #define MWGUI_REVIEW_H
00003 
00004 #include "windowbase.hpp"
00005 #include "widgets.hpp"
00006 
00007 namespace MWGui
00008 {
00009     class WindowManager;
00010 }
00011 
00012 /*
00013 This file contains the dialog for reviewing the generated character.
00014 Layout is defined by resources/mygui/openmw_chargen_review.layout.
00015 */
00016 
00017 namespace MWGui
00018 {
00019     class ReviewDialog : public WindowModal
00020     {
00021     public:
00022         enum Dialogs {
00023             NAME_DIALOG,
00024             RACE_DIALOG,
00025             CLASS_DIALOG,
00026             BIRTHSIGN_DIALOG
00027         };
00028         typedef std::vector<int> SkillList;
00029 
00030         ReviewDialog();
00031 
00032         void setPlayerName(const std::string &name);
00033         void setRace(const std::string &raceId);
00034         void setClass(const ESM::Class& class_);
00035         void setBirthSign (const std::string &signId);
00036 
00037         void setHealth(const MWMechanics::DynamicStat<float>& value);
00038         void setMagicka(const MWMechanics::DynamicStat<float>& value);
00039         void setFatigue(const MWMechanics::DynamicStat<float>& value);
00040 
00041         void setAttribute(ESM::Attribute::AttributeID attributeId, const MWMechanics::Stat<int>& value);
00042 
00043         void configureSkills(const SkillList& major, const SkillList& minor);
00044         void setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::Stat<float>& value);
00045 
00046         virtual void open();
00047 
00048         // Events
00049         typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
00050         typedef MyGUI::delegates::CMultiDelegate1<int> EventHandle_Int;
00051 
00055         EventHandle_Void eventBack;
00056 
00057         EventHandle_Int eventActivateDialog;
00058 
00059     protected:
00060         void onOkClicked(MyGUI::Widget* _sender);
00061         void onBackClicked(MyGUI::Widget* _sender);
00062 
00063         void onNameClicked(MyGUI::Widget* _sender);
00064         void onRaceClicked(MyGUI::Widget* _sender);
00065         void onClassClicked(MyGUI::Widget* _sender);
00066         void onBirthSignClicked(MyGUI::Widget* _sender);
00067 
00068         void onMouseWheel(MyGUI::Widget* _sender, int _rel);
00069 
00070     private:
00071         void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
00072         void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
00073         void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
00074         MyGUI::TextBox* addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
00075         void addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
00076         void updateSkillArea();
00077 
00078         static const int sLineHeight;
00079 
00080         MyGUI::TextBox *mNameWidget, *mRaceWidget, *mClassWidget, *mBirthSignWidget;
00081         MyGUI::ScrollView* mSkillView;
00082 
00083         Widgets::MWDynamicStatPtr mHealth, mMagicka, mFatigue;
00084 
00085         std::map<int, Widgets::MWAttributePtr> mAttributeWidgets;
00086 
00087         SkillList mMajorSkills, mMinorSkills, mMiscSkills;
00088         std::map<int, MWMechanics::Stat<float> > mSkillValues;
00089         std::map<int, MyGUI::TextBox*> mSkillWidgetMap;
00090         std::string mName, mRaceId, mBirthSignId;
00091         ESM::Class mKlass;
00092         std::vector<MyGUI::Widget*> mSkillWidgets; //< Skills and other information
00093     };
00094 }
00095 #endif