Skip to content

Commit

Permalink
BBox: fix minimal size when using layouted mode.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pulkomandy committed Dec 15, 2014
1 parent 04c56ae commit 4696958
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/kits/interface/Box.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -583,8 +585,7 @@ BBox::DoLayout()
// don't trigger a relayout
AddChild(fLabelView, ChildAt(0));
EnableLayoutInvalidation();
} else
return;
}
}

_ValidateLayoutData();
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 4696958

Please sign in to comment.