Added some code to draw "empty" in empty menus. Not working for the

moment, but committing since it's too late to continue working, and at 
least the window is resized correctly...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16142 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2006-01-29 22:27:46 +00:00
parent 8a1f6775b9
commit 61ba5a32c1
3 changed files with 44 additions and 14 deletions
+12 -5
View File
@@ -1044,15 +1044,17 @@ BMenu::_show(bool selectFirstItem)
// See if the supermenu has a cached menuwindow,
// and use that one if possible.
BMenuWindow *window = NULL;
if (fSuper != NULL)
if (fSuper != NULL) {
window = fSuper->MenuWindow();
if (window != NULL)
window->SetMenu(this);
}
// Otherwise, create a new one
// Actually, I think this can only happen for
// "stand alone" BPopUpMenus (i.e. not within a BMenuField)
if (window == NULL) {
// Menu windows get the BMenu's handler name
window = new BMenuWindow(Name());
window = new BMenuWindow(Name(), this);
}
if (window == NULL)
@@ -1572,7 +1574,7 @@ BMenu::MenuWindow()
if (fCachedMenuWindow == NULL) {
char windowName[64];
snprintf(windowName, 64, "%s cached menuwindow\n", Name());
fCachedMenuWindow = new BMenuWindow(windowName);
fCachedMenuWindow = new BMenuWindow(windowName, this);
}
return fCachedMenuWindow;
@@ -1807,7 +1809,12 @@ BMenu::UpdateWindowViewSize(bool upWind)
BRect frame = CalcFrame(ScreenLocation(), &scroll);
ResizeTo(frame.Width(), frame.Height());
window->ResizeTo(Bounds().Width() + 2, Bounds().Height() + 2);
if (fItems.CountItems() > 0)
window->ResizeTo(Bounds().Width() + 2, Bounds().Height() + 2);
else {
CacheFontInfo();
window->ResizeTo(StringWidth("<empty>") + 4, fFontHeight + 6);
}
window->MoveTo(frame.LeftTop());
}