本文整理汇总了C++中mygui::ButtonPtr::setEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ ButtonPtr::setEnabled方法的具体用法?C++ ButtonPtr::setEnabled怎么用?C++ ButtonPtr::setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mygui::ButtonPtr
的用法示例。
在下文中一共展示了ButtonPtr::setEnabled方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: onSelectClass
void PickClassDialog::onSelectClass(MyGUI::ListBox* _sender, size_t _index)
{
if (_index == MyGUI::ITEM_NONE)
return;
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
okButton->setEnabled(true);
const std::string *classId = mClassList->getItemDataAt<std::string>(_index);
if (boost::iequals(mCurrentClassId, *classId))
return;
mCurrentClassId = *classId;
updateStats();
}
示例4: 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();
}
示例5: 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->setEnabled(true);
break;
}
}
updateStats();
}
示例6: 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->setEnabled(false);
updateClasses();
updateStats();
}
示例7: 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();
}
示例8: 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();
}
示例9: init
//-------------------------------------------------------------------------------
void MainMenu::init()
{
int winHeight = GlbVar.ogreWindow->getHeight();
int winWidth = GlbVar.ogreWindow->getWidth();
GlbVar.fader->abortFade(0);
//Gotta see where we click. :-)
GlbVar.gui->setVisiblePointer(true);
//Background, logo.
mBackground = GlbVar.gui->createWidget<MyGUI::StaticImage>("StaticImage", MyGUI::IntCoord(0,0,winWidth,winHeight), MyGUI::Align::Default, "Back");
mBackground->setImageTexture("MainMenuBgr.png");
int logoX = winWidth - (LOGO_WIDTH + 5);
int logoY = winHeight - (LOGO_HEIGHT + 5);
mLogo = GlbVar.gui->createWidget<MyGUI::StaticImage>("StaticImage", MyGUI::IntCoord(logoX, logoY, LOGO_WIDTH, LOGO_HEIGHT), MyGUI::Align::Default, "Back");
mLogo->setImageTexture("MainMenuLogo.png");
//Get the Window.
MyGUI::LayoutManager::getInstance().load("MainMenu.layout");
mWindow = GlbVar.gui->findWidget<MyGUI::Window>("win_mainMenu");
//Buttons, events.
MyGUI::ButtonPtr button;
button = GlbVar.gui->findWidget<MyGUI::Button>("but_newGame");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MainMenu::onClickNewGame);
button = GlbVar.gui->findWidget<MyGUI::Button>("but_continueGame");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MainMenu::onClickContinueGame);
if (GlbVar.records.firstTime)
button->setEnabled(false);
button = GlbVar.gui->findWidget<MyGUI::Button>("but_levelSelect");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MainMenu::onClickLevelSelect);
if (GlbVar.records.firstTime)
button->setEnabled(false);
button = GlbVar.gui->findWidget<MyGUI::Button>("but_userLevel");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MainMenu::onClickUserLevel);
if (GlbVar.userNgfNames.empty())
button->setEnabled(false);
button = GlbVar.gui->findWidget<MyGUI::Button>("but_options");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MainMenu::onClickOptions);
button = GlbVar.gui->findWidget<MyGUI::Button>("but_credits");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MainMenu::onClickCredits);
button = GlbVar.gui->findWidget<MyGUI::Button>("but_quit");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MainMenu::onClickQuit);
//Window properties.
//Children don't inherit alpha.
MyGUI::EnumeratorWidgetPtr iter = mWindow->getEnumerator();
while (iter.next())
{
iter.current()->setInheritsAlpha(false);
}
mWindow->setAlpha(0);
mWindow->setPosition(30,5);
//Create child interfaces.
//Level select.
mLevelSelect = new LevelSelect();
//Credits.
MyGUI::LayoutManager::getInstance().load("Credits.layout");
mCreditsWindow = GlbVar.gui->findWidget<MyGUI::Window>("win_credits");
mCreditsWindow->setVisible(false);
int height = mCreditsWindow->getHeight();
int width = mCreditsWindow->getWidth();
mCreditsWindow->setCoord(MyGUI::IntCoord((winWidth - width)*0.5, (winHeight - height)*0.5, width, height));
button = GlbVar.gui->findWidget<MyGUI::Button>("but_cr_ok");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MainMenu::onClickCloseCredits);
MyGUI::EditPtr credits = GlbVar.gui->findWidget<MyGUI::Edit>("edt_cr_credits");
credits->setOnlyText(creditsStr);
credits->setTextAlign(MyGUI::Align::Left | MyGUI::Align::Top);
//User level.
MyGUI::LayoutManager::getInstance().load("LoadUserLevel.layout");
mUserLevelWindow = GlbVar.gui->findWidget<MyGUI::Window>("win_userLevel");
height = mUserLevelWindow->getHeight();
width = mUserLevelWindow->getWidth();
mUserLevelWindow->setCoord(MyGUI::IntCoord((winWidth - width)*0.5, (winHeight - height)*0.5, width, height));
mUserLevelWindow->setVisible(false);
//Tell the buttons to tell us.
button = GlbVar.gui->findWidget<MyGUI::Button>("but_loadUserLevel");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MainMenu::onClickLoadUserLevel);
button = GlbVar.gui->findWidget<MyGUI::Button>("but_cancelUserLevel");
button->eventMouseButtonClick = MyGUI::newDelegate(this, &MainMenu::onClickCancelUserLevel);
//Populate the user level list.
//.........这里部分代码省略.........
示例10: WindowBase
RaceDialog::RaceDialog(MWBase::WindowManager& parWindowManager)
: WindowBase("openmw_chargen_race.layout", parWindowManager)
, mGenderIndex(0)
, mFaceIndex(0)
, mHairIndex(0)
, mFaceCount(10)
, mHairCount(14)
, mCurrentAngle(0)
{
// Centre dialog
center();
setText("AppearanceT", mWindowManager.getGameSettingString("sRaceMenu1", "Appearance"));
getWidget(mPreviewImage, "PreviewImage");
getWidget(mHeadRotate, "HeadRotate");
mHeadRotate->setScrollRange(50);
mHeadRotate->setScrollPosition(25);
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);
okButton->setEnabled(false);
updateRaces();
updateSkills();
updateSpellPowers();
}