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


C++ ActionEvent::getSource方法代码示例

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


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

示例1: action

void PincodeListener::action(const ActionEvent &event)
{
    const EditDialog *const dialog = dynamic_cast<EditDialog*>(
        event.getSource());
    if (dialog)
    {
        const std::string pincode = dialog->getMsg();
        charServerHandler->setNewPincode(pincode);
    }
}
开发者ID:Action-Committee,项目名称:ManaPlus,代码行数:10,代码来源:pincodelistener.cpp

示例2: action

    void TabbedArea::action(const ActionEvent& actionEvent)
    {
        Widget* source = actionEvent.getSource();
        Tab* tab = dynamic_cast<Tab*>(source);

        if (tab == NULL)
        {
            throw GCN_EXCEPTION("Received an action from a widget that's not a tab!");
        }

        setSelectedTab(tab);
    }
开发者ID:bombpersons,项目名称:Dokuro2,代码行数:12,代码来源:tabbedarea.cpp

示例3: action

void ChangePincodeListener::action(const ActionEvent &event)
{
    if (event.getId() == "ok")
    {
        const PincodeDialog *const dialog = dynamic_cast<PincodeDialog*>(
            event.getSource());
        if (dialog != nullptr)
        {
            const std::string &pincode = dialog->getMsg();
            pincodeManager.changePincode(pincode);
        }
    }
    else
    {
        client->setState(State::SWITCH_LOGIN);
    }
}
开发者ID:mekolat,项目名称:ManaPlus,代码行数:17,代码来源:changepincodelistener.cpp

示例4: action

void Setup_Joystick::action(const ActionEvent &event)
{
    const Widget *const source = event.getSource();
    if (source == mJoystickEnabled)
    {
        setTempEnabled(mJoystickEnabled->isSelected());
    }
    else if (source == mNamesDropDown)
    {
        if (joystick != nullptr)
            joystick->setNumber(mNamesDropDown->getSelected());
    }
    else if (source == mDetectButton)
    {
        if (joystick != nullptr)
        {
            joystick->reload();
            Joystick::getNames(mNamesModel->getNames());
            mNamesDropDown->setSelected(joystick->getNumber());
        }
    }
    else
    {
        if (joystick == nullptr)
            return;

        if (joystick->isCalibrating())
        {
            // TRANSLATORS: joystick settings tab button
            mCalibrateButton->setCaption(_("Calibrate"));
            mCalibrateLabel->setCaption
                // TRANSLATORS: joystick settings tab label
                (_("Press the button to start calibration"));
            joystick->finishCalibration();
        }
        else
        {
            // TRANSLATORS: joystick settings tab button
            mCalibrateButton->setCaption(_("Stop"));
            mCalibrateLabel->setCaption(
                // TRANSLATORS: joystick settings tab label
                _("Rotate the stick and don't press buttons"));
            joystick->startCalibration();
        }
    }
}
开发者ID:mekolat,项目名称:ManaPlus,代码行数:46,代码来源:setup_joystick.cpp

示例5: action

void SocialWindow::action(const ActionEvent &event)
{
    const std::string &eventId = event.getId();

    if (event.getSource() == mPartyAcceptDialog)
    {
        if (eventId == "yes")
        {
            if (localChatTab)
            {
                localChatTab->chatLog(
                    // TRANSLATORS: chat message
                    strprintf(_("Accepted party invite from %s."),
                    mPartyInviter.c_str()),
                    ChatMsgType::BY_SERVER);
            }
            partyHandler->inviteResponse(mPartyInviter, mPartyId, true);
        }
        else if (eventId == "no")
        {
            if (localChatTab)
            {
                localChatTab->chatLog(
                    // TRANSLATORS: chat message
                    strprintf(_("Rejected party invite from %s."),
                    mPartyInviter.c_str()),
                    ChatMsgType::BY_SERVER);
            }
            partyHandler->inviteResponse(mPartyInviter, mPartyId, false);
        }

        mPartyInviter.clear();
        mPartyAcceptDialog = nullptr;
    }
    else if (event.getSource() == mGuildAcceptDialog)
    {
        if (eventId == "yes")
        {
            if (localChatTab)
            {
                localChatTab->chatLog(
                    // TRANSLATORS: chat message
                    strprintf(_("Accepted guild invite from %s."),
                    mPartyInviter.c_str()),
                    ChatMsgType::BY_SERVER);
            }
#ifdef TMWA_SUPPORT
            if (!guildManager || !GuildManager::getEnableGuildBot())
                guildHandler->inviteResponse(mGuildInvited, true);
            else
                guildManager->inviteResponse(true);
#else
            guildHandler->inviteResponse(mGuildInvited, true);
#endif
        }
        else if (eventId == "no")
        {
            if (localChatTab)
            {
                localChatTab->chatLog(
                    // TRANSLATORS: chat message
                    strprintf(_("Rejected guild invite from %s."),
                    mPartyInviter.c_str()),
                    ChatMsgType::BY_SERVER);
            }
#ifdef TMWA_SUPPORT
            if (!guildManager || !GuildManager::getEnableGuildBot())
                guildHandler->inviteResponse(mGuildInvited, false);
            else
                guildManager->inviteResponse(false);
#else
            guildHandler->inviteResponse(mGuildInvited, false);
#endif
        }

        mGuildInvited = 0;
        mGuildAcceptDialog = nullptr;
    }
    else if (eventId == "create")
    {
        showPartyCreate();
    }
    else if (eventId == "invite" && mTabs->getSelectedTabIndex() > -1)
    {
        if (mTabs->getSelectedTab())
            static_cast<SocialTab*>(mTabs->getSelectedTab())->invite();
    }
    else if (eventId == "leave" && mTabs->getSelectedTabIndex() > -1)
    {
        if (mTabs->getSelectedTab())
            static_cast<SocialTab*>(mTabs->getSelectedTab())->leave();
    }
    else if (eventId == "create guild")
    {
        if (!serverFeatures->haveNativeGuilds())
            return;

        std::string name = mGuildCreateDialog->getText();

        if (name.size() > 16)
//.........这里部分代码省略.........
开发者ID:qpulsar,项目名称:ManaPlus,代码行数:101,代码来源:socialwindow.cpp

示例6: action

void Setup_Input::action(const ActionEvent &event)
{
    const std::string &id = event.getId();
    const int selectedData = mKeyListModel->getSelectedData();

    if (event.getSource() == mKeyList)
    {
        if (!mKeySetting)
        {
            const int i(mKeyList->getSelected());
            if (i >= 0 && i < mActionDataSize[selectedData])
            {
                if (setupActionData[selectedData][i].actionId
                    == InputAction::NO_VALUE)
                {
                    mAssignKeyButton->setEnabled(false);
                    mUnassignKeyButton->setEnabled(false);
                }
                else
                {
                    mAssignKeyButton->setEnabled(true);
                    mUnassignKeyButton->setEnabled(true);
                }
            }
        }
    }
    else if (id == "assign")
    {
        mKeySetting = true;
        mAssignKeyButton->setEnabled(false);
        keyboard.setEnabled(false);
        const int i(mKeyList->getSelected());
        if (i >= 0 && i < mActionDataSize[selectedData])
        {
            const SetupActionData &key = setupActionData[selectedData][i];
            const InputActionT ik = key.actionId;
            inputManager.setNewKeyIndex(ik);
            mKeyListModel->setElementAt(i, std::string(
                gettext(key.name.c_str())).append(": ?"));
        }
    }
    else if (id == "unassign")
    {
        const int i(mKeyList->getSelected());
        if (i >= 0 && i < mActionDataSize[selectedData])
        {
            const SetupActionData &key = setupActionData[selectedData][i];
            const InputActionT ik = key.actionId;
            inputManager.setNewKeyIndex(ik);
            refreshAssignedKey(mKeyList->getSelected());
            inputManager.unassignKey();
            inputManager.setNewKeyIndex(InputAction::NO_VALUE);
        }
        mAssignKeyButton->setEnabled(true);
    }
    else if (id == "resetkeys")
    {
        inputManager.resetKeys();
        InputManager::update();
        refreshKeys();
    }
    else if (id == "default")
    {
        const int i(mKeyList->getSelected());
        if (i >= 0 && i < mActionDataSize[selectedData])
        {
            const SetupActionData &key = setupActionData[selectedData][i];
            const InputActionT ik = key.actionId;
            inputManager.makeDefault(ik);
            refreshKeys();
        }
    }
    else if (strStartWith(id, "tabs_"))
    {
        int k = 0;
        std::string str("tabs_");
        while (pages[k] != nullptr)
        {
            if (str + pages[k] == id)
                break;
            k ++;
        }
        if ((pages[k] != nullptr) && str + pages[k] == id)
        {
            mKeyListModel->setSelectedData(k);
            mKeyListModel->setSize(mActionDataSize[k]);
            refreshKeys();
            mKeyList->setSelected(0);
        }
    }
}
开发者ID:mekolat,项目名称:ManaPlus,代码行数:91,代码来源:setup_input.cpp


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