Vertical menu scrolling was enabled also in case the menu was wider than the screen, but this is obviously wrong. The menu window was also resized to be the height of the screen in this case, and it was the cause of bug #3174. Note that horizontal scrolling is not yet implemented

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28954 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2009-01-19 15:31:31 +00:00
parent a8b0095433
commit 321bba933d
+16 -13
View File
@@ -2148,12 +2148,7 @@ BMenu::_CalcFrame(BPoint where, bool *scrollOn)
BMenu *superMenu = Supermenu();
BMenuItem *superItem = Superitem();
if (scrollOn != NULL) {
// basically, if this returns false, it means
// that the menu frame won't fit completely inside the screen
*scrollOn = !screenFrame.Contains(bounds);
}
bool scroll = false;
// TODO: Horrible hack:
// When added to a BMenuField, a BPopUpMenu is the child of
// a _BMCMenuBar_ to "fake" the menu hierarchy
@@ -2171,10 +2166,7 @@ BMenu::_CalcFrame(BPoint where, bool *scrollOn)
else if (frame.left < screenFrame.left)
frame.OffsetBy(-frame.left, 0);
return frame;
}
if (superMenu->Layout() == B_ITEMS_IN_COLUMN) {
} else if (superMenu->Layout() == B_ITEMS_IN_COLUMN) {
if (frame.right > screenFrame.right)
frame.OffsetBy(-superItem->Frame().Width() - frame.Width() - 2, 0);
@@ -2188,7 +2180,7 @@ BMenu::_CalcFrame(BPoint where, bool *scrollOn)
if (scrollOn != NULL && superMenu != NULL
&& dynamic_cast<BMenuBar *>(superMenu) != NULL
&& frame.top < (screenFrame.bottom - 80)) {
*scrollOn = true;
scroll = true;
} else {
frame.OffsetBy(0, -superItem->Frame().Height() - frame.Height() - 3);
}
@@ -2197,7 +2189,18 @@ BMenu::_CalcFrame(BPoint where, bool *scrollOn)
if (frame.right > screenFrame.right)
frame.OffsetBy(screenFrame.right - frame.right, 0);
}
if (!scroll) {
// basically, if this returns false, it means
// that the menu frame won't fit completely inside the screen
// TODO: Scrolling, will currently only work up/down,
// not left/right
scroll = screenFrame.Height() < frame.Height();
}
if (scrollOn != NULL)
*scrollOn = scroll;
return frame;
}
@@ -2573,7 +2576,7 @@ BMenu::_UpdateWindowViewSize(bool updatePosition)
if (!fResizeToFit)
return;
bool scroll;
bool scroll = false;
const BPoint screenLocation = updatePosition ? ScreenLocation()
: window->Frame().LeftTop();
BRect frame = _CalcFrame(screenLocation, &scroll);