From 770ebceafabd33d77169c90fb9ed86371b60ca83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 17 Mar 2010 12:15:14 +0000 Subject: [PATCH] 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 --- src/kits/interface/TabView.cpp | 39 +++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/kits/interface/TabView.cpp b/src/kits/interface/TabView.cpp index f919442160..e38d2bca47 100644 --- a/src/kits/interface/TabView.cpp +++ b/src/kits/interface/TabView.cpp @@ -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); }