Do not store StaticTextPtr in WidgetPtr and use setTextColour

actorid
Jan-Peter Nilsson 14 years ago
parent bb212e20f4
commit 9d57b4f0d6

@ -85,7 +85,7 @@ ReviewDialog::ReviewDialog(MWWorld::Environment& environment)
for (int i = 0; i < ESM::Skill::Length; ++i) for (int i = 0; i < ESM::Skill::Length; ++i)
{ {
skillValues.insert(std::pair<int, MWMechanics::Stat<float> >(i, MWMechanics::Stat<float>())); skillValues.insert(std::pair<int, MWMechanics::Stat<float> >(i, MWMechanics::Stat<float>()));
skillWidgetMap.insert(std::pair<int, MyGUI::WidgetPtr>(i, nullptr)); skillWidgetMap.insert(std::pair<int, MyGUI::StaticTextPtr>(i, nullptr));
} }
static_cast<MyGUI::WindowPtr>(mMainWidget)->eventWindowChangeCoord = MyGUI::newDelegate(this, &ReviewDialog::onWindowResize); static_cast<MyGUI::WindowPtr>(mMainWidget)->eventWindowChangeCoord = MyGUI::newDelegate(this, &ReviewDialog::onWindowResize);
@ -180,7 +180,7 @@ void ReviewDialog::setAttribute(ESM::Attribute::AttributeID attributeId, const M
void ReviewDialog::setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::Stat<float>& value) void ReviewDialog::setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::Stat<float>& value)
{ {
skillValues[skillId] = value; skillValues[skillId] = value;
MyGUI::WidgetPtr widget = skillWidgetMap[skillId]; MyGUI::StaticTextPtr widget = skillWidgetMap[skillId];
if (widget) if (widget)
{ {
float modified = value.getModified(), base = value.getBase(); float modified = value.getModified(), base = value.getBase();
@ -214,7 +214,7 @@ void ReviewDialog::configureSkills(const std::vector<int>& major, const std::vec
} }
} }
void ReviewDialog::setStyledText(MyGUI::WidgetPtr widget, ColorStyle style, const std::string &value) void ReviewDialog::setStyledText(MyGUI::StaticTextPtr widget, ColorStyle style, const std::string &value)
{ {
widget->setCaption(value); widget->setCaption(value);
if (style == CS_Super) if (style == CS_Super)
@ -244,7 +244,7 @@ void ReviewDialog::addGroup(const std::string &label, MyGUI::IntCoord &coord1, M
coord2.top += lineHeight; coord2.top += lineHeight;
} }
MyGUI::WidgetPtr ReviewDialog::addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2) MyGUI::StaticTextPtr ReviewDialog::addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2)
{ {
MyGUI::StaticTextPtr skillNameWidget, skillValueWidget; MyGUI::StaticTextPtr skillNameWidget, skillValueWidget;
@ -307,7 +307,7 @@ void ReviewDialog::addSkills(const SkillList &skills, const std::string &titleId
style = CS_Super; style = CS_Super;
else if (modified < base) else if (modified < base)
style = CS_Sub; style = CS_Sub;
MyGUI::WidgetPtr widget = addValueItem(wm->getGameSettingString(skillNameId, skillNameId), boost::lexical_cast<std::string>(static_cast<int>(modified)), style, coord1, coord2); MyGUI::StaticTextPtr widget = addValueItem(wm->getGameSettingString(skillNameId, skillNameId), boost::lexical_cast<std::string>(static_cast<int>(modified)), style, coord1, coord2);
skillWidgetMap[skillId] = widget; skillWidgetMap[skillId] = widget;
} }
} }

@ -92,11 +92,11 @@ namespace MWGui
CS_Normal, CS_Normal,
CS_Super CS_Super
}; };
void setStyledText(MyGUI::WidgetPtr widget, ColorStyle style, const std::string &value); void setStyledText(MyGUI::StaticTextPtr widget, ColorStyle style, const std::string &value);
void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); void addSkills(const SkillList &skills, const std::string &titleId, const std::string &titleDefault, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); void addSeparator(MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); void addGroup(const std::string &label, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
MyGUI::WidgetPtr addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); MyGUI::StaticTextPtr addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
void addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); void addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
void updateScroller(); void updateScroller();
void updateSkillArea(); void updateSkillArea();
@ -118,7 +118,7 @@ namespace MWGui
SkillList majorSkills, minorSkills, miscSkills; SkillList majorSkills, minorSkills, miscSkills;
std::map<int, MWMechanics::Stat<float> > skillValues; std::map<int, MWMechanics::Stat<float> > skillValues;
std::map<int, MyGUI::WidgetPtr> skillWidgetMap; std::map<int, MyGUI::StaticTextPtr> skillWidgetMap;
std::string name, raceId, birthSignId; std::string name, raceId, birthSignId;
ESM::Class klass; ESM::Class klass;
std::vector<MyGUI::WidgetPtr> skillWidgets; //< Skills and other information std::vector<MyGUI::WidgetPtr> skillWidgets; //< Skills and other information

Loading…
Cancel
Save