BBox: fix minimal size when using layouted mode.
It is possible to set a custom layout on a BBox, which is then applied to the children excluding the label. However, the label size must still be used when computing the minimal size of the BBox in that case.
This commit is contained in:
parent
04c56ae26b
commit
4696958aa4
@ -119,10 +119,10 @@ BBox::Archive(BMessage* archive, bool deep) const
|
||||
status_t ret = BView::Archive(archive, deep);
|
||||
|
||||
if (fLabel && ret == B_OK)
|
||||
ret = archive->AddString("_label", fLabel);
|
||||
ret = archive->AddString("_label", fLabel);
|
||||
|
||||
if (fLabelView && ret == B_OK)
|
||||
ret = archive->AddBool("_lblview", true);
|
||||
ret = archive->AddBool("_lblview", true);
|
||||
|
||||
if (fStyle != B_FANCY_BORDER && ret == B_OK)
|
||||
ret = archive->AddInt32("_style", fStyle);
|
||||
@ -516,6 +516,8 @@ BBox::MinSize()
|
||||
_ValidateLayoutData();
|
||||
|
||||
BSize size = (GetLayout() ? GetLayout()->MinSize() : fLayoutData->min);
|
||||
if (size.width < fLayoutData->min.width)
|
||||
size.width = fLayoutData->min.width;
|
||||
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
|
||||
}
|
||||
|
||||
@ -583,8 +585,7 @@ BBox::DoLayout()
|
||||
// don't trigger a relayout
|
||||
AddChild(fLabelView, ChildAt(0));
|
||||
EnableLayoutInvalidation();
|
||||
} else
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_ValidateLayoutData();
|
||||
@ -828,9 +829,8 @@ BBox::_ValidateLayoutData()
|
||||
BSize size = fLabelView->PreferredSize();
|
||||
fLayoutData->label_box.Set(10, 0, 10 + size.width, size.height);
|
||||
labelHeight = size.height + 1;
|
||||
} else {
|
||||
} else
|
||||
label = false;
|
||||
}
|
||||
|
||||
// border
|
||||
switch (fStyle) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user