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


C++ WeakReference::wasObjectDeleted方法代码示例

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


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

示例1: useTimeslice

    bool useTimeslice (const int elapsed)
    {
        if (auto* c = proxy != nullptr ? static_cast<Component*> (proxy)
                                       : static_cast<Component*> (component))
        {
            msElapsed += elapsed;
            double newProgress = msElapsed / (double) msTotal;

            if (newProgress >= 0 && newProgress < 1.0)
            {
                const WeakReference<AnimationTask> weakRef (this);
                newProgress = timeToDistance (newProgress);
                const double delta = (newProgress - lastProgress) / (1.0 - lastProgress);
                jassert (newProgress >= lastProgress);
                lastProgress = newProgress;

                if (delta < 1.0)
                {
                    bool stillBusy = false;

                    if (isMoving)
                    {
                        left   += (destination.getX()      - left)   * delta;
                        top    += (destination.getY()      - top)    * delta;
                        right  += (destination.getRight()  - right)  * delta;
                        bottom += (destination.getBottom() - bottom) * delta;

                        const Rectangle<int> newBounds (roundToInt (left),
                                                        roundToInt (top),
                                                        roundToInt (right - left),
                                                        roundToInt (bottom - top));

                        if (newBounds != destination)
                        {
                            c->setBounds (newBounds);
                            stillBusy = true;
                        }
                    }

                    // Check whether the animation was cancelled/deleted during
                    // a callback during the setBounds method
                    if (weakRef.wasObjectDeleted())
                        return false;

                    if (isChangingAlpha)
                    {
                        alpha += (destAlpha - alpha) * delta;
                        c->setAlpha ((float) alpha);
                        stillBusy = true;
                    }

                    if (stillBusy)
                        return true;
                }
            }
        }

        moveToFinalDestination();
        return false;
    }
开发者ID:Neknail,项目名称:JUCE,代码行数:60,代码来源:juce_ComponentAnimator.cpp

示例2: moveToFinalDestination

    void moveToFinalDestination()
    {
        if (component != nullptr)
        {
            const WeakReference<AnimationTask> weakRef (this);
            component->setAlpha ((float) destAlpha);
            component->setBounds (destination);

            if (! weakRef.wasObjectDeleted())
                if (proxy != nullptr)
                    component->setVisible (destAlpha > 0);
        }
    }
开发者ID:Neknail,项目名称:JUCE,代码行数:13,代码来源:juce_ComponentAnimator.cpp

示例3: getValueFromScript

var Parameter::getValueFromScript(const juce::var::NativeFunctionArgs & a)
{
	WeakReference<Parameter> c = getObjectFromJS<Parameter>(a);
	if (c == nullptr || c.wasObjectDeleted()) return var();
	return c->getValue();
}
开发者ID:haskellstudio,项目名称:juce_organicui,代码行数:6,代码来源:Parameter.cpp


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