if menu _BMCMenuBar_ subtract the popup indicator width

... when calculating the width of items in _ComputeLayout. This prevents
that menu field from growing on selection fixing #9796 and #2413.

Also a few style fixes.
This commit is contained in:
John Scipione
2013-05-30 00:05:16 -04:00
parent a1cf3ead5f
commit 6da3c1c788
+7 -5
View File
@@ -2085,7 +2085,8 @@ BMenu::_LayoutItems(int32 index)
{ {
_CalcTriggers(); _CalcTriggers();
float width, height; float width;
float height;
_ComputeLayout(index, fResizeToFit, true, &width, &height); _ComputeLayout(index, fResizeToFit, true, &width, &height);
if (fResizeToFit) if (fResizeToFit)
@@ -2128,8 +2129,7 @@ BMenu::_ComputeLayout(int32 index, bool bestFit, bool moveItems,
overrideFrame = &parentFrame; overrideFrame = &parentFrame;
} }
_ComputeColumnLayout(index, bestFit, moveItems, overrideFrame, _ComputeColumnLayout(index, bestFit, moveItems, overrideFrame, frame);
frame);
break; break;
} }
case B_ITEMS_IN_ROW: case B_ITEMS_IN_ROW:
@@ -2147,9 +2147,11 @@ BMenu::_ComputeLayout(int32 index, bool bestFit, bool moveItems,
// change width depending on resize mode // change width depending on resize mode
BSize size; BSize size;
if ((ResizingMode() & B_FOLLOW_LEFT_RIGHT) == B_FOLLOW_LEFT_RIGHT) { if ((ResizingMode() & B_FOLLOW_LEFT_RIGHT) == B_FOLLOW_LEFT_RIGHT) {
if (Parent()) if (dynamic_cast<_BMCMenuBar_*>(this) != NULL)
size.width = Bounds().Width() - fPad.right;
else if (Parent() != NULL)
size.width = Parent()->Frame().Width() + 1; size.width = Parent()->Frame().Width() + 1;
else if (Window()) else if (Window() != NULL)
size.width = Window()->Frame().Width() + 1; size.width = Window()->Frame().Width() + 1;
else else
size.width = Bounds().Width(); size.width = Bounds().Width();