From 29ef6eb52d019b8b209958eac8f38fd4553612b2 Mon Sep 17 00:00:00 2001 From: Alex Wilson Date: Thu, 8 Dec 2011 14:09:35 -0700 Subject: [PATCH] Fix BMenu behaviour/ABI by reinstating BMenu::InvalidateLayout() It turns out,this is an old method added by Be, and is not really related to BView::InvalidateLayout(bool). In fact BMenu::InvalidateLayout() does something separate, but related to the BView method. I was wrong to delete this method, since it needs to have action taken each time it is called, so moving these actions into LayoutInvalidated() only worked sometimes (when the BView was considered to have a valid layout). I have added a comment for future hackers so that they don't delete this method. --- headers/os/interface/Menu.h | 2 ++ src/kits/interface/Menu.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/headers/os/interface/Menu.h b/headers/os/interface/Menu.h index e5cb58f962..43e2d1aa25 100644 --- a/headers/os/interface/Menu.h +++ b/headers/os/interface/Menu.h @@ -78,6 +78,8 @@ public: virtual void FrameMoved(BPoint newPosition); virtual void FrameResized(float newWidth, float newHeight); + void InvalidateLayout(); + virtual void MakeFocus(bool focus = true); bool AddItem(BMenuItem* item); diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index a4e79dd40c..c6bca29a76 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -667,6 +667,17 @@ BMenu::FrameResized(float new_width, float new_height) } +void +BMenu::InvalidateLayout() +{ + fUseCachedMenuLayout = false; + // This method exits for backwards compatibility reasons, it is used to + // invalidate the menu layout, but we also use call + // BView::InvalidateLayout() for good measure. Don't delete this method! + BView::InvalidateLayout(false); +} + + // #pragma mark -