From 1c95f72222f766079af3183ab490e42506f5feca Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 7 Jun 2013 03:25:36 -0400 Subject: [PATCH] Don't set MaxContentWidth on the menu bar of a BMenuField Fixes #9816 It is no longer necessary, or even desirable for us to set the max content width of the menu bar of a BMenuField now that BMenuItem truncation and BMenuField sizing are working. The user may, however, wish to set the max content width of the menu bar of a BMenuField themselves like so: menuField->MenuBar()->SetMaxContentWidth(width); and the Interface Kit will automatically deduct the left and right margins from the width including the space used by the drop down arrow. --- headers/private/interface/BMCPrivate.h | 2 +- src/kits/interface/BMCPrivate.cpp | 9 +++------ src/kits/interface/MenuField.cpp | 5 +---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/headers/private/interface/BMCPrivate.h b/headers/private/interface/BMCPrivate.h index 5581d88d0f..876ad1f37c 100644 --- a/headers/private/interface/BMCPrivate.h +++ b/headers/private/interface/BMCPrivate.h @@ -64,7 +64,7 @@ public: private: _BMCMenuBar_&operator=(const _BMCMenuBar_&); - void _Init(bool setMaxContentWidth); + void _Init(); BMenuField* fMenuField; bool fFixedSize; diff --git a/src/kits/interface/BMCPrivate.cpp b/src/kits/interface/BMCPrivate.cpp index 023769aa1c..e46eef58c0 100644 --- a/src/kits/interface/BMCPrivate.cpp +++ b/src/kits/interface/BMCPrivate.cpp @@ -67,7 +67,7 @@ _BMCMenuBar_::_BMCMenuBar_(BRect frame, bool fixedSize, BMenuField* menuField) fRunner(NULL), fShowPopUpMarker(true) { - _Init(fixedSize); + _Init(); } @@ -79,7 +79,7 @@ _BMCMenuBar_::_BMCMenuBar_(BMenuField* menuField) fRunner(NULL), fShowPopUpMarker(true) { - _Init(true); + _Init(); } @@ -303,7 +303,7 @@ _BMCMenuBar_::MaxSize() void -_BMCMenuBar_::_Init(bool setMaxContentWidth) +_BMCMenuBar_::_Init() { SetFlags(Flags() | B_FRAME_EVENTS); SetBorder(B_BORDER_CONTENTS); @@ -334,7 +334,4 @@ _BMCMenuBar_::_Init(bool setMaxContentWidth) right + fShowPopUpMarker ? kPopUpIndicatorWidth : 0, bottom); fPreviousWidth = Bounds().Width(); - - if (setMaxContentWidth) - SetMaxContentWidth(fPreviousWidth); } diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp index e30fe662fa..f660b9e38c 100644 --- a/src/kits/interface/MenuField.cpp +++ b/src/kits/interface/MenuField.cpp @@ -547,7 +547,6 @@ BMenuField::FrameResized(float newWidth, float newHeight) // resizing ourselfs might have caused the menubar // to be outside now fMenuBar->ResizeTo(_MenuBarWidth(), fMenuBar->Frame().Height()); - fMenuBar->SetMaxContentWidth(_MenuBarWidth()); } if (newHeight != fLayoutData->previous_height && Label()) { @@ -665,10 +664,8 @@ BMenuField::SetDivider(float position) fMenuBar->MoveTo(_MenuBarOffset(), kVMargin); - if (fFixedSizeMB) { + if (fFixedSizeMB) fMenuBar->ResizeTo(_MenuBarWidth(), dirty.Height()); - fMenuBar->SetMaxContentWidth(_MenuBarWidth()); - } dirty = dirty | fMenuBar->Frame(); dirty.InsetBy(-kVMargin, -kVMargin);