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:
parent
37e0f72711
commit
1c95f72222
|
@ -64,7 +64,7 @@ public:
|
||||||
private:
|
private:
|
||||||
_BMCMenuBar_&operator=(const _BMCMenuBar_&);
|
_BMCMenuBar_&operator=(const _BMCMenuBar_&);
|
||||||
|
|
||||||
void _Init(bool setMaxContentWidth);
|
void _Init();
|
||||||
|
|
||||||
BMenuField* fMenuField;
|
BMenuField* fMenuField;
|
||||||
bool fFixedSize;
|
bool fFixedSize;
|
||||||
|
|
|
@ -67,7 +67,7 @@ _BMCMenuBar_::_BMCMenuBar_(BRect frame, bool fixedSize, BMenuField* menuField)
|
||||||
fRunner(NULL),
|
fRunner(NULL),
|
||||||
fShowPopUpMarker(true)
|
fShowPopUpMarker(true)
|
||||||
{
|
{
|
||||||
_Init(fixedSize);
|
_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ _BMCMenuBar_::_BMCMenuBar_(BMenuField* menuField)
|
||||||
fRunner(NULL),
|
fRunner(NULL),
|
||||||
fShowPopUpMarker(true)
|
fShowPopUpMarker(true)
|
||||||
{
|
{
|
||||||
_Init(true);
|
_Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ _BMCMenuBar_::MaxSize()
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_BMCMenuBar_::_Init(bool setMaxContentWidth)
|
_BMCMenuBar_::_Init()
|
||||||
{
|
{
|
||||||
SetFlags(Flags() | B_FRAME_EVENTS);
|
SetFlags(Flags() | B_FRAME_EVENTS);
|
||||||
SetBorder(B_BORDER_CONTENTS);
|
SetBorder(B_BORDER_CONTENTS);
|
||||||
|
@ -334,7 +334,4 @@ _BMCMenuBar_::_Init(bool setMaxContentWidth)
|
||||||
right + fShowPopUpMarker ? kPopUpIndicatorWidth : 0, bottom);
|
right + fShowPopUpMarker ? kPopUpIndicatorWidth : 0, bottom);
|
||||||
|
|
||||||
fPreviousWidth = Bounds().Width();
|
fPreviousWidth = Bounds().Width();
|
||||||
|
|
||||||
if (setMaxContentWidth)
|
|
||||||
SetMaxContentWidth(fPreviousWidth);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -547,7 +547,6 @@ BMenuField::FrameResized(float newWidth, float newHeight)
|
||||||
// resizing ourselfs might have caused the menubar
|
// resizing ourselfs might have caused the menubar
|
||||||
// to be outside now
|
// to be outside now
|
||||||
fMenuBar->ResizeTo(_MenuBarWidth(), fMenuBar->Frame().Height());
|
fMenuBar->ResizeTo(_MenuBarWidth(), fMenuBar->Frame().Height());
|
||||||
fMenuBar->SetMaxContentWidth(_MenuBarWidth());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newHeight != fLayoutData->previous_height && Label()) {
|
if (newHeight != fLayoutData->previous_height && Label()) {
|
||||||
|
@ -665,10 +664,8 @@ BMenuField::SetDivider(float position)
|
||||||
|
|
||||||
fMenuBar->MoveTo(_MenuBarOffset(), kVMargin);
|
fMenuBar->MoveTo(_MenuBarOffset(), kVMargin);
|
||||||
|
|
||||||
if (fFixedSizeMB) {
|
if (fFixedSizeMB)
|
||||||
fMenuBar->ResizeTo(_MenuBarWidth(), dirty.Height());
|
fMenuBar->ResizeTo(_MenuBarWidth(), dirty.Height());
|
||||||
fMenuBar->SetMaxContentWidth(_MenuBarWidth());
|
|
||||||
}
|
|
||||||
|
|
||||||
dirty = dirty | fMenuBar->Frame();
|
dirty = dirty | fMenuBar->Frame();
|
||||||
dirty.InsetBy(-kVMargin, -kVMargin);
|
dirty.InsetBy(-kVMargin, -kVMargin);
|
||||||
|
|
Loading…
Reference in New Issue