1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-05 15:55:45 +00:00
OpenMW/apps/openmw/mwgui/race.hpp

114 lines
2.9 KiB
C++
Raw Normal View History

#ifndef MWGUI_RACE_H
#define MWGUI_RACE_H
#include "../mwrender/characterpreview.hpp"
#include "windowbase.hpp"
namespace MWGui
{
class WindowManager;
}
/*
This file contains the dialog for choosing a race.
Layout is defined by resources/mygui/openmw_chargen_race.layout.
*/
namespace MWGui
{
class RaceDialog : public WindowModal
2010-09-14 19:55:41 +00:00
{
public:
RaceDialog();
enum Gender
{
GM_Male,
GM_Female
};
const ESM::NPC &getResult() const { return mPreview->getPrototype(); }
const std::string &getRaceId() const { return mCurrentRaceId; }
Gender getGender() const { return mGenderIndex == 0 ? GM_Male : GM_Female; }
// getFace()
// getHair()
void setRaceId(const std::string &raceId);
void setGender(Gender gender) { mGenderIndex = gender == GM_Male ? 0 : 1; }
// setFace()
// setHair()
void setNextButtonShow(bool shown);
virtual void open();
2012-09-23 22:42:05 +00:00
virtual void close();
// Events
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
/** Event : Back button clicked.\n
2010-09-14 19:55:41 +00:00
signature : void method()\n
*/
EventHandle_Void eventBack;
2014-09-07 01:21:24 +00:00
/** Event : Dialog finished, OK button clicked.\n
signature : void method()\n
*/
EventHandle_WindowBase eventDone;
void doRenderUpdate();
protected:
2012-03-22 14:23:23 +00:00
void onHeadRotate(MyGUI::ScrollBar* _sender, size_t _position);
2010-09-14 19:55:41 +00:00
void onSelectPreviousGender(MyGUI::Widget* _sender);
void onSelectNextGender(MyGUI::Widget* _sender);
2010-09-14 19:55:41 +00:00
void onSelectPreviousFace(MyGUI::Widget* _sender);
void onSelectNextFace(MyGUI::Widget* _sender);
2010-09-14 19:55:41 +00:00
void onSelectPreviousHair(MyGUI::Widget* _sender);
void onSelectNextHair(MyGUI::Widget* _sender);
2012-03-22 14:28:06 +00:00
void onSelectRace(MyGUI::ListBox* _sender, size_t _index);
void onAccept(MyGUI::ListBox* _sender, size_t _index);
void onOkClicked(MyGUI::Widget* _sender);
void onBackClicked(MyGUI::Widget* _sender);
2010-09-14 19:55:41 +00:00
private:
void updateRaces();
void updateSkills();
void updateSpellPowers();
void updatePreview();
2012-11-10 17:30:16 +00:00
void recountParts();
void getBodyParts (int part, std::vector<std::string>& out);
std::vector<std::string> mAvailableHeads;
std::vector<std::string> mAvailableHairs;
2012-09-13 17:03:31 +00:00
MyGUI::ImageBox* mPreviewImage;
MyGUI::ListBox* mRaceList;
MyGUI::ScrollBar* mHeadRotate;
MyGUI::Widget* mSkillList;
std::vector<MyGUI::Widget*> mSkillItems;
MyGUI::Widget* mSpellPowerList;
std::vector<MyGUI::Widget*> mSpellPowerItems;
int mGenderIndex, mFaceIndex, mHairIndex;
std::string mCurrentRaceId;
2012-09-13 17:03:31 +00:00
float mCurrentAngle;
2014-08-13 17:30:46 +00:00
std::auto_ptr<MWRender::RaceSelectionPreview> mPreview;
bool mPreviewDirty;
2010-09-14 19:55:41 +00:00
};
}
#endif