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.
This commit is contained in:
John Scipione 2013-06-07 03:25:36 -04:00
parent 37e0f72711
commit 1c95f72222
3 changed files with 5 additions and 11 deletions

View File

@ -64,7 +64,7 @@ public:
private:
_BMCMenuBar_&operator=(const _BMCMenuBar_&);
void _Init(bool setMaxContentWidth);
void _Init();
BMenuField* fMenuField;
bool fFixedSize;

View File

@ -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);
}

View File

@ -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);