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:
parent
8ffa3fb9fa
commit
1b1b68919c
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue