BOptionPopUp: don't offset when there is no label.

We add a 8 pixel space between the label and the menu, but we shouldn't
do that when the label is empty. This matches BMenuField behavior.

Fixes part of #10734.
This commit is contained in:
Adrien Destugues 2014-11-26 09:29:48 +01:00
parent d67977a5ae
commit d47ada16bc

View File

@ -193,7 +193,9 @@ BOptionPopUp::AllAttached()
BMenu* menu = fMenuField->Menu();
if (menu != NULL) {
float labelWidth = fMenuField->StringWidth(fMenuField->Label());
fMenuField->SetDivider(labelWidth + kLabelSpace);
if (labelWidth > 0.f)
labelWidth += kLabelSapce;
fMenuField->SetDivider(labelWidth);
menu->SetTargetForItems(this);
}
}