After the first call to BView::InvalidateLayout() further invocations don't

invoke the layout's InvalidateLayout() anymore. This could cause problems when
the layout caches layout related information and also updates those on calls
other than LayoutView(). A call to such a method after an InvalidateLayout()
would mark the cached info valid and the layout would use the cached info
until the first InvalidateLayout() after the next LayoutView(), even if
BView::InvalidateLayout() had been called again in the meantime.

* Introduced a new method BView::ResetLayoutInvalidation(), which must be
  called by layout implementations whenever they have updated their cached
  information and need further InvalidateLayout() notifications.
* Adjusted the existing layout implementations to use the method.

Fixes bug #4047.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31316 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2009-06-29 14:18:12 +00:00
parent 23eb9a9e82
commit a0747aad3b
5 changed files with 45 additions and 12 deletions
+8 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2006, Ingo Weinhold <[email protected].de>.
* Copyright 2006-2009, Ingo Weinhold <ingo_weinhold@gmx.de>.
* All rights reserved. Distributed under the terms of the MIT License.
*/
@@ -54,7 +54,7 @@ BCardLayout::SetVisibleItem(BLayoutItem* item)
if (item != NULL && IndexOfItem(item) < 0)
return;
if (fVisibleItem != NULL)
fVisibleItem->SetVisible(false);
@@ -107,7 +107,7 @@ BCardLayout::HasHeightForWidth()
if (ItemAt(i)->HasHeightForWidth())
return true;
}
return false;
}
@@ -157,7 +157,7 @@ void
BCardLayout::InvalidateLayout()
{
BLayout::InvalidateLayout();
fMinMaxValid = false;
}
@@ -231,6 +231,9 @@ BCardLayout::_ValidateMinMax()
fPreferred.height = max_c(fPreferred.height, fMin.height);
fPreferred.width = min_c(fPreferred.width, fMax.width);
fPreferred.height = min_c(fPreferred.height, fMax.height);
fMinMaxValid = true;
if (BView* view = View())
view->ResetLayoutInvalidation();
}