From abe0b5c858d5b3c4b2e880e40b75abe475c14158 Mon Sep 17 00:00:00 2001 From: Alexandre Deckner Date: Wed, 11 Jun 2008 01:47:49 +0000 Subject: [PATCH] - MakeViewFor didn't return a view with a good default size when no hintRect was provided (as in Cortex). This happened only when needing a tabbed view. It will now return a view with the most fitting size. This fixes #597 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25923 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/media/DefaultMediaTheme.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/kits/media/DefaultMediaTheme.cpp b/src/kits/media/DefaultMediaTheme.cpp index 577924fae1..0f13c26e91 100644 --- a/src/kits/media/DefaultMediaTheme.cpp +++ b/src/kits/media/DefaultMediaTheme.cpp @@ -697,8 +697,8 @@ DefaultMediaTheme::MakeViewFor(BParameterWeb *web, const BRect *hintRect) BRect rect; if (hintRect) rect = *hintRect; - else - rect.Set(0, 0, 80, 100); + + BRect bestRect; // do we have more than one attached parameter group? // if so, use a tabbed view with a tab for each group @@ -737,8 +737,23 @@ DefaultMediaTheme::MakeViewFor(BParameterWeb *web, const BRect *hintRect) return new DynamicScrollView(groupView->Name(), groupView); } - - tabView->AddTab(new DynamicScrollView(groupView->Name(), groupView)); + + DynamicScrollView *scrollView = new DynamicScrollView(groupView->Name(), groupView); + tabView->AddTab(scrollView); + + if (!hintRect) { + bestRect = bestRect | scrollView->Bounds(); + } + } + + if (tabView != NULL) { + // this adjustment must be kept in sync with TabView::FrameResized + bestRect.bottom += tabView->TabHeight(); + bestRect.InsetBy(-3.0,-3.0); + + tabView->ResizeTo(bestRect.Width(), bestRect.Height()); + tabView->FrameResized(bestRect.Width(), bestRect.Height()); + //needed since we're not attached to a window yet } return tabView;