Resize menu field if below minimum width in auto-size mode
... cancelling the normal item truncation behavior. This funcationality comes from BeOS R5, we need to reproduce it for backwards compat. KeymapSwitcher depends on it at least. Minimum width is 20px, was set in last commit, comes from BeOS R5.
This commit is contained in:
parent
6031e62420
commit
a1cf3ead5f
@ -19,7 +19,6 @@
|
|||||||
static const float kVMargin = 2.0f;
|
static const float kVMargin = 2.0f;
|
||||||
static const float kMinMenuBarWidth = 20.0f;
|
static const float kMinMenuBarWidth = 20.0f;
|
||||||
// found by experimenting on BeOS R5
|
// found by experimenting on BeOS R5
|
||||||
static const float kPopUpIndicatorWidth = 13.0f;
|
|
||||||
|
|
||||||
|
|
||||||
class BMessageRunner;
|
class BMessageRunner;
|
||||||
|
@ -55,6 +55,9 @@ _BMCFilter_::Filter(BMessage* message, BHandler** handler)
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
static const float kPopUpIndicatorWidth = 13.0f;
|
||||||
|
|
||||||
|
|
||||||
_BMCMenuBar_::_BMCMenuBar_(BRect frame, bool fixedSize, BMenuField* menuField)
|
_BMCMenuBar_::_BMCMenuBar_(BRect frame, bool fixedSize, BMenuField* menuField)
|
||||||
:
|
:
|
||||||
BMenuBar(frame, "_mc_mb_", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_ITEMS_IN_ROW,
|
BMenuBar(frame, "_mc_mb_", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_ITEMS_IN_ROW,
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
#include <LayoutUtils.h>
|
#include <LayoutUtils.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
|
#include <MenuItem.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <BMCPrivate.h>
|
#include <BMCPrivate.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
@ -397,8 +398,18 @@ BMenuField::AllAttached()
|
|||||||
|
|
||||||
TRACE("width: %.2f, height: %.2f\n", Frame().Width(), Frame().Height());
|
TRACE("width: %.2f, height: %.2f\n", Frame().Width(), Frame().Height());
|
||||||
|
|
||||||
ResizeTo(Bounds().Width(),
|
float width = Bounds().Width();
|
||||||
fMenuBar->Bounds().Height() + kVMargin + kVMargin);
|
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());
|
TRACE("width: %.2f, height: %.2f\n", Frame().Width(), Frame().Height());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user