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
+13 -8
View File
@@ -533,15 +533,20 @@ BStatusBar::ResizeToPreferred()
void
BStatusBar::GetPreferredSize(float *width, float *height)
BStatusBar::GetPreferredSize(float* _width, float* _height)
{
font_height fh;
GetFontHeight(&fh);
*width = (fLabel ? (float)ceil(StringWidth(fLabel)) : 0.0f) +
(fTrailingLabel ? (float)ceil(StringWidth(fTrailingLabel)) : 0.0f) +
7.0f;
*height = fh.ascent + fh.descent + 5.0f + BarHeight();
if (_width) {
*_width = (fLabel ? (float)ceil(StringWidth(fLabel)) : 0.0f)
+ (fTrailingLabel ? (float)ceil(StringWidth(fTrailingLabel)) : 0.0f)
+ 7.0f;
}
if (_height) {
font_height fontHeight;
GetFontHeight(&fontHeight);
*_height = ceil(fontHeight.ascent + fontHeight.descent) + 5.0f + BarHeight();
}
}