本文整理汇总了C++中mygui::ButtonPtr::setCaption方法的典型用法代码示例。如果您正苦于以下问题:C++ ButtonPtr::setCaption方法的具体用法?C++ ButtonPtr::setCaption怎么用?C++ ButtonPtr::setCaption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mygui::ButtonPtr
的用法示例。
在下文中一共展示了ButtonPtr::setCaption方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setNextButtonShow
void CreateClassDialog::setNextButtonShow(bool shown)
{
MyGUI::ButtonPtr descriptionButton;
getWidget(descriptionButton, "DescriptionButton");
MyGUI::ButtonPtr backButton;
getWidget(backButton, "BackButton");
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
// TODO: All hardcoded coords for buttons are temporary, will be replaced with a dynamic system.
if (shown)
{
okButton->setCaption("Next");
// Adjust back button when next is shown
descriptionButton->setCoord(MyGUI::IntCoord(207 - 18, 158, 143, 23));
backButton->setCoord(MyGUI::IntCoord(356 - 18, 158, 53, 23));
okButton->setCoord(MyGUI::IntCoord(417 - 18, 158, 42 + 18, 23));
}
else
{
okButton->setCaption("OK");
descriptionButton->setCoord(MyGUI::IntCoord(207, 158, 143, 23));
backButton->setCoord(MyGUI::IntCoord(356, 158, 53, 23));
okButton->setCoord(MyGUI::IntCoord(417, 158, 42, 23));
}
}
示例2: 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", ""));
}
示例3: 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);
}
示例4: WindowBase
GenerateClassResultDialog::GenerateClassResultDialog(WindowManager& parWindowManager)
: WindowBase("openmw_chargen_generate_class_result.layout", parWindowManager)
{
// Centre dialog
center();
setText("ReflectT", mWindowManager.getGameSettingString("sMessageQuestionAnswer1", ""));
getWidget(mClassImage, "ClassImage");
getWidget(mClassName, "ClassName");
MyGUI::ButtonPtr backButton;
getWidget(backButton, "BackButton");
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GenerateClassResultDialog::onBackClicked);
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GenerateClassResultDialog::onOkClicked);
int okButtonWidth = okButton->getTextSize().width + 24;
int backButtonWidth = backButton->getTextSize().width + 24;
okButton->setCoord(315 - okButtonWidth, 219, okButtonWidth, 23);
backButton->setCoord(315 - okButtonWidth - backButtonWidth - 6, 219, backButtonWidth, 23);
}
示例5: 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);
}
}
示例6: WindowBase
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);
}
示例7: 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();
}
示例8: 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();
}
示例9: setNextButtonShow
void PickClassDialog::setNextButtonShow(bool shown)
{
MyGUI::ButtonPtr backButton;
getWidget(backButton, "BackButton");
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
if (shown)
okButton->setCaption(mWindowManager.getGameSettingString("sNext", ""));
else
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
int okButtonWidth = okButton->getTextSize().width + 24;
int backButtonWidth = backButton->getTextSize().width + 24;
okButton->setCoord(476 - okButtonWidth, 265, okButtonWidth, 23);
backButton->setCoord(476 - okButtonWidth - backButtonWidth - 6, 265, backButtonWidth, 23);
}
示例10: 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);
}
示例11: WindowBase
RaceDialog::RaceDialog(MWBase::WindowManager& parWindowManager)
: WindowBase("openmw_chargen_race.layout", parWindowManager)
, mGenderIndex(0)
, mFaceIndex(0)
, mHairIndex(0)
, mFaceCount(10)
, mHairCount(14)
{
// Centre dialog
center();
// These are just demo values, you should replace these with
// real calls from outside the class later.
setText("AppearanceT", mWindowManager.getGameSettingString("sRaceMenu1", "Appearance"));
getWidget(mAppearanceBox, "AppearanceBox");
getWidget(mHeadRotate, "HeadRotate");
mHeadRotate->setScrollRange(50);
mHeadRotate->setScrollPosition(20);
mHeadRotate->setScrollViewPage(10);
mHeadRotate->eventScrollChangePosition += MyGUI::newDelegate(this, &RaceDialog::onHeadRotate);
// Set up next/previous buttons
MyGUI::ButtonPtr prevButton, nextButton;
setText("GenderChoiceT", mWindowManager.getGameSettingString("sRaceMenu2", "Change Sex"));
getWidget(prevButton, "PrevGenderButton");
getWidget(nextButton, "NextGenderButton");
prevButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousGender);
nextButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectNextGender);
setText("FaceChoiceT", mWindowManager.getGameSettingString("sRaceMenu3", "Change Face"));
getWidget(prevButton, "PrevFaceButton");
getWidget(nextButton, "NextFaceButton");
prevButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousFace);
nextButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectNextFace);
setText("HairChoiceT", mWindowManager.getGameSettingString("sRaceMenu4", "Change Hair"));
getWidget(prevButton, "PrevHairButton");
getWidget(nextButton, "NextHairButton");
prevButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousHair);
nextButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectNextHair);
setText("RaceT", mWindowManager.getGameSettingString("sRaceMenu4", "Race"));
getWidget(mRaceList, "RaceList");
mRaceList->setScrollVisible(true);
mRaceList->eventListSelectAccept += MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
mRaceList->eventListMouseItemActivate += MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
mRaceList->eventListChangePosition += MyGUI::newDelegate(this, &RaceDialog::onSelectRace);
setText("SkillsT", mWindowManager.getGameSettingString("sBonusSkillTitle", "Skill Bonus"));
getWidget(mSkillList, "SkillList");
setText("SpellPowerT", mWindowManager.getGameSettingString("sRaceMenu7", "Specials"));
getWidget(mSpellPowerList, "SpellPowerList");
MyGUI::ButtonPtr backButton;
getWidget(backButton, "BackButton");
backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onBackClicked);
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
okButton->setCaption(mWindowManager.getGameSettingString("sOK", ""));
okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onOkClicked);
updateRaces();
updateSkills();
updateSpellPowers();
}
示例12: dummyCoord
InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons)
: Layout("openmw_interactive_messagebox_layout.xml")
, mMessageBoxManager(parMessageBoxManager)
, mButtonPressed(-1)
{
int fixedWidth = 500;
int textPadding = 10; // padding between text-widget and main-widget
int textButtonPadding = 20; // padding between the text-widget und the button-widget
int buttonLeftPadding = 10; // padding between the buttons if horizontal
int buttonTopPadding = 5; // ^-- if vertical
int buttonPadding = 5; // padding between button label and button itself
int buttonMainPadding = 10; // padding between buttons and bottom of the main widget
mMarkedToDelete = false;
getWidget(mMessageWidget, "message");
getWidget(mButtonsWidget, "buttons");
mMessageWidget->setOverflowToTheLeft(true);
mMessageWidget->addText(message);
MyGUI::IntSize textSize = mMessageWidget->_getTextSize();
MyGUI::IntSize gameWindowSize = mMessageBoxManager.mWindowManager->getGui()->getViewSize();
int biggestButtonWidth = 0;
int buttonWidth = 0;
int buttonsWidth = 0;
int buttonHeight = 0;
MyGUI::IntCoord dummyCoord(0, 0, 0, 0);
std::vector<std::string>::const_iterator it;
for(it = buttons.begin(); it != buttons.end(); ++it)
{
MyGUI::ButtonPtr button = mButtonsWidget->createWidget<MyGUI::Button>(
MyGUI::WidgetStyle::Child,
std::string("MW_Button"),
dummyCoord,
MyGUI::Align::Default);
button->setCaption(*it);
button->eventMouseButtonClick = MyGUI::newDelegate(this, &InteractiveMessageBox::mousePressed);
mButtons.push_back(button);
buttonWidth = button->_getTextSize().width + 2*buttonPadding + buttonLeftPadding;
buttonsWidth += buttonWidth;
buttonHeight = button->_getTextSize().height + 2*buttonPadding + buttonTopPadding;
if(buttonWidth > biggestButtonWidth)
{
biggestButtonWidth = buttonWidth;
}
}
buttonsWidth += buttonLeftPadding;
MyGUI::IntSize mainWidgetSize;
if(buttonsWidth < fixedWidth)
{
// on one line
std::cout << "on one line" << std::endl;
if(textSize.width + 2*textPadding < buttonsWidth)
{
std::cout << "width = buttonsWidth" << std::endl;
mainWidgetSize.width = buttonsWidth;
}
else
{
mainWidgetSize.width = textSize.width + 3*textPadding;
}
mainWidgetSize.height = textSize.height + textButtonPadding + buttonHeight + buttonMainPadding;
MyGUI::IntCoord absCoord;
absCoord.left = (gameWindowSize.width - mainWidgetSize.width)/2;
absCoord.top = (gameWindowSize.height - mainWidgetSize.height)/2;
std::cout << "width " << mainWidgetSize.width << " height " << mainWidgetSize.height << std::endl;
std::cout << "left " << absCoord.left << " top " << absCoord.top << std::endl;
mMainWidget->setCoord(absCoord);
mMainWidget->setSize(mainWidgetSize);
MyGUI::IntCoord messageWidgetCoord;
messageWidgetCoord.left = (mainWidgetSize.width - textSize.width)/2;
messageWidgetCoord.top = textPadding;
mMessageWidget->setCoord(messageWidgetCoord);
mMessageWidget->setSize(textSize);
MyGUI::IntCoord buttonCord;
MyGUI::IntSize buttonSize(0, buttonHeight);
int left = (mainWidgetSize.width - buttonsWidth)/2 + buttonPadding;
std::vector<MyGUI::ButtonPtr>::const_iterator button;
for(button = mButtons.begin(); button != mButtons.end(); ++button)
{
buttonCord.left = left;
//.........这里部分代码省略.........