OpenMW
apps/openmw/mwgui/statswindow.hpp
Go to the documentation of this file.
00001 #ifndef MWGUI_STATS_WINDOW_H
00002 #define MWGUI_STATS_WINDOW_H
00003 
00004 #include "../mwworld/esmstore.hpp"
00005 
00006 #include "../mwmechanics/stat.hpp"
00007 #include "windowpinnablebase.hpp"
00008 
00009 namespace MWGui
00010 {
00011     class WindowManager;
00012 
00013     class StatsWindow : public WindowPinnableBase
00014     {
00015         public:
00016             typedef std::map<std::string, int> FactionList;
00017 
00018             typedef std::vector<int> SkillList;
00019 
00020             StatsWindow();
00021 
00023             void onFrame();
00024 
00025             void setBar(const std::string& name, const std::string& tname, int val, int max);
00026             void setPlayerName(const std::string& playerName);
00027 
00029             void setValue (const std::string& id, const MWMechanics::Stat<int>& value);
00030             void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value);
00031             void setValue (const std::string& id, const std::string& value);
00032             void setValue (const std::string& id, int value);
00033             void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::Stat<float>& value);
00034 
00035             void configureSkills (const SkillList& major, const SkillList& minor);
00036             void setReputation (int reputation) { if (reputation != mReputation) mChanged = true; this->mReputation = reputation; }
00037             void setBounty (int bounty) { if (bounty != mBounty) mChanged = true; this->mBounty = bounty; }
00038             void updateSkillArea();
00039 
00040             virtual void open() { onWindowResize(static_cast<MyGUI::Window*>(mMainWidget)); }
00041 
00042         private:
00043             void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
00044             void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
00045             void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
00046             MyGUI::TextBox* addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
00047             MyGUI::Widget* addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
00048 
00049             void setFactions (const FactionList& factions);
00050             void setExpelled (const std::set<std::string>& expelled);
00051             void setBirthSign (const std::string &signId);
00052 
00053             void onWindowResize(MyGUI::Window* window);
00054             void onMouseWheel(MyGUI::Widget* _sender, int _rel);
00055 
00056             static const int sLineHeight;
00057 
00058             MyGUI::Widget* mLeftPane;
00059             MyGUI::Widget* mRightPane;
00060 
00061             MyGUI::ScrollView* mSkillView;
00062 
00063             SkillList mMajorSkills, mMinorSkills, mMiscSkills;
00064             std::map<int, MWMechanics::Stat<float> > mSkillValues;
00065             std::map<int, MyGUI::TextBox*> mSkillWidgetMap;
00066             std::map<std::string, MyGUI::Widget*> mFactionWidgetMap;
00067             FactionList mFactions; 
00068             std::string mBirthSignId;
00069             int mReputation, mBounty;
00070             std::vector<MyGUI::Widget*> mSkillWidgets; //< Skills and other information
00071             std::set<std::string> mExpelled;
00072 
00073             bool mChanged;
00074 
00075         protected:
00076             virtual void onPinToggled();
00077     };
00078 }
00079 #endif