本文整理汇总了C++中LLView::getRequiredRect方法的典型用法代码示例。如果您正苦于以下问题:C++ LLView::getRequiredRect方法的具体用法?C++ LLView::getRequiredRect怎么用?C++ LLView::getRequiredRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLView
的用法示例。
在下文中一共展示了LLView::getRequiredRect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getRequiredRect
LLRect LLContainerView::getRequiredRect()
{
LLRect req_rect;
//LLView *childp;
U32 total_height = 0;
// Determine the sizes and locations of all contained views
// Leave some space for the top label/grab handle
if (mShowLabel)
{
total_height = 20;
}
if (mDisplayChildren)
{
// Determine total height
U32 child_height = 0;
for (child_list_const_iter_t child_iter = getChildList()->begin();
child_iter != getChildList()->end(); ++child_iter)
{
LLView *childp = *child_iter;
LLRect child_rect = childp->getRequiredRect();
child_height += child_rect.getHeight();
child_height += 2;
}
total_height += child_height;
}
req_rect.mTop = total_height;
return req_rect;
}
示例2: arrange
void LLContainerView::arrange(S32 width, S32 height, BOOL called_from_parent)
{
// Determine the sizes and locations of all contained views
S32 total_height = 0;
S32 top, left, right, bottom;
//LLView *childp;
// These will be used for the children
left = 4;
top = getRect().getHeight() - 4;
right = width - 2;
bottom = top;
// Leave some space for the top label/grab handle
if (mShowLabel)
{
total_height += 20;
}
if (mDisplayChildren)
{
// Determine total height
U32 child_height = 0;
for (child_list_const_iter_t child_iter = getChildList()->begin();
child_iter != getChildList()->end(); ++child_iter)
{
LLView *childp = *child_iter;
if (!childp->getVisible())
{
LL_WARNS() << "Incorrect visibility!" << LL_ENDL;
}
LLRect child_rect = childp->getRequiredRect();
child_height += child_rect.getHeight();
child_height += 2;
}
total_height += child_height;
}
if (total_height < height)
total_height = height;
if (followsTop())
{
// HACK: casting away const. Should use setRect or some helper function instead.
const_cast<LLRect&>(getRect()).mBottom = getRect().mTop - total_height;
}
else
{
// HACK: casting away const. Should use setRect or some helper function instead.
const_cast<LLRect&>(getRect()).mTop = getRect().mBottom + total_height;
}
// HACK: casting away const. Should use setRect or some helper function instead.
const_cast<LLRect&>(getRect()).mRight = getRect().mLeft + width;
top = total_height;
if (mShowLabel)
{
top -= 20;
}
bottom = top;
if (mDisplayChildren)
{
// Iterate through all children, and put in container from top down.
for (child_list_const_iter_t child_iter = getChildList()->begin();
child_iter != getChildList()->end(); ++child_iter)
{
LLView *childp = *child_iter;
LLRect child_rect = childp->getRequiredRect();
bottom -= child_rect.getHeight();
LLRect r(left, bottom + child_rect.getHeight(), right, bottom);
childp->setRect(r);
childp->reshape(right - left, top - bottom);
top = bottom - 2;
bottom = top;
}
}
if (!called_from_parent)
{
if (getParent())
{
getParent()->reshape(getParent()->getRect().getWidth(), getParent()->getRect().getHeight(), FALSE);
}
}
}