All controls/views now accept NULL arguments for "width" and "height" in GetPreferredSize().

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15091 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-11-23 17:29:39 +00:00
parent f97761575a
commit 8643b0987c
9 changed files with 161 additions and 141 deletions
+7 -5
View File
@@ -486,7 +486,7 @@ BMenuField::GetPreferredSize(float *_width, float *_height)
{
BView::GetPreferredSize(_width, _height);
if (!fFixedSizeMB) {
if (!fFixedSizeMB && _width != NULL) {
BMenu* menu = Menu();
float width = 0;
@@ -507,13 +507,15 @@ BMenuField::GetPreferredSize(float *_width, float *_height)
}
// TODO: fix these values (they should match the visual appearance)
*_width = width + 45 + fDivider;
width += 45 + fDivider;
if (Label())
*_width += StringWidth(Label()) + 5;
width += StringWidth(Label()) + 5;
*_width = width;
}
*_height = fMenuBar->Bounds().Height();
if (_height)
*_height = fMenuBar->Bounds().Height();
}