Empty menus now display an '<empty>' label
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16175 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
667fa89b02
commit
55b35fb4d5
@ -71,6 +71,11 @@ BMenuFrame::AttachedToWindow()
|
||||
{
|
||||
BView::AttachedToWindow();
|
||||
ResizeTo(Window()->Bounds().Width(), Window()->Bounds().Height());
|
||||
if (fMenu != NULL) {
|
||||
BFont font;
|
||||
fMenu->GetFont(&font);
|
||||
SetFont(&font);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -78,13 +83,20 @@ void
|
||||
BMenuFrame::Draw(BRect updateRect)
|
||||
{
|
||||
if (fMenu->CountItems() == 0) {
|
||||
// TODO: Review this as it's a bit hacky.
|
||||
// Menu has a size of 0, 0, since there are no items in it.
|
||||
// So the BMenuFrame class has to fake it and draw an empty item.
|
||||
// Note that we can't add a real "empty" item because then we couldn't
|
||||
// tell if the item was added by us or not.
|
||||
// See also BMenu::UpdateWindowViewSize()
|
||||
SetHighColor(ui_color(B_MENU_BACKGROUND_COLOR));
|
||||
SetLowColor(HighColor());
|
||||
FillRect(updateRect);
|
||||
|
||||
font_height height;
|
||||
fMenu->GetFontHeight(&height);
|
||||
fMenu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DISABLED_LABEL_TINT));
|
||||
// TODO: This doesn't get drawn for some reason
|
||||
fMenu->DrawString("<empty>", BPoint(2, ceilf(height.ascent + 2)));
|
||||
GetFontHeight(&height);
|
||||
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DISABLED_LABEL_TINT));
|
||||
DrawString("<empty>", BPoint(2, ceilf(height.ascent + 2)));
|
||||
}
|
||||
|
||||
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT));
|
||||
|
Loading…
Reference in New Issue
Block a user