From 5041cdf4d90ded8e958233b33b74add10def68ec Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 3 May 2013 16:27:05 -0400 Subject: [PATCH] Fix a few minor BMenu issues, follup on hrev45610 Only AttachScrollers() and scroll if B_ITEMS_IN_COLUMN because if not we don't support scrolling anyway. Also, rename superpoint variable to superPoint. --- src/kits/interface/Menu.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index 97373d6a9a..e7049cf962 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -2870,19 +2870,22 @@ BMenu::_UpdateWindowViewSize(const bool &move) screen.Frame().bottom - frame.top); } - window->AttachScrollers(); + if (fLayout == B_ITEMS_IN_COLUMN) { + // we currently only support scrolling for B_ITEMS_IN_COLUMN + window->AttachScrollers(); - BMenuItem* selectedItem = FindMarked(); - if (selectedItem != NULL && fLayout == B_ITEMS_IN_COLUMN) { - // scroll to the selected item - if (Supermenu() == NULL) { - window->TryScrollTo(selectedItem->Frame().top); - } else { - BPoint point = selectedItem->Frame().LeftTop(); - BPoint superpoint = Superitem()->Frame().LeftTop(); - Supermenu()->ConvertToScreen(&superpoint); - ConvertToScreen(&point); - window->TryScrollTo(point.y - superpoint.y); + BMenuItem* selectedItem = FindMarked(); + if (selectedItem != NULL) { + // scroll to the selected item + if (Supermenu() == NULL) { + window->TryScrollTo(selectedItem->Frame().top); + } else { + BPoint point = selectedItem->Frame().LeftTop(); + BPoint superPoint = Superitem()->Frame().LeftTop(); + Supermenu()->ConvertToScreen(&superPoint); + ConvertToScreen(&point); + window->TryScrollTo(point.y - superPoint.y); + } } } }