当前位置: 首页>>代码示例>>C++>>正文


C++ ConfirmationDialog::open方法代码示例

本文整理汇总了C++中ConfirmationDialog::open方法的典型用法代码示例。如果您正苦于以下问题:C++ ConfirmationDialog::open方法的具体用法?C++ ConfirmationDialog::open怎么用?C++ ConfirmationDialog::open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConfirmationDialog的用法示例。


在下文中一共展示了ConfirmationDialog::open方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onButtonClicked

    void MainMenu::onButtonClicked(MyGUI::Widget *sender)
    {
        std::string name = *sender->getUserData<std::string>();
        MWBase::Environment::get().getSoundManager()->playSound("Menu Click", 1.f, 1.f);
        if (name == "return")
        {
            MWBase::Environment::get().getSoundManager ()->resumeSounds (MWBase::SoundManager::Play_TypeSfx);
            MWBase::Environment::get().getWindowManager ()->removeGuiMode (GM_MainMenu);
        }
        else if (name == "options")
            MWBase::Environment::get().getWindowManager ()->pushGuiMode (GM_Settings);
        else if (name == "credits")
            MWBase::Environment::get().getWindowManager()->playVideo("mw_credits.bik", true);
        else if (name == "exitgame")
        {
            if (MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame)
                onExitConfirmed();
            else
            {
                ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
                dialog->open("#{sMessage2}");
                dialog->eventOkClicked.clear();
                dialog->eventOkClicked += MyGUI::newDelegate(this, &MainMenu::onExitConfirmed);
                dialog->eventCancelClicked.clear();
            }
        }
        else if (name == "newgame")
        {
            if (MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame)
                onNewGameConfirmed();
            else
            {
                ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
                dialog->open("#{sNotifyMessage54}");
                dialog->eventOkClicked.clear();
                dialog->eventOkClicked += MyGUI::newDelegate(this, &MainMenu::onNewGameConfirmed);
                dialog->eventCancelClicked.clear();
            }
        }

        else
        {
            if (!mSaveGameDialog)
                mSaveGameDialog = new SaveGameDialog();
            if (name == "loadgame")
                mSaveGameDialog->setLoadOrSave(true);
            else if (name == "savegame")
                mSaveGameDialog->setLoadOrSave(false);
            mSaveGameDialog->setVisible(true);
        }
    }
开发者ID:ViteFalcon,项目名称:openmw,代码行数:51,代码来源:mainmenu.cpp

示例2: confirmDeleteSave

 void SaveGameDialog::confirmDeleteSave()
 {
     ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
     dialog->open("#{sMessage3}");
     dialog->eventOkClicked.clear();
     dialog->eventOkClicked += MyGUI::newDelegate(this, &SaveGameDialog::onDeleteSlotConfirmed);
     dialog->eventCancelClicked.clear();
 }
开发者ID:Allxere,项目名称:openmw,代码行数:8,代码来源:savegamedialog.cpp

示例3: onSlotMouseClick

void SaveGameDialog::onSlotMouseClick(MyGUI::ListBox* sender, size_t pos)
{
    onSlotSelected(sender, pos);

    if (pos != MyGUI::ITEM_NONE && MyGUI::InputManager::getInstance().isShiftPressed())
    {
        ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
        dialog->open("#{sMessage3}");
        dialog->eventOkClicked.clear();
        dialog->eventOkClicked += MyGUI::newDelegate(this, &SaveGameDialog::onDeleteSlotConfirmed);
        dialog->eventCancelClicked.clear();
    }
}
开发者ID:0xmono,项目名称:openmw,代码行数:13,代码来源:savegamedialog.cpp

示例4: onSpellSelected

    void SpellWindow::onSpellSelected(MyGUI::Widget* _sender)
    {
        std::string spellId = _sender->getUserString("Spell");
        MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
        MWMechanics::CreatureStats& stats = MWWorld::Class::get(player).getCreatureStats(player);
        MWWorld::InventoryStore& store = MWWorld::Class::get(player).getInventoryStore(player);
        MWMechanics::Spells& spells = stats.getSpells();

        if (MyGUI::InputManager::getInstance().isShiftPressed())
        {
            // delete spell, if allowed
            const ESM::Spell* spell =
                MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);

            if (spell->mData.mFlags & ESM::Spell::F_Always
                || spell->mData.mType == ESM::Spell::ST_Power)
            {
                MWBase::Environment::get().getWindowManager()->messageBox("#{sDeleteSpellError}");
            }
            else
            {
                // ask for confirmation
                mSpellToDelete = spellId;
                ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
                std::string question = MWBase::Environment::get().getWindowManager()->getGameSettingString("sQuestionDeleteSpell", "Delete %s?");
                question = boost::str(boost::format(question) % spell->mName);
                dialog->open(question);
                dialog->eventOkClicked.clear();
                dialog->eventOkClicked += MyGUI::newDelegate(this, &SpellWindow::onDeleteSpellAccept);
                dialog->eventCancelClicked.clear();
            }
        }
        else
        {
            spells.setSelectedSpell(spellId);
            store.setSelectedEnchantItem(store.end());
            MWBase::Environment::get().getWindowManager()->setSelectedSpell(spellId, int(MWMechanics::getSpellSuccessChance(spellId, player)));
        }

        updateSpells();
    }
开发者ID:JanneVirkkunen,项目名称:openmw,代码行数:41,代码来源:spellwindow.cpp

示例5: accept

void SaveGameDialog::accept(bool reallySure)
{
    MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(NULL);

    if (mSaving)
    {
        // If overwriting an existing slot, ask for confirmation first
        if (mCurrentSlot != NULL && !reallySure)
        {
            ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
            dialog->open("#{sMessage4}");
            dialog->eventOkClicked.clear();
            dialog->eventOkClicked += MyGUI::newDelegate(this, &SaveGameDialog::onConfirmationGiven);
            dialog->eventCancelClicked.clear();
            return;
        }
        if (mSaveNameEdit->getCaption().empty())
        {
            MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage65}");
            return;
        }
    }

    setVisible(false);
    MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_MainMenu);

    if (mSaving)
    {
        MWBase::Environment::get().getStateManager()->saveGame (mSaveNameEdit->getCaption(), mCurrentSlot);
    }
    else
    {
        if (mCurrentCharacter && mCurrentSlot)
        {
            MWBase::Environment::get().getStateManager()->loadGame (mCurrentCharacter, mCurrentSlot);
        }
    }
}
开发者ID:0xmono,项目名称:openmw,代码行数:38,代码来源:savegamedialog.cpp


注:本文中的ConfirmationDialog::open方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。