本文整理汇总了C++中ActionEvent::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionEvent::getId方法的具体用法?C++ ActionEvent::getId怎么用?C++ ActionEvent::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionEvent
的用法示例。
在下文中一共展示了ActionEvent::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sellAction
void NpcSellDialog::sellAction(const ActionEvent &event)
{
const std::string &eventId = event.getId();
const int selectedItem = mShopItemList->getSelected();
ShopItem *const item = mShopItems->at(selectedItem);
if (!item || PlayerInfo::isItemProtected(item->getId()))
return;
if (eventId == "presell")
{
if (mAmountItems <= 0 || mAmountItems > mMaxItems)
return;
const ItemInfo &info = ItemDB::get(item->getId());
if (info.isProtected())
{
ConfirmDialog *const dialog = CREATEWIDGETR(ConfirmDialog,
// TRANSLATORS: sell confirmation header
_("sell item"),
// TRANSLATORS: sell confirmation message
strprintf(_("Do you really want to sell %s?"),
info.getName().c_str()),
SOUND_REQUEST,
false,
Modal_true);
dialog->addActionListener(this);
return;
}
}
if (mAdvanced)
sellManyItems(event.getId());
else
sellOneItem();
}
示例2: action
void OutfitWindow::action(const ActionEvent &event)
{
const std::string &eventId = event.getId();
if (eventId == "next")
{
next();
}
else if (eventId == "previous")
{
previous();
}
else if (eventId == "unequip")
{
if (mCurrentOutfit >= 0 && mCurrentOutfit < static_cast<int>(
OUTFITS_COUNT))
{
mItemsUnequip[mCurrentOutfit] = mUnequipCheck->isSelected();
}
}
else if (eventId == "equip")
{
wearOutfit(mCurrentOutfit);
if (Game::instance())
Game::instance()->setValidSpeed();
}
else if (eventId == "away")
{
mAwayOutfit = mCurrentOutfit;
if (!mAwayOutfitCheck->isSelected())
mAwayOutfitCheck->setSelected(true);
}
}
示例3: action
void NpcPostDialog::action(const ActionEvent &event)
{
const std::string &eventId = event.getId();
if (eventId == "send")
{
if (mSender->getText().empty() || mText->getText().empty())
{
if (localChatTab)
{
// TRANSLATORS: npc post message error
localChatTab->chatLog(_("Failed to send as sender or letter "
"invalid."));
}
}
else
{
Net::getNpcHandler()->sendLetter(mNpcId, mSender->getText(),
mText->getText());
}
setVisible(false);
}
else if (eventId == "cancel")
{
setVisible(false);
}
}
示例4: action
void DidYouKnowWindow::action(const ActionEvent &event)
{
const std::string &eventId = event.getId();
if (eventId == "close")
{
setVisible(false);
}
else
{
const unsigned num = config.getIntValue("currentTip");
if (eventId == "prev")
{
loadData(num - 1);
}
else if (eventId == "next")
{
loadData(num + 1);
}
else if (eventId == "openagain")
{
config.setValue("showDidYouKnow",
mOpenAgainCheckBox->isSelected());
}
}
}
示例5: action
void RenameListener::action(const ActionEvent &event)
{
if (event.getId() == "ok" && viewport && mDialog)
{
const Map *const map = viewport->getMap();
if (!map)
return;
const SpecialLayer *const sl = map->getSpecialLayer();
MapItem *item = nullptr;
if (sl)
{
item = sl->getTile(mMapItemX, mMapItemY);
if (item)
item->setComment(mDialog->getText());
}
item = map->findPortalXY(mMapItemX, mMapItemY);
if (item)
item->setComment(mDialog->getText());
if (socialWindow)
socialWindow->updatePortalNames();
}
mDialog = nullptr;
}
示例6: action
void TextCommandEditor::action(const ActionEvent &event)
{
const std::string &eventId = event.getId();
if (eventId == "magic")
{
mIsMagicCommand = true;
showControls(Visible_true);
}
else if (eventId == "other")
{
mIsMagicCommand = false;
showControls(Visible_false);
}
else if (eventId == "save")
{
save();
scheduleDelete();
}
else if (eventId == "cancel")
{
scheduleDelete();
}
else if (eventId == "delete")
{
deleteCommand();
scheduleDelete();
}
}
示例7: action
void MailViewWindow::action(const ActionEvent &event)
{
const std::string &eventId = event.getId();
if (eventId == "close")
{
scheduleDelete();
}
else if (eventId == "attach")
{
if (mGetAttachButton)
mailHandler->getAttach(mMessage->id);
}
else if (eventId == "next")
{
if (mMessage)
mailWindow->viewNext(mMessage->id);
}
else if (eventId == "prev")
{
if (mMessage)
mailWindow->viewPrev(mMessage->id);
}
else if (eventId == "reply")
{
if (!mMessage)
return;
if (mailEditWindow)
mailEditWindow->scheduleDelete();
CREATEWIDGETV0(mailEditWindow, MailEditWindow);
mailEditWindow->setTo(mMessage->sender);
mailEditWindow->setSubject("Re:" + mMessage->title);
mailEditWindow->setMessage(">" + mMessage->text);
scheduleDelete();
}
}
示例8: action
void TextSelectDialog::action(const ActionEvent &event)
{
const std::string &eventId = event.getId();
if (eventId == "quit")
{
close();
return;
}
const int selectedItem = mItemList->getSelected();
// The following actions require a valid item selection
if (selectedItem == -1 ||
selectedItem >= mModel->getNumberOfElements())
{
return;
}
else if (eventId == "select")
{
const int index = mItemList->getSelected();
if (index < 0 || index >= CAST_S32(mModel->size()))
return;
mText = mModel->getElementAt(index);
distributeActionEvent();
close();
}
}
示例9: action
void KillStats::action(const ActionEvent &event)
{
const std::string &eventId = event.getId();
if (eventId == "reset")
{
mKillCounter = 0;
mExpCounter = 0;
mLine3->setCaption(strprintf("1%% = %d exp, avg mob for 1%%: %s",
PlayerInfo::getAttribute(Attributes::EXP_NEEDED) / 100, "?"));
// TRANSLATORS: kill stats window label
mLine4->setCaption(strprintf(_("Kills: %s, total exp: %s"), "?", "?"));
// TRANSLATORS: kill stats window label
mLine5->setCaption(strprintf(_("Avg Exp: %s"), "?"));
mLine6->setCaption(strprintf(
// TRANSLATORS: kill stats window label
_("No. of avg mob to next level: %s"), "?"));
resetTimes();
}
else if (eventId == "timer")
{
mKillTimer = 0;
mKillTCounter = 0;
mExpTCounter = 0;
mLine7->setCaption(strprintf(
// TRANSLATORS: kill stats window label
_("Kills/Min: %s, Exp/Min: %s"), "?", "?"));
resetTimes();
}
}
示例10: action
void BankWindow::action(const ActionEvent &event)
{
const std::string &eventId = event.getId();
if (eventId == "deposit")
bankHandler->deposit(mInputMoneyTextField->getValue());
else if (eventId == "withdraw")
bankHandler->withdraw(mInputMoneyTextField->getValue());
}
示例11: action
void SetupItem::action(const ActionEvent &event)
{
if (!mWidget)
return;
if (event.getId() == mWidget->getActionEventId())
action();
}
示例12: action
void ShopRenameListener::action(const ActionEvent &event)
{
if (event.getId() != "OK")
return;
if (mDialog != nullptr)
{
shopWindow->setShopName(mDialog->getMsg());
mDialog = nullptr;
}
}
示例13: action
void SkillDialog::action(const ActionEvent &event)
{
const std::string &eventId = event.getId();
if (eventId == "inc")
{
const SkillTab *const tab = static_cast<const SkillTab *const>(
mTabs->getSelectedTab());
if (tab)
{
if (const SkillInfo *const info = tab->getSelectedInfo())
playerHandler->increaseSkill(static_cast<uint16_t>(info->id));
}
}
else if (eventId == "sel")
{
const SkillTab *const tab = static_cast<const SkillTab *const>(
mTabs->getSelectedTab());
if (tab)
{
if (const SkillInfo *const info = tab->getSelectedInfo())
{
mUseButton->setEnabled(info->isUsable());
mUseButton->setCaption(info->useButton);
mIncreaseButton->setEnabled(info->id < SKILL_VAR_MIN_ID);
const int num = itemShortcutWindow->getTabIndex();
if (num >= 0 && num < static_cast<int>(SHORTCUT_TABS)
&& itemShortcut[num])
{
itemShortcut[num]->setItemSelected(
info->id + SKILL_MIN_ID);
}
}
else
{
mUseButton->setEnabled(false);
mIncreaseButton->setEnabled(false);
mUseButton->setCaption(_("Use"));
}
}
}
else if (eventId == "use")
{
const SkillTab *const tab = static_cast<const SkillTab *const>(
mTabs->getSelectedTab());
if (tab)
{
const SkillInfo *const info = tab->getSelectedInfo();
useSkill(info);
}
}
else if (eventId == "close")
{
setVisible(Visible_false);
}
}
示例14: action
void QuitDialog::action(const ActionEvent &event)
{
soundManager.playGuiSound(SOUND_HIDE_WINDOW);
if (event.getId() == "ok")
{
if (viewport)
{
const Map *const map = viewport->getMap();
if (map)
map->saveExtraLayer();
}
if (mForceQuit->isSelected())
{
client->setState(STATE_FORCE_QUIT);
}
else if (mLogoutQuit->isSelected())
{
DialogsManager::closeDialogs();
client->setState(STATE_EXIT);
}
else if (mRate && mRate->isSelected())
{
openBrowser("https://play.google.com/store/apps/details?"
"id=org.evolonline.beta.manaplus");
config.setValue("rated", true);
if (mNeedForceQuit)
{
client->setState(STATE_FORCE_QUIT);
}
else
{
DialogsManager::closeDialogs();
client->setState(STATE_EXIT);
}
}
else if (Net::getGameHandler()->isConnected()
&& mSwitchAccountServer->isSelected())
{
DialogsManager::closeDialogs();
client->setState(STATE_SWITCH_SERVER);
}
else if (mSwitchCharacter->isSelected())
{
if (client->getState() == STATE_GAME)
{
Net::getCharServerHandler()->switchCharacter();
DialogsManager::closeDialogs();
serverConfig.write();
}
}
}
scheduleDelete();
}
示例15: action
void AwayListener::action(const ActionEvent &event)
{
if (event.getId() == "ok" && modifiers && player_node && settings.awayMode)
{
modifiers->changeAwayMode();
player_node->updateStatus();
if (outfitWindow)
outfitWindow->unwearAwayOutfit();
UpdateStatusListener::distributeEvent();
}
}