SelectAttributeDialog::SelectAttributeDialog(WindowManager& parWindowManager) : WindowBase("openmw_chargen_select_attribute.layout", parWindowManager) { // Centre dialog center(); setText("LabelT", mWindowManager.getGameSettingString("sAttributesMenu1", "")); for (int i = 0; i < 8; ++i) { Widgets::MWAttributePtr attribute; char theIndex = '0'+i; getWidget(attribute, std::string("Attribute").append(1, theIndex)); attribute->setWindowManager(&parWindowManager); attribute->setAttributeId(ESM::Attribute::attributeIds[i]); attribute->eventClicked += MyGUI::newDelegate(this, &SelectAttributeDialog::onAttributeClicked); ToolTips::createAttributeToolTip(attribute, attribute->getAttributeId()); } MyGUI::ButtonPtr cancelButton; getWidget(cancelButton, "CancelButton"); cancelButton->setCaption(mWindowManager.getGameSettingString("sCancel", "")); cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectAttributeDialog::onCancelClicked); int buttonWidth = cancelButton->getTextSize().width + 24; cancelButton->setCoord(186 - buttonWidth, 180, buttonWidth, 21); MyGUI::InputManager::getInstance().addWidgetModal(mMainWidget); }
SelectAttributeDialog::SelectAttributeDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize) : WindowBase("openmw_chargen_select_attribute_layout.xml", environment) { // Centre dialog center(); WindowManager *wm = environment.mWindowManager; setText("LabelT", wm->getGameSettingString("sAttributesMenu1", "")); for (int i = 0; i < 8; ++i) { Widgets::MWAttributePtr attribute; char theIndex = '0'+i; getWidget(attribute, std::string("Attribute").append(1, theIndex)); attribute->setWindowManager(wm); attribute->setAttributeId(ESM::Attribute::attributeIds[i]); attribute->eventClicked = MyGUI::newDelegate(this, &SelectAttributeDialog::onAttributeClicked); } // TODO: These buttons should be managed by a Dialog class MyGUI::ButtonPtr cancelButton; getWidget(cancelButton, "CancelButton"); cancelButton->setCaption(wm->getGameSettingString("sCancel", "")); cancelButton->eventMouseButtonClick = MyGUI::newDelegate(this, &SelectAttributeDialog::onCancelClicked); }