From ec592aa9e56e04a312235b34ba89d707cc26aff8 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Tue, 19 Jun 2007 23:09:01 +0000 Subject: [PATCH] Implement _BMCMenuBar_::MaxSize() to override BMenuBar::MaxSize() and limit the maximum width. The latter supports unlimited maximum width. The _BMCMenuBar_ draws fine when resized wider than its min/preferred width, but not the complete "button" area will cause the menu to open when being pressed. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21465 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/interface/BMCPrivate.h | 8 +++++--- src/kits/interface/BMCPrivate.cpp | 12 ++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/headers/private/interface/BMCPrivate.h b/headers/private/interface/BMCPrivate.h index 3843882dd0..c6f0bdead3 100644 --- a/headers/private/interface/BMCPrivate.h +++ b/headers/private/interface/BMCPrivate.h @@ -45,9 +45,11 @@ virtual void FrameResized(float width, float height); virtual void MessageReceived(BMessage* msg); virtual void MakeFocus(bool focused = true); - void TogglePopUpMarker(bool show) { fShowPopUpMarker = show; } - bool IsPopUpMarkerShown() const { return fShowPopUpMarker; } - + void TogglePopUpMarker(bool show) { fShowPopUpMarker = show; } + bool IsPopUpMarkerShown() const { return fShowPopUpMarker; } + +virtual BSize MaxSize(); + private: _BMCMenuBar_&operator=(const _BMCMenuBar_ &); diff --git a/src/kits/interface/BMCPrivate.cpp b/src/kits/interface/BMCPrivate.cpp index 82e02dcc4f..e817c93ca3 100644 --- a/src/kits/interface/BMCPrivate.cpp +++ b/src/kits/interface/BMCPrivate.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -321,6 +322,17 @@ _BMCMenuBar_::MakeFocus(bool focused) } +BSize +_BMCMenuBar_::MaxSize() +{ + // The maximum width of a normal BMenuBar is unlimited, but we want it + // limited. + BSize size; + BMenuBar::GetPreferredSize(&size.width, &size.height); + return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size); +} + + _BMCMenuBar_ &_BMCMenuBar_::operator=(const _BMCMenuBar_ &) {