OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
race.hpp
Go to the documentation of this file.
1 #ifndef MWGUI_RACE_H
2 #define MWGUI_RACE_H
3 
4 #include "windowbase.hpp"
5 
6 
7 namespace MWGui
8 {
9  class WindowManager;
10 }
11 
12 namespace MWRender
13 {
14  class RaceSelectionPreview;
15 }
16 
17 namespace ESM
18 {
19  struct NPC;
20 }
21 
22 namespace osg
23 {
24  class Group;
25 }
26 
27 namespace Resource
28 {
29  class ResourceSystem;
30 }
31 
32 namespace MWGui
33 {
34  class RaceDialog : public WindowModal
35  {
36  public:
37  RaceDialog(osg::Group* parent, Resource::ResourceSystem* resourceSystem);
38 
39  enum Gender
40  {
43  };
44 
45  const ESM::NPC &getResult() const;
46  const std::string &getRaceId() const { return mCurrentRaceId; }
47  Gender getGender() const { return mGenderIndex == 0 ? GM_Male : GM_Female; }
48 
49  void setRaceId(const std::string &raceId);
50  void setGender(Gender gender) { mGenderIndex = gender == GM_Male ? 0 : 1; }
51 
52  void setNextButtonShow(bool shown);
53  virtual void open();
54  virtual void close();
55 
56  // Events
57  typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
58 
63 
68 
69  protected:
70  void onHeadRotate(MyGUI::ScrollBar* _sender, size_t _position);
71 
72  void onSelectPreviousGender(MyGUI::Widget* _sender);
73  void onSelectNextGender(MyGUI::Widget* _sender);
74 
75  void onSelectPreviousFace(MyGUI::Widget* _sender);
76  void onSelectNextFace(MyGUI::Widget* _sender);
77 
78  void onSelectPreviousHair(MyGUI::Widget* _sender);
79  void onSelectNextHair(MyGUI::Widget* _sender);
80 
81  void onSelectRace(MyGUI::ListBox* _sender, size_t _index);
82  void onAccept(MyGUI::ListBox* _sender, size_t _index);
83 
84  void onOkClicked(MyGUI::Widget* _sender);
85  void onBackClicked(MyGUI::Widget* _sender);
86 
87  private:
88  void updateRaces();
89  void updateSkills();
90  void updateSpellPowers();
91  void updatePreview();
92  void recountParts();
93 
94  void getBodyParts (int part, std::vector<std::string>& out);
95 
96  osg::Group* mParent;
98 
99  std::vector<std::string> mAvailableHeads;
100  std::vector<std::string> mAvailableHairs;
101 
102  MyGUI::ImageBox* mPreviewImage;
103  MyGUI::ListBox* mRaceList;
104  MyGUI::ScrollBar* mHeadRotate;
105 
106  MyGUI::Widget* mSkillList;
107  std::vector<MyGUI::Widget*> mSkillItems;
108 
109  MyGUI::Widget* mSpellPowerList;
110  std::vector<MyGUI::Widget*> mSpellPowerItems;
111 
113 
114  std::string mCurrentRaceId;
115 
117 
118  std::auto_ptr<MWRender::RaceSelectionPreview> mPreview;
119  std::auto_ptr<MyGUI::ITexture> mPreviewTexture;
120 
122  };
123 }
124 #endif
std::vector< MyGUI::Widget * > mSkillItems
Definition: race.hpp:107
void updateSpellPowers()
Definition: race.cpp:411
EventHandle_Void eventBack
Definition: race.hpp:62
bool mPreviewDirty
Definition: race.hpp:121
Wrapper class that constructs and provides access to the most commonly used resource subsystems...
Definition: resourcesystem.hpp:24
MyGUI::Widget * mSkillList
Definition: race.hpp:106
int mGenderIndex
Definition: race.hpp:112
Definition: race.hpp:42
std::auto_ptr< MWRender::RaceSelectionPreview > mPreview
Definition: race.hpp:118
std::auto_ptr< MyGUI::ITexture > mPreviewTexture
Definition: race.hpp:119
void onSelectNextHair(MyGUI::Widget *_sender)
Definition: race.cpp:252
void updateSkills()
Definition: race.cpp:374
void onSelectNextGender(MyGUI::Widget *_sender)
Definition: race.cpp:226
void setNextButtonShow(bool shown)
Definition: race.cpp:115
EventHandle_WindowBase eventDone
Definition: race.hpp:67
Gender getGender() const
Definition: race.hpp:47
void onSelectPreviousGender(MyGUI::Widget *_sender)
Definition: race.cpp:218
MyGUI::Widget * mSpellPowerList
Definition: race.hpp:109
Definition: race.hpp:41
int mHairIndex
Definition: race.hpp:112
virtual void open()
Notify that window has been made visible.
Definition: race.cpp:126
std::string mCurrentRaceId
Definition: race.hpp:114
void onSelectRace(MyGUI::ListBox *_sender, size_t _index)
Definition: race.cpp:258
void recountParts()
Definition: race.cpp:312
Resource::ResourceSystem * mResourceSystem
Definition: race.hpp:97
void onSelectPreviousFace(MyGUI::Widget *_sender)
Definition: race.cpp:234
MyGUI::ImageBox * mPreviewImage
Definition: race.hpp:102
void onSelectPreviousHair(MyGUI::Widget *_sender)
Definition: race.cpp:246
MyGUI::ListBox * mRaceList
Definition: race.hpp:103
Definition: loadnpc.hpp:23
void onOkClicked(MyGUI::Widget *_sender)
Definition: race.cpp:198
std::vector< std::string > mAvailableHeads
Definition: race.hpp:99
Gender
Definition: race.hpp:39
void updatePreview()
Definition: race.cpp:323
RaceDialog(osg::Group *parent, Resource::ResourceSystem *resourceSystem)
Definition: race.cpp:44
std::vector< MyGUI::Widget * > mSpellPowerItems
Definition: race.hpp:110
const std::string & getRaceId() const
Definition: race.hpp:46
Definition: race.hpp:34
int mFaceIndex
Definition: race.hpp:112
void onBackClicked(MyGUI::Widget *_sender)
Definition: race.cpp:205
osg::Group * mParent
Definition: race.hpp:96
void getBodyParts(int part, std::vector< std::string > &out)
Definition: race.cpp:284
MyGUI::delegates::CMultiDelegate1< WindowBase * > EventHandle_WindowBase
Definition: windowbase.hpp:22
void updateRaces()
Definition: race.cpp:345
void onSelectNextFace(MyGUI::Widget *_sender)
Definition: race.cpp:240
void onAccept(MyGUI::ListBox *_sender, size_t _index)
Definition: race.cpp:276
std::vector< std::string > mAvailableHairs
Definition: race.hpp:100
virtual void close()
Notify that window has been hidden.
Definition: race.cpp:188
void setGender(Gender gender)
Definition: race.hpp:50
float mCurrentAngle
Definition: race.hpp:116
const ESM::NPC & getResult() const
Definition: race.cpp:445
MyGUI::ScrollBar * mHeadRotate
Definition: race.hpp:104
MyGUI::delegates::CMultiDelegate0 EventHandle_Void
Definition: race.hpp:57
void onHeadRotate(MyGUI::ScrollBar *_sender, size_t _position)
Definition: race.cpp:210
void setRaceId(const std::string &raceId)
Definition: race.cpp:170
Definition: windowbase.hpp:41