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


C++ Widget::Intersects方法代码示例

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


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

示例1: MarkDirty

void WidgetContainer::MarkDirty(WidgetContainer* theWidget)
{
    if (theWidget->mDirty)
        return;

    // Only mark things dirty that are on top of this widget
    // Mark ourselves dirty
    MarkDirty();

    theWidget->mDirty = true;

    // Top-level windows are treated differently, as marking a child dirty always
    //  causes a parent redraw which always causes all children to redraw
    if (mParent != NULL)
        return;

    if (theWidget->mHasAlpha)
        MarkDirtyFull(theWidget);
    else
    {
        bool found = false;
        WidgetList::iterator anItr = mWidgets.begin();
        while (anItr != mWidgets.end())
        {
            Widget* aWidget = *anItr;
            if (aWidget == theWidget)
                found = true;
            else if (found)
            {
                if ((aWidget->mVisible) && (aWidget->Intersects(theWidget)))
                    MarkDirty(aWidget);
            }

            ++anItr;
        }
    }
}
开发者ID:keestux,项目名称:tuxcap,代码行数:37,代码来源:WidgetContainer.cpp

示例2: MarkDirtyFull

void WidgetContainer::MarkDirtyFull(WidgetContainer* theWidget)
{
    // Mark all things dirty that are under or over this widget

    // Mark ourselves dirty
    MarkDirtyFull();

    theWidget->mDirty = true;

    // Top-level windows are treated differently, as marking a child dirty always
    //  causes a parent redraw which always causes all children to redraw
    if (mParent != NULL)
        return;

    WidgetList::iterator aFoundWidgetItr = std::find(mWidgets.begin(), mWidgets.end(), theWidget);
    if (aFoundWidgetItr == mWidgets.end())
        return;

    WidgetList::iterator anItr = aFoundWidgetItr;
    if (anItr != mWidgets.begin())
    {
        anItr--;

        for (;;)
        {
            Widget* aWidget = *anItr;

            if (aWidget->mVisible)
            {
                if ((!aWidget->mHasTransparencies) && (!aWidget->mHasAlpha))
                {
                    // Clip the widget's bounds to the screen and check if it fully overlapped by this non-transparent widget underneath it
                    // If it is fully overlapped then we can stop marking dirty underneath it since it's not transparent.
                    Rect aRect = Rect(theWidget->mX,theWidget->mY,theWidget->mWidth,theWidget->mHeight).Intersection(Rect(0,0,mWidth,mHeight));
                    if ((aWidget->Contains(aRect.mX, aRect.mY) &&
                        (aWidget->Contains(aRect.mX + aRect.mWidth - 1, aRect.mY + aRect.mHeight - 1))))
                    {
                        // If this widget is fully contained within a lower widget, there is no need to dig down
                        // any deeper.
                        aWidget->MarkDirty();
                        break;
                    }
                }

                if (aWidget->Intersects(theWidget))
                    MarkDirty(aWidget);
            }

            if (anItr == mWidgets.begin())
                break;

            --anItr;
        }
    }

    anItr = aFoundWidgetItr;
    while (anItr != mWidgets.end())
    {
        Widget* aWidget = *anItr;
        if ((aWidget->mVisible) && (aWidget->Intersects(theWidget)))
            MarkDirty(aWidget);

        ++anItr;
    }
}
开发者ID:keestux,项目名称:tuxcap,代码行数:65,代码来源:WidgetContainer.cpp


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