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 open() { 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  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  static const int sLineHeight;
57 
58  MyGUI::Widget* mLeftPane;
59  MyGUI::Widget* mRightPane;
60 
61  MyGUI::ScrollView* mSkillView;
62 
64  std::map<int, MWMechanics::SkillValue > mSkillValues;
65  std::map<int, MyGUI::TextBox*> mSkillWidgetMap;
66  std::map<std::string, MyGUI::Widget*> mFactionWidgetMap;
68  std::string mBirthSignId;
70  std::vector<MyGUI::Widget*> mSkillWidgets; //< Skills and other information
71  std::set<std::string> mExpelled;
72 
73  bool mChanged;
74 
75  protected:
76  virtual void onPinToggled();
77  virtual void onTitleDoubleClicked();
78  };
79 }
80 #endif
void updateSkillArea()
Definition: statswindow.cpp:447
Definition: stat.hpp:108
void onMouseWheel(MyGUI::Widget *_sender, int _rel)
Definition: statswindow.cpp:79
void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
Definition: statswindow.cpp:294
MyGUI::Widget * mMainWidget
Definition: layout.hpp:54
MyGUI::Widget * addItem(const std::string &text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
Definition: statswindow.cpp:346
std::map< std::string, MyGUI::Widget * > mFactionWidgetMap
Definition: statswindow.hpp:66
void setPlayerName(const std::string &playerName)
Definition: statswindow.cpp:109
void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
Definition: statswindow.cpp:366
std::vector< MyGUI::Widget * > mSkillWidgets
Definition: statswindow.hpp:70
virtual void onTitleDoubleClicked()
Definition: statswindow.cpp:627
std::set< std::string > mExpelled
Definition: statswindow.hpp:71
MyGUI::ScrollView * mSkillView
Definition: statswindow.hpp:61
Definition: draganddrop.hpp:17
MyGUI::Widget * mRightPane
Definition: statswindow.hpp:59
virtual void open()
Notify that window has been made visible.
Definition: statswindow.hpp:40
Definition: statswindow.hpp:13
MyGUI::TextBox * addValueItem(const std::string &text, const std::string &value, const std::string &state, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
Definition: statswindow.cpp:319
void onWindowResize(MyGUI::Window *window)
Definition: statswindow.cpp:87
void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
Definition: statswindow.cpp:306
void setValue(const std::string &id, const MWMechanics::AttributeValue &value)
Set value for the given ID.
Definition: statswindow.cpp:114
Definition: windowbase.hpp:52
Definition: windowpinnablebase.hpp:10
SkillList mMiscSkills
Definition: statswindow.hpp:63
void setFactions(const FactionList &factions)
Definition: statswindow.cpp:267
bool mChanged
Definition: statswindow.hpp:73
std::string mBirthSignId
Definition: statswindow.hpp:68
std::vector< int > SkillList
Definition: statswindow.hpp:18
StatsWindow(DragAndDrop *drag)
Definition: statswindow.cpp:27
void configureSkills(const SkillList &major, const SkillList &minor)
Definition: statswindow.cpp:210
void setBounty(int bounty)
Definition: statswindow.hpp:37
MyGUI::Widget * mLeftPane
Definition: statswindow.hpp:58
std::map< int, MWMechanics::SkillValue > mSkillValues
Definition: statswindow.hpp:64
void setReputation(int reputation)
Definition: statswindow.hpp:36
std::map< int, MyGUI::TextBox * > mSkillWidgetMap
Definition: statswindow.hpp:65
Definition: stat.hpp:137
void setExpelled(const std::set< std::string > &expelled)
Definition: statswindow.cpp:276
void setBar(const std::string &name, const std::string &tname, int val, int max)
Definition: statswindow.cpp:97
FactionList mFactions
Stores a list of factions and the current rank.
Definition: statswindow.hpp:67
virtual void onPinToggled()
Definition: statswindow.cpp:622
SkillEnum
Definition: loadskil.hpp:45
static const int sLineHeight
Definition: statswindow.hpp:56
SkillList mMajorSkills
Definition: statswindow.hpp:63
int mBounty
Definition: statswindow.hpp:69
void onFrame(float dt)
automatically updates all the data in the stats window, but only if it has changed.
Definition: statswindow.cpp:231
SkillList mMinorSkills
Definition: statswindow.hpp:63
void setBirthSign(const std::string &signId)
Definition: statswindow.cpp:285
std::map< std::string, int > FactionList
Definition: statswindow.hpp:16
int mReputation
Definition: statswindow.hpp:69
const char * name
Definition: crashcatcher.cpp:59