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 -9
View File
@@ -357,18 +357,22 @@ BCheckBox::SetValue(int32 value)
void
BCheckBox::GetPreferredSize(float *width, float *height)
BCheckBox::GetPreferredSize(float* _width, float* _height)
{
font_height fh;
GetFontHeight(&fh);
font_height fontHeight;
GetFontHeight(&fontHeight);
*height = (float)ceil(6.0f + fh.ascent + fh.descent);
*width = 12.0f + fh.ascent;
if (Label())
*width += StringWidth(Label());
if (_width) {
float width = 12.0f + fontHeight.ascent;
*width = (float)ceil(*width);
if (Label())
width += StringWidth(Label());
*_width = (float)ceil(width);
}
if (_height)
*_height = (float)ceil(6.0f + fontHeight.ascent + fontHeight.descent);
}