本文整理汇总了C++中MgCommand::cancel方法的典型用法代码示例。如果您正苦于以下问题:C++ MgCommand::cancel方法的具体用法?C++ MgCommand::cancel怎么用?C++ MgCommand::cancel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MgCommand
的用法示例。
在下文中一共展示了MgCommand::cancel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gestureToCommand
bool GiCoreViewImpl::gestureToCommand(const MgMotion& motion)
{
MgDynShapeLock locker(true, motion.view);
MgCommand* cmd = _cmds->getCommand();
bool ret = false;
if (motion.gestureState == kMgGestureCancel || !cmd) {
return cmd && cmd->cancel(&motion);
}
if (motion.gestureState == kMgGesturePossible
&& motion.gestureType != kGiTwoFingersMove) {
return true;
}
switch (motion.gestureType)
{
case kGiTwoFingersMove:
ret = cmd->twoFingersMove(&motion);
break;
case kGiGesturePan:
switch (motion.gestureState)
{
case kMgGestureBegan:
ret = cmd->touchBegan(&motion);
break;
case kMgGestureMoved:
ret = cmd->touchMoved(&motion);
break;
case kMgGestureEnded:
default:
ret = cmd->touchEnded(&motion);
break;
}
break;
case kGiGestureTap:
ret = cmd->click(&motion);
break;
case kGiGestureDblTap:
ret = cmd->doubleClick(&motion);
break;
case kGiGesturePress:
ret = cmd->longPress(&motion);
break;
}
if (!ret) {
LOGD("The current command (%s) don't support #%d gesture (state=%d)",
cmd->getName(), motion.gestureType, motion.gestureState);
}
return ret;
}
示例2: loadShapes
bool GiCoreView::loadShapes(MgStorage* s)
{
bool ret = true;
impl->setCommand(&impl->motion, impl->getCommandName());
MgCommand* cmd = impl->getCommand();
if (cmd) cmd->cancel(&impl->motion);
if (s) {
MgShapesLock locker(MgShapesLock::Load, impl);
ret = impl->doc()->load(impl->getShapeFactory(), s);
LOGD("Load %d shapes", impl->doc()->getShapeCount());
}
else {
MgShapesLock locker(MgShapesLock::Remove, impl);
impl->doc()->clear();
}
impl->regenAll();
impl->getCmdSubject()->onDocLoaded(&impl->motion);
return ret;
}