BirthDialog::BirthDialog(MWBase::WindowManager& parWindowManager) : WindowBase("openmw_chargen_birth.layout", parWindowManager) { // Centre dialog center(); getWidget(mSpellArea, "SpellArea"); getWidget(mBirthImage, "BirthsignImage"); getWidget(mBirthList, "BirthsignList"); mBirthList->setScrollVisible(true); mBirthList->eventListSelectAccept += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth); mBirthList->eventListMouseItemActivate += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth); mBirthList->eventListChangePosition += MyGUI::newDelegate(this, &BirthDialog::onSelectBirth); MyGUI::ButtonPtr backButton; getWidget(backButton, "BackButton"); backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onBackClicked); MyGUI::ButtonPtr okButton; getWidget(okButton, "OKButton"); okButton->setCaption(mWindowManager.getGameSettingString("sOK", "")); okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &BirthDialog::onOkClicked); okButton->setTextColour(MyGUI::Colour(0.6f, 0.56f, 0.45f)); updateBirths(); updateSpells(); }
void PickClassDialog::onSelectClass(MyGUI::ListBox* _sender, size_t _index) { if (_index == MyGUI::ITEM_NONE) return; MyGUI::ButtonPtr okButton; getWidget(okButton, "OKButton"); okButton->setTextColour(MyGUI::Colour(0.75f, 0.6f, 0.35f)); const std::string *classId = mClassList->getItemDataAt<std::string>(_index); if (boost::iequals(mCurrentClassId, *classId)) return; mCurrentClassId = *classId; updateStats(); }
void BirthDialog::onSelectBirth(MyGUI::ListBox* _sender, size_t _index) { if (_index == MyGUI::ITEM_NONE) return; MyGUI::ButtonPtr okButton; getWidget(okButton, "OKButton"); okButton->setTextColour(MyGUI::Colour(0.75f, 0.6f, 0.35f)); const std::string *birthId = mBirthList->getItemDataAt<std::string>(_index); if (boost::iequals(mCurrentBirthId, *birthId)) return; mCurrentBirthId = *birthId; updateSpells(); }
void PickClassDialog::setClassId(const std::string &classId) { mCurrentClassId = classId; mClassList->setIndexSelected(MyGUI::ITEM_NONE); size_t count = mClassList->getItemCount(); for (size_t i = 0; i < count; ++i) { if (boost::iequals(*mClassList->getItemDataAt<std::string>(i), classId)) { mClassList->setIndexSelected(i); MyGUI::ButtonPtr okButton; getWidget(okButton, "OKButton"); okButton->setTextColour(MyGUI::Colour(0.75f, 0.6f, 0.35f)); break; } } updateStats(); }
void BirthDialog::setBirthId(const std::string &birthId) { mCurrentBirthId = birthId; mBirthList->setIndexSelected(MyGUI::ITEM_NONE); size_t count = mBirthList->getItemCount(); for (size_t i = 0; i < count; ++i) { if (boost::iequals(*mBirthList->getItemDataAt<std::string>(i), birthId)) { mBirthList->setIndexSelected(i); MyGUI::ButtonPtr okButton; getWidget(okButton, "OKButton"); okButton->setTextColour(MyGUI::Colour(0.75f, 0.6f, 0.35f)); break; } } updateSpells(); }
PickClassDialog::PickClassDialog(MWBase::WindowManager& parWindowManager) : WindowBase("openmw_chargen_class.layout", parWindowManager) { // Centre dialog center(); getWidget(mSpecializationName, "SpecializationName"); getWidget(mFavoriteAttribute[0], "FavoriteAttribute0"); getWidget(mFavoriteAttribute[1], "FavoriteAttribute1"); mFavoriteAttribute[0]->setWindowManager(&mWindowManager); mFavoriteAttribute[1]->setWindowManager(&mWindowManager); for(int i = 0; i < 5; i++) { char theIndex = '0'+i; getWidget(mMajorSkill[i], std::string("MajorSkill").append(1, theIndex)); getWidget(mMinorSkill[i], std::string("MinorSkill").append(1, theIndex)); mMajorSkill[i]->setWindowManager(&mWindowManager); mMinorSkill[i]->setWindowManager(&mWindowManager); } getWidget(mClassList, "ClassList"); mClassList->setScrollVisible(true); mClassList->eventListSelectAccept += MyGUI::newDelegate(this, &PickClassDialog::onSelectClass); mClassList->eventListMouseItemActivate += MyGUI::newDelegate(this, &PickClassDialog::onSelectClass); mClassList->eventListChangePosition += MyGUI::newDelegate(this, &PickClassDialog::onSelectClass); getWidget(mClassImage, "ClassImage"); MyGUI::ButtonPtr backButton; getWidget(backButton, "BackButton"); backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onBackClicked); MyGUI::ButtonPtr okButton; getWidget(okButton, "OKButton"); okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &PickClassDialog::onOkClicked); okButton->setTextColour(MyGUI::Colour(0.6f, 0.56f, 0.45f)); updateClasses(); updateStats(); }