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:
@@ -389,6 +389,20 @@ DefaultMediaTheme::MakeViewFor(BParameter *parameter, const BRect *hintRect)
|
|||||||
} else {
|
} else {
|
||||||
// create a pop up menu field
|
// 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);
|
BOptionPopUp *popUp = new BOptionPopUp(rect, discrete.Name(), discrete.Name(), NULL);
|
||||||
|
|
||||||
for (int32 i = 0; i < discrete.CountItems(); i++) {
|
for (int32 i = 0; i < discrete.CountItems(); i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user