Fixed CalcFrame(): it could be called with Superitem() and Supermenu() == NULL.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13475 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-07-06 02:22:22 +00:00
parent 8ffa3fb9fa
commit 1b1b68919c
1 changed files with 30 additions and 20 deletions

View File

@ -1049,7 +1049,6 @@ BMenu::_show(bool selectFirstItem)
fSuperbounds = fSuper->ConvertToScreen(fSuper->Bounds());
UpdateWindowViewSize();
fCachedMenuWindow->Show();
return true;
@ -1065,7 +1064,6 @@ BMenu::_hide()
fCachedMenuWindow->Quit();
fCachedMenuWindow = NULL;
}
}
@ -1385,6 +1383,18 @@ BMenu::CalcFrame(BPoint where, bool *scrollOn)
BMenu *superMenu = Supermenu();
BMenuItem *superItem = Superitem();
if (superMenu == NULL || superItem == NULL) {
// just move the window on screen
if (frame.bottom > screenFrame.bottom)
frame.OffsetBy(0, screenFrame.bottom - frame.bottom);
if (frame.right > screenFrame.right)
frame.OffsetBy(screenFrame.right - frame.right, 0);
return frame;
}
if (superMenu->Layout() == B_ITEMS_IN_COLUMN) {
if (frame.right > screenFrame.right)
frame.OffsetBy(-superItem->Frame().Width() - frame.Width() - 2, 0);