From 7bd24def80adfdabb86404ac43741ce5a8ab80b7 Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Mon, 22 Oct 2007 09:23:19 +0000 Subject: [PATCH] At least for the column menu layout, don't recalculate the whole layout if the calling function supplied an item index. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22658 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Menu.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index d88aad52aa..500247b25e 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -54,6 +54,7 @@ private: BList fList; }; + class ExtraMenuData { public: menu_tracking_hook trackingHook; @@ -1655,7 +1656,9 @@ BMenu::_ComputeLayout(int32 index, bool bestFit, bool moveItems, // Recalculate only the needed items, // not the whole layout every time - BRect frame(0, 0, 0, 0); + BRect frame(0, 0, 0, 0); + if (index > 0) + frame = Bounds(); switch (fLayout) { case B_ITEMS_IN_COLUMN: _ComputeColumnLayout(index, bestFit, moveItems, frame); @@ -1710,7 +1713,7 @@ BMenu::_ComputeColumnLayout(int32 index, bool bestFit, bool moveItems, bool command = false; bool control = false; bool shift = false; - for (int32 i = 0; i < fItems.CountItems(); i++) { + for (int32 i = index; i < fItems.CountItems(); i++) { BMenuItem *item = ItemAt(i); if (item != NULL) { float iWidth, iHeight; @@ -1798,6 +1801,7 @@ BMenu::_ComputeRowLayout(int32 index, bool bestFit, bool moveItems, void BMenu::_ComputeMatrixLayout(BRect &frame) { + frame.Set(0, 0, 0, 0); for (int32 i = 0; i < CountItems(); i++) { BMenuItem *item = ItemAt(i); if (item != NULL) {