Menuitems are layoutted better, fixing bug 526
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17282 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1400,22 +1400,24 @@ BMenu::ComputeLayout(int32 index, bool bestFit, bool moveItems,
|
||||
|
||||
if (item->fModifiers && item->fShortcutChar)
|
||||
iWidth += 25.0f;
|
||||
if (item->fSubmenu != NULL)
|
||||
iWidth += 20.0f;
|
||||
|
||||
item->fBounds.left = 0.0f;
|
||||
item->fBounds.top = frame.bottom;
|
||||
item->fBounds.bottom = item->fBounds.top + iHeight + fPad.top + fPad.bottom;
|
||||
|
||||
frame.right = max_c(frame.right, iWidth + fPad.left + fPad.right + 20);
|
||||
frame.right = max_c(frame.right, iWidth + fPad.left + fPad.right);
|
||||
frame.bottom = item->fBounds.bottom + 1.0f;
|
||||
}
|
||||
}
|
||||
if (fMaxContentWidth > 0)
|
||||
frame.right = min_c(frame.right, fMaxContentWidth);
|
||||
|
||||
//if (moveItems) {
|
||||
if (moveItems) {
|
||||
for (int32 i = 0; i < fItems.CountItems(); i++)
|
||||
ItemAt(i)->fBounds.right = frame.right;
|
||||
//}
|
||||
}
|
||||
frame.right = ceilf(frame.right);
|
||||
frame.bottom--;
|
||||
break;
|
||||
@@ -1441,10 +1443,10 @@ BMenu::ComputeLayout(int32 index, bool bestFit, bool moveItems,
|
||||
}
|
||||
}
|
||||
|
||||
//if (moveItems) {
|
||||
if (moveItems) {
|
||||
for (int32 i = 0; i < fItems.CountItems(); i++)
|
||||
ItemAt(i)->fBounds.bottom = frame.bottom;
|
||||
//}
|
||||
}
|
||||
|
||||
frame.right = ceilf(frame.right);
|
||||
break;
|
||||
|
||||
@@ -119,7 +119,8 @@ BMenuFrame::Draw(BRect updateRect)
|
||||
font_height height;
|
||||
GetFontHeight(&height);
|
||||
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DISABLED_LABEL_TINT));
|
||||
DrawString(kEmptyMenuLabel, BPoint(3, ceilf(height.ascent + 2)));
|
||||
BPoint where((Bounds().Width() - fMenu->StringWidth(kEmptyMenuLabel)) / 2, ceilf(height.ascent + 1));
|
||||
DrawString(kEmptyMenuLabel, where);
|
||||
}
|
||||
|
||||
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT));
|
||||
|
||||
Reference in New Issue
Block a user