本文整理汇总了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;
}
}
}
示例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;
}
}