- 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
This commit is contained in:
Alexandre Deckner 2008-06-11 01:47:49 +00:00
parent f57b802a6e
commit abe0b5c858

View File

@ -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;