diff --git a/headers/private/interface/BMCPrivate.h b/headers/private/interface/BMCPrivate.h index f6c1bc4c82..0590fc7c52 100644 --- a/headers/private/interface/BMCPrivate.h +++ b/headers/private/interface/BMCPrivate.h @@ -19,7 +19,6 @@ static const float kVMargin = 2.0f; static const float kMinMenuBarWidth = 20.0f; // found by experimenting on BeOS R5 -static const float kPopUpIndicatorWidth = 13.0f; class BMessageRunner; diff --git a/src/kits/interface/BMCPrivate.cpp b/src/kits/interface/BMCPrivate.cpp index 1d8f60db96..da8719f4fb 100644 --- a/src/kits/interface/BMCPrivate.cpp +++ b/src/kits/interface/BMCPrivate.cpp @@ -55,6 +55,9 @@ _BMCFilter_::Filter(BMessage* message, BHandler** handler) // #pragma mark - +static const float kPopUpIndicatorWidth = 13.0f; + + _BMCMenuBar_::_BMCMenuBar_(BRect frame, bool fixedSize, BMenuField* menuField) : BMenuBar(frame, "_mc_mb_", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_ITEMS_IN_ROW, diff --git a/src/kits/interface/MenuField.cpp b/src/kits/interface/MenuField.cpp index 1be5d10b5d..3c94b44c9f 100644 --- a/src/kits/interface/MenuField.cpp +++ b/src/kits/interface/MenuField.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -397,8 +398,18 @@ BMenuField::AllAttached() TRACE("width: %.2f, height: %.2f\n", Frame().Width(), Frame().Height()); - ResizeTo(Bounds().Width(), - fMenuBar->Bounds().Height() + kVMargin + kVMargin); + float width = Bounds().Width(); + if (!fFixedSizeMB && _MenuBarWidth() < kMinMenuBarWidth) { + // The menu bar is too narrow, resize it to fit the menu items + BMenuItem* item = fMenuBar->ItemAt(0); + if (item != NULL) { + float right; + fMenuBar->GetItemMargins(NULL, NULL, &right, NULL); + width = item->Frame().Width() + kVMargin + _MenuBarOffset() + right; + } + } + + ResizeTo(width, fMenuBar->Bounds().Height() + kVMargin * 2); TRACE("width: %.2f, height: %.2f\n", Frame().Width(), Frame().Height()); }