本文整理汇总了C++中JRect::Contains方法的典型用法代码示例。如果您正苦于以下问题:C++ JRect::Contains方法的具体用法?C++ JRect::Contains怎么用?C++ JRect::Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JRect
的用法示例。
在下文中一共展示了JRect::Contains方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ScrollToRect
JBoolean
JXWidget::ScrollToRectCentered
(
const JRect& origRect,
const JBoolean forceScroll
)
{
const JRect ap = GetAperture();
if (!forceScroll && ap.Contains(origRect))
{
return kJFalse;
}
JRect r = origRect;
const JCoordinate dw = ap.width() - r.width();
if (dw > 0)
{
r.Shrink(-dw/2, 0);
}
const JCoordinate dh = ap.height() - r.height();
if (dh > 0)
{
r.Shrink(0, -dh/2);
}
return ScrollToRect(r);
}
示例2:
JBoolean
GetEnclosure
(
const JArray<JRect>& rectList,
const JIndex rectIndex,
JIndex* enclIndex
)
{
const JRect theRect = rectList.GetElement(rectIndex);
JBoolean found = kJFalse;
*enclIndex = 0;
JSize minArea = 0;
const JSize count = rectList.GetElementCount();
for (JIndex i=1; i<=count; i++)
{
if (i != rectIndex)
{
const JRect r = rectList.GetElement(i);
const JSize a = r.area();
if (r.Contains(theRect) && (a < minArea || minArea == 0))
{
minArea = a;
found = kJTrue;
*enclIndex = i;
}
}
}
return found;
}
示例3: if
void
JXCheckbox::HandleMouseDrag
(
const JPoint& pt,
const JXButtonStates& buttonStates,
const JXKeyModifiers& modifiers
)
{
if (buttonStates.left())
{
const JRect frame = JXContainer::GlobalToLocal(GetFrameGlobal());
const JBoolean inside = frame.Contains(pt);
if (inside && !itsIsPushedFlag)
{
itsIsPushedFlag = kJTrue;
Redraw();
}
else if (!inside && itsIsPushedFlag)
{
itsIsPushedFlag = kJFalse;
Redraw();
}
}
}