Fixed BBox behaviour when it has layout set and BView based class as a label
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35447 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
e6b13a6d24
commit
e457eb2a53
@ -551,21 +551,41 @@ BBox::DoLayout()
|
||||
if (!(Flags() & B_SUPPORTS_LAYOUT))
|
||||
return;
|
||||
|
||||
// If the user set a layout, we let the base class version call its
|
||||
// hook.
|
||||
if (GetLayout()) {
|
||||
bool layouted = GetLayout() ? true : false;
|
||||
|
||||
// If the user set a layout, let the base class version call its
|
||||
// hook. In case when we have BView as a label, remove it from child list
|
||||
// so it won't be layouted with the rest of views and add it again
|
||||
// after that.
|
||||
if (layouted) {
|
||||
if (fLabelView)
|
||||
RemoveChild(fLabelView);
|
||||
|
||||
BView::DoLayout();
|
||||
return;
|
||||
|
||||
if (!fLabelView)
|
||||
return;
|
||||
}
|
||||
|
||||
// Add it again..
|
||||
if (layouted && fLabelView)
|
||||
AddChild(fLabelView, ChildAt(0));
|
||||
|
||||
_ValidateLayoutData();
|
||||
|
||||
// Even if the user set a layout, restore label view to it's
|
||||
// desired position.
|
||||
|
||||
// layout the label view
|
||||
if (fLabelView) {
|
||||
fLabelView->MoveTo(fLayoutData->label_box.LeftTop());
|
||||
fLabelView->ResizeTo(fLayoutData->label_box.Size());
|
||||
}
|
||||
|
||||
// If we have layout return here and do not layout the child
|
||||
if (layouted)
|
||||
return;
|
||||
|
||||
// layout the child
|
||||
if (BView* child = _Child()) {
|
||||
BRect frame(Bounds());
|
||||
|
Loading…
Reference in New Issue
Block a user