OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
statswindow.hpp
Go to the documentation of this file.
1 #ifndef MWGUI_STATS_WINDOW_H
2 #define MWGUI_STATS_WINDOW_H
3 
4 #include "../mwmechanics/stat.hpp"
5 #include "windowpinnablebase.hpp"
6 
8 
9 namespace MWGui
10 {
11  class WindowManager;
12 
13  class StatsWindow : public WindowPinnableBase, public NoDrop
14  {
15  public:
16  typedef std::map<std::string, int> FactionList;
17 
18  typedef std::vector<int> SkillList;
19 
20  StatsWindow(DragAndDrop* drag);
21 
23  void onFrame(float dt);
24 
25  void setBar(const std::string& name, const std::string& tname, int val, int max);
26  void setPlayerName(const std::string& playerName);
27 
29  void setValue (const std::string& id, const MWMechanics::AttributeValue& value);
30  void setValue (const std::string& id, const MWMechanics::DynamicStat<float>& value);
31  void setValue (const std::string& id, const std::string& value);
32  void setValue (const std::string& id, int value);
33  void setValue(const ESM::Skill::SkillEnum parSkill, const MWMechanics::SkillValue& value);
34 
35  void configureSkills (const SkillList& major, const SkillList& minor);
36  void setReputation (int reputation) { if (reputation != mReputation) mChanged = true; this->mReputation = reputation; }
37  void setBounty (int bounty) { if (bounty != mBounty) mChanged = true; this->mBounty = bounty; }
38  void updateSkillArea();
39 
40  virtual void onOpen() { onWindowResize(mMainWidget->castType<MyGUI::Window>()); }
41 
42  private:
43  void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
44  void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
45  void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
46  std::pair<MyGUI::TextBox*, MyGUI::TextBox*> addValueItem(const std::string& text, const std::string &value, const std::string& state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
47  MyGUI::Widget* addItem(const std::string& text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
48 
49  void setFactions (const FactionList& factions);
50  void setExpelled (const std::set<std::string>& expelled);
51  void setBirthSign (const std::string &signId);
52 
53  void onWindowResize(MyGUI::Window* window);
54  void onMouseWheel(MyGUI::Widget* _sender, int _rel);
55 
56  MyGUI::Widget* mLeftPane;
57  MyGUI::Widget* mRightPane;
58 
59  MyGUI::ScrollView* mSkillView;
60 
62  std::map<int, MWMechanics::SkillValue > mSkillValues;
63  std::map<int, std::pair<MyGUI::TextBox*, MyGUI::TextBox*> > mSkillWidgetMap;
64  std::map<std::string, MyGUI::Widget*> mFactionWidgetMap;
66  std::string mBirthSignId;
68  std::vector<MyGUI::Widget*> mSkillWidgets; //< Skills and other information
69  std::set<std::string> mExpelled;
70 
71  bool mChanged;
72 
73  protected:
74  virtual void onPinToggled();
75  virtual void onTitleDoubleClicked();
76  };
77 }
78 #endif
void updateSkillArea()
Definition: statswindow.cpp:502
Definition: stat.hpp:123
void onMouseWheel(MyGUI::Widget *_sender, int _rel)
Definition: statswindow.cpp:80
void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
Definition: statswindow.cpp:355
MyGUI::Widget * mMainWidget
Definition: layout.hpp:66
MyGUI::Widget * addItem(const std::string &text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
Definition: statswindow.cpp:409
std::map< std::string, MyGUI::Widget * > mFactionWidgetMap
Definition: statswindow.hpp:64
void setPlayerName(const std::string &playerName)
Definition: statswindow.cpp:111
void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
Definition: statswindow.cpp:430
std::vector< MyGUI::Widget * > mSkillWidgets
Definition: statswindow.hpp:68
virtual void onTitleDoubleClicked()
Definition: statswindow.cpp:684
std::set< std::string > mExpelled
Definition: statswindow.hpp:69
MyGUI::ScrollView * mSkillView
Definition: statswindow.hpp:59
std::map< int, std::pair< MyGUI::TextBox *, MyGUI::TextBox * > > mSkillWidgetMap
Definition: statswindow.hpp:63
Definition: draganddrop.hpp:17
MyGUI::Widget * mRightPane
Definition: statswindow.hpp:57
Definition: statswindow.hpp:13
void onWindowResize(MyGUI::Window *window)
Definition: statswindow.cpp:88
void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
Definition: statswindow.cpp:367
void setValue(const std::string &id, const MWMechanics::AttributeValue &value)
Set value for the given ID.
Definition: statswindow.cpp:116
Definition: windowbase.hpp:72
Definition: windowpinnablebase.hpp:10
SkillList mMiscSkills
Definition: statswindow.hpp:61
void setFactions(const FactionList &factions)
Definition: statswindow.cpp:328
bool mChanged
Definition: statswindow.hpp:71
std::string mBirthSignId
Definition: statswindow.hpp:66
std::vector< int > SkillList
Definition: statswindow.hpp:18
std::pair< MyGUI::TextBox *, MyGUI::TextBox * > addValueItem(const std::string &text, const std::string &value, const std::string &state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
Definition: statswindow.cpp:381
StatsWindow(DragAndDrop *drag)
Definition: statswindow.cpp:26
void configureSkills(const SkillList &major, const SkillList &minor)
Definition: statswindow.cpp:274
void setBounty(int bounty)
Definition: statswindow.hpp:37
MyGUI::Widget * mLeftPane
Definition: statswindow.hpp:56
std::map< int, MWMechanics::SkillValue > mSkillValues
Definition: statswindow.hpp:62
void setReputation(int reputation)
Definition: statswindow.hpp:36
Definition: stat.hpp:152
void setExpelled(const std::set< std::string > &expelled)
Definition: statswindow.cpp:337
void setBar(const std::string &name, const std::string &tname, int val, int max)
Definition: statswindow.cpp:98
FactionList mFactions
Stores a list of factions and the current rank.
Definition: statswindow.hpp:65
virtual void onPinToggled()
Definition: statswindow.cpp:677
SkillEnum
Definition: loadskil.hpp:45
SkillList mMajorSkills
Definition: statswindow.hpp:61
int mBounty
Definition: statswindow.hpp:67
void onFrame(float dt)
automatically updates all the data in the stats window, but only if it has changed.
Definition: statswindow.cpp:295
SkillList mMinorSkills
Definition: statswindow.hpp:61
virtual void onOpen()
Notify that window has been made visible.
Definition: statswindow.hpp:40
void setBirthSign(const std::string &signId)
Definition: statswindow.cpp:346
std::map< std::string, int > FactionList
Definition: statswindow.hpp:16
int mReputation
Definition: statswindow.hpp:67
const char * name
Definition: crashcatcher.cpp:67