Just realized that BTabViews don't have a BLayout set when not layouted. But

just in case someone calls the BSize methods on such a tab view, provide a fall
back implementation. This one should now also report the correct size, only
less efficient.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35888 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2010-03-17 12:15:14 +00:00
parent 7b19a569be
commit 770ebceafa

View File

@ -1053,7 +1053,18 @@ BTabView::GetPreferredSize(float *width, float *height)
BSize
BTabView::MinSize()
{
BSize size = GetLayout()->MinSize();
BSize size;
if (GetLayout())
size = GetLayout()->MinSize();
else {
size = _TabsMinSize();
BSize containerSize = fContainerView->MinSize();
containerSize.width += 2 * _BorderWidth();
containerSize.height += _BorderWidth();
if (containerSize.width > size.width)
size.width = containerSize.width;
size.height += containerSize.height;
}
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
}
@ -1061,7 +1072,18 @@ BTabView::MinSize()
BSize
BTabView::MaxSize()
{
BSize size = GetLayout()->MaxSize();
BSize size;
if (GetLayout())
size = GetLayout()->MaxSize();
else {
size = _TabsMinSize();
BSize containerSize = fContainerView->MaxSize();
containerSize.width += 2 * _BorderWidth();
containerSize.height += _BorderWidth();
if (containerSize.width > size.width)
size.width = containerSize.width;
size.height += containerSize.height;
}
return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size);
}
@ -1069,7 +1091,18 @@ BTabView::MaxSize()
BSize
BTabView::PreferredSize()
{
BSize size = GetLayout()->PreferredSize();
BSize size;
if (GetLayout())
size = GetLayout()->PreferredSize();
else {
size = _TabsMinSize();
BSize containerSize = fContainerView->PreferredSize();
containerSize.width += 2 * _BorderWidth();
containerSize.height += _BorderWidth();
if (containerSize.width > size.width)
size.width = containerSize.width;
size.height += containerSize.height;
}
return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), size);
}