Also update the preferred size constraints correctly when replacing the tabs.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39644 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
5cfaa5ee78
commit
c97cd0f4da
@ -118,7 +118,10 @@ private:
|
||||
|
||||
void _UpdateMinSizeConstraint(BSize min);
|
||||
void _UpdateMaxSizeConstraint(BSize max);
|
||||
void _UpdatePreferredConstraint(BSize preferred);
|
||||
void _UpdatePreferredWidthConstraint(
|
||||
BSize& preferred);
|
||||
void _UpdatePreferredHeightConstraint(
|
||||
BSize& preferred);
|
||||
|
||||
private:
|
||||
BLayoutItem* fLayoutItem;
|
||||
|
@ -174,7 +174,9 @@ Area::SetLeft(XTab* left)
|
||||
fColumn = NULL;
|
||||
|
||||
fMinContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight);
|
||||
fPreferredContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight);
|
||||
BSize preferredSize = fLayoutItem->PreferredSize();
|
||||
_UpdatePreferredWidthConstraint(preferredSize);
|
||||
|
||||
if (fMaxContentWidth != NULL)
|
||||
fMaxContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight);
|
||||
|
||||
@ -195,7 +197,8 @@ Area::SetRight(XTab* right)
|
||||
fColumn = NULL;
|
||||
|
||||
fMinContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight);
|
||||
fPreferredContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight);
|
||||
BSize preferredSize = fLayoutItem->PreferredSize();
|
||||
_UpdatePreferredWidthConstraint(preferredSize);
|
||||
if (fMaxContentWidth != NULL)
|
||||
fMaxContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight);
|
||||
|
||||
@ -214,7 +217,8 @@ Area::SetTop(YTab* top)
|
||||
fRow = NULL;
|
||||
|
||||
fMinContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom);
|
||||
fPreferredContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom);
|
||||
BSize preferredSize = fLayoutItem->PreferredSize();
|
||||
_UpdatePreferredHeightConstraint(preferredSize);
|
||||
if (fMaxContentHeight != NULL)
|
||||
fMaxContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom);
|
||||
|
||||
@ -233,7 +237,8 @@ Area::SetBottom(YTab* bottom)
|
||||
fRow = NULL;
|
||||
|
||||
fMinContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom);
|
||||
fPreferredContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom);
|
||||
BSize preferredSize = fLayoutItem->PreferredSize();
|
||||
_UpdatePreferredHeightConstraint(preferredSize);
|
||||
if (fMaxContentHeight != NULL)
|
||||
fMaxContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom);
|
||||
|
||||
@ -540,7 +545,8 @@ Area::InvalidateSizeConstraints()
|
||||
|
||||
_UpdateMinSizeConstraint(minSize);
|
||||
_UpdateMaxSizeConstraint(maxSize);
|
||||
_UpdatePreferredConstraint(prefSize);
|
||||
_UpdatePreferredWidthConstraint(prefSize);
|
||||
_UpdatePreferredHeightConstraint(prefSize);
|
||||
}
|
||||
|
||||
|
||||
@ -716,17 +722,23 @@ Area::_UpdateMaxSizeConstraint(BSize max)
|
||||
|
||||
|
||||
void
|
||||
Area::_UpdatePreferredConstraint(BSize preferred)
|
||||
Area::_UpdatePreferredWidthConstraint(BSize& preferred)
|
||||
{
|
||||
float width = 32000;
|
||||
float height = 32000;
|
||||
if (preferred.width > 0)
|
||||
width = preferred.Width() + LeftInset() + RightInset();
|
||||
if (preferred.height > 0)
|
||||
height = preferred.Height() + TopInset() + BottomInset();
|
||||
|
||||
|
||||
fPreferredContentWidth->SetLeftSide(-1.0, fLeft, 1.0, fRight, -width,
|
||||
fScaleWidth);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Area::_UpdatePreferredHeightConstraint(BSize& preferred)
|
||||
{
|
||||
float height = 32000;
|
||||
if (preferred.height > 0)
|
||||
height = preferred.Height() + TopInset() + BottomInset();
|
||||
|
||||
fPreferredContentHeight->SetLeftSide(-1.0, fTop, 1.0, fBottom, -height,
|
||||
fScaleHeight);
|
||||
|
Loading…
Reference in New Issue
Block a user