本文整理汇总了C++中mygui::ButtonPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ButtonPtr类的具体用法?C++ ButtonPtr怎么用?C++ ButtonPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ButtonPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WindowBase
SelectSpecializationDialog::SelectSpecializationDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
: WindowBase("openmw_chargen_select_specialization_layout.xml", environment)
{
// Centre dialog
center();
WindowManager *wm = environment.mWindowManager;
setText("LabelT", wm->getGameSettingString("sSpecializationMenu1", ""));
getWidget(specialization0, "Specialization0");
getWidget(specialization1, "Specialization1");
getWidget(specialization2, "Specialization2");
specialization0->setCaption(wm->getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Combat], ""));
specialization0->eventMouseButtonClick = MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
specialization1->setCaption(wm->getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Magic], ""));
specialization1->eventMouseButtonClick = MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
specialization2->setCaption(wm->getGameSettingString(ESM::Class::gmstSpecializationIds[ESM::Class::Stealth], ""));
specialization2->eventMouseButtonClick = MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
specializationId = ESM::Class::Combat;
// 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, &SelectSpecializationDialog::onCancelClicked);
}
示例2: WindowModal
SelectSpecializationDialog::SelectSpecializationDialog(MWBase::WindowManager& parWindowManager)
: WindowModal("openmw_chargen_select_specialization.layout", parWindowManager)
{
// Centre dialog
center();
setText("LabelT", mWindowManager.getGameSettingString("sSpecializationMenu1", ""));
getWidget(mSpecialization0, "Specialization0");
getWidget(mSpecialization1, "Specialization1");
getWidget(mSpecialization2, "Specialization2");
std::string combat = mWindowManager.getGameSettingString(ESM::Class::sGmstSpecializationIds[ESM::Class::Combat], "");
std::string magic = mWindowManager.getGameSettingString(ESM::Class::sGmstSpecializationIds[ESM::Class::Magic], "");
std::string stealth = mWindowManager.getGameSettingString(ESM::Class::sGmstSpecializationIds[ESM::Class::Stealth], "");
mSpecialization0->setCaption(combat);
mSpecialization0->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
mSpecialization1->setCaption(magic);
mSpecialization1->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
mSpecialization2->setCaption(stealth);
mSpecialization2->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onSpecializationClicked);
mSpecializationId = ESM::Class::Combat;
ToolTips::createSpecializationToolTip(mSpecialization0, combat, ESM::Class::Combat);
ToolTips::createSpecializationToolTip(mSpecialization1, magic, ESM::Class::Magic);
ToolTips::createSpecializationToolTip(mSpecialization2, stealth, ESM::Class::Stealth);
MyGUI::ButtonPtr cancelButton;
getWidget(cancelButton, "CancelButton");
cancelButton->setCaption(mWindowManager.getGameSettingString("sCancel", ""));
cancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SelectSpecializationDialog::onCancelClicked);
}
示例3: WindowBase
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->setEnabled(false);
updateBirths();
updateSpells();
}
示例4: setButtons
void InfoBoxDialog::setButtons(ButtonList &buttons)
{
for (std::vector<MyGUI::ButtonPtr>::iterator it = this->mButtons.begin(); it != this->mButtons.end(); ++it)
{
MyGUI::Gui::getInstance().destroyWidget(*it);
}
this->mButtons.clear();
mCurrentButton = -1;
// TODO: The buttons should be generated from a template in the layout file, ie. cloning an existing widget
MyGUI::ButtonPtr button;
MyGUI::IntCoord coord = MyGUI::IntCoord(0, 0, mButtonBar->getWidth(), 10);
ButtonList::const_iterator end = buttons.end();
for (ButtonList::const_iterator it = buttons.begin(); it != end; ++it)
{
const std::string &text = *it;
button = mButtonBar->createWidget<MyGUI::Button>("MW_Button", coord, MyGUI::Align::Top | MyGUI::Align::HCenter, "");
button->getSubWidgetText()->setWordWrap(true);
button->setCaption(text);
fitToText(button);
button->eventMouseButtonClick += MyGUI::newDelegate(this, &InfoBoxDialog::onButtonClicked);
coord.top += button->getHeight();
this->mButtons.push_back(button);
}
}
示例5: WindowBase
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);
}
示例6: AddItem
void PanelObjectsList::AddItem(Ogre::UTFString name)
{
MyGUI::ButtonPtr checkbox = mWidgetClient->createWidget<MyGUI::Button>("CheckBox", MyGUI::IntCoord(WidthStep, CurrentHeight, Width, Height), MyGUI::Align::Left | MyGUI::Align::Top | MyGUI::Align::HStretch);
checkbox->setCaption(name);
checkbox->eventMouseButtonClick = MyGUI::newDelegate(this, &PanelObjectsList::mousePressed);
mItemsCheckBox.push_back(checkbox);
UpdateItemsView();
}
示例7: setNextButtonShow
void BirthDialog::setNextButtonShow(bool shown)
{
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
if (shown)
okButton->setCaption(mWindowManager.getGameSettingString("sNext", ""));
else
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
}
示例8: onSelectBirth
void BirthDialog::onSelectBirth(MyGUI::ListBox* _sender, size_t _index)
{
if (_index == MyGUI::ITEM_NONE)
return;
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
okButton->setEnabled(true);
const std::string *birthId = mBirthList->getItemDataAt<std::string>(_index);
if (boost::iequals(mCurrentBirthId, *birthId))
return;
mCurrentBirthId = *birthId;
updateSpells();
}
示例9: onSelectClass
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();
}
示例10: setClassId
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();
}
示例11: setBirthId
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->setEnabled(true);
break;
}
}
updateSpells();
}
示例12: WindowBase
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();
}
示例13: onSelectRace
void RaceDialog::onSelectRace(MyGUI::ListBox* _sender, size_t _index)
{
if (_index == MyGUI::ITEM_NONE)
return;
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
okButton->setEnabled(true);
const std::string *raceId = mRaceList->getItemDataAt<std::string>(_index);
if (boost::iequals(mCurrentRaceId, *raceId))
return;
mCurrentRaceId = *raceId;
recountParts();
updatePreview();
updateSkills();
updateSpellPowers();
}
示例14: setupGUI
void GraphicsImpl::setupGUI()
{
MyGUI::Gui * mGUI;
MyGUI::OgrePlatform* platform = new MyGUI::OgrePlatform();
platform->initialise(window, sceneMgr);
gui = new MyGUI::Gui();
gui->initialise();
mainGuiWidget = gui->createWidgetReal<MyGUI::Widget>("Default", 0.0, 0.0, 1.0, 1.0, MyGUI::Align::Default, "Main");
MyGUI::ButtonPtr button = mainGuiWidget->createWidgetReal<MyGUI::Button>("Button", 0.005, 0.008, 0.156, 0.05, MyGUI::Align::Default, "exit");
button->setCaption("exit");
// set callback
button->eventMouseButtonClick = MyGUI::newDelegate(this, &GraphicsImpl::guiCallback);
button = mainGuiWidget->createWidgetReal<MyGUI::Button>("Button", 0.182, 0.008, 0.156, 0.05, MyGUI::Align::Default, "do");
button->setCaption("do something");
// set callback
button->eventMouseButtonClick = MyGUI::newDelegate(this, &GraphicsImpl::guiCallback);
}
示例15: setRaceId
void RaceDialog::setRaceId(const std::string &raceId)
{
mCurrentRaceId = raceId;
mRaceList->setIndexSelected(MyGUI::ITEM_NONE);
size_t count = mRaceList->getItemCount();
for (size_t i = 0; i < count; ++i)
{
if (boost::iequals(*mRaceList->getItemDataAt<std::string>(i), raceId))
{
mRaceList->setIndexSelected(i);
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
okButton->setEnabled(true);
break;
}
}
updateSkills();
updateSpellPowers();
}