mirror of
https://review.haiku-os.org/haiku
synced 2025-01-31 18:56:49 +01:00
BMenuField: Fix menu bar resizing in auto-size mode.
Fixes #9753 (for real this time) Don't resize the menu field when the menu bar resizes, the menu field stays the same size because we'll need to use it's width to check when the menu bar width has expanded beyond its width. Then, if the selected menu item expands the menu bar to a width greater than the width of the menu field resize it to the menu field width.
This commit is contained in:
parent
f6d93b80f3
commit
298cd4c2bf
@ -137,12 +137,10 @@ _BMCMenuBar_::AttachedToWindow()
|
||||
void
|
||||
_BMCMenuBar_::Draw(BRect updateRect)
|
||||
{
|
||||
if (fFixedSize) {
|
||||
float height;
|
||||
GetPreferredSize(NULL, &height);
|
||||
ResizeTo(fMenuField->_MenuBarWidth(), height);
|
||||
// Set the width to the menu field width because the menubar
|
||||
// bounds are expanded by the selected menu item.
|
||||
if (fFixedSize || Bounds().Width() > fMenuField->_MenuBarWidth()) {
|
||||
// Set the width of the menu bar because the menu bar bounds have
|
||||
// been expanded by the selected menu item.
|
||||
ResizeTo(fMenuField->_MenuBarWidth(), Bounds().Height());
|
||||
}
|
||||
BRect rect(Bounds());
|
||||
rgb_color base = ui_color(B_MENU_BACKGROUND_COLOR);
|
||||
@ -195,15 +193,6 @@ _BMCMenuBar_::FrameResized(float width, float height)
|
||||
}
|
||||
}
|
||||
|
||||
if (!fFixedSize && ResizingMode() == (B_FOLLOW_LEFT | B_FOLLOW_TOP)) {
|
||||
// we have been shrinked or enlarged and need to take care
|
||||
// of the size of the parent menu field as well
|
||||
// NOTE: no worries about follow mode, we follow left and top
|
||||
// in autosize mode
|
||||
diff = Frame().right + 2 - fMenuField->Bounds().right;
|
||||
fMenuField->ResizeBy(diff, 0.0);
|
||||
}
|
||||
|
||||
BMenuBar::FrameResized(width, height);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user