Added workaround for a misbehaving BOptionPopUp class (doesn't resize itself

properly - it obviously needs the correct size at creation time...).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3799 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2003-07-02 02:13:13 +00:00
parent b8da958ed6
commit 652243dade

View File

@ -389,6 +389,20 @@ DefaultMediaTheme::MakeViewFor(BParameter *parameter, const BRect *hintRect)
} else {
// create a pop up menu field
// ToDo: replace BOptionPopUp (or fix it in OpenBeOS...)
// this is a workaround for a bug in BOptionPopUp - you need to
// know the actual width before creating the object - very nice...
BFont font;
float width = 0;
for (int32 i = 0; i < discrete.CountItems(); i++) {
float labelWidth = font.StringWidth(discrete.ItemNameAt(i));
if (labelWidth > width)
width = labelWidth;
}
width += font.StringWidth(discrete.Name()) + 55;
rect.right = rect.left + width;
BOptionPopUp *popUp = new BOptionPopUp(rect, discrete.Name(), discrete.Name(), NULL);
for (int32 i = 0; i < discrete.CountItems(); i++) {