BMenu: Adjust padding computation logic.
Instead of applying scaling factors to the font size, use the label spacing value instead. Also, perform the computation in _InitData(), which all constructors call, rather than in BMenu.
This commit is contained in:
@@ -254,9 +254,6 @@ BMenu::BMenu(const char* name, menu_layout layout)
|
|||||||
fHasSubmenus(false),
|
fHasSubmenus(false),
|
||||||
fAttachAborted(false)
|
fAttachAborted(false)
|
||||||
{
|
{
|
||||||
const float fontSize = be_plain_font->Size();
|
|
||||||
fPad = BRect(fontSize * 1.15f, fontSize / 6.0f, fontSize * 1.7f, 0.0f);
|
|
||||||
|
|
||||||
_InitData(NULL);
|
_InitData(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,7 +262,6 @@ BMenu::BMenu(const char* name, float width, float height)
|
|||||||
:
|
:
|
||||||
BView(BRect(0.0f, 0.0f, 0.0f, 0.0f), name, 0, B_WILL_DRAW),
|
BView(BRect(0.0f, 0.0f, 0.0f, 0.0f), name, 0, B_WILL_DRAW),
|
||||||
fChosenItem(NULL),
|
fChosenItem(NULL),
|
||||||
fPad(14.0f, 2.0f, 20.0f, 0.0f),
|
|
||||||
fSelected(NULL),
|
fSelected(NULL),
|
||||||
fCachedMenuWindow(NULL),
|
fCachedMenuWindow(NULL),
|
||||||
fSuper(NULL),
|
fSuper(NULL),
|
||||||
@@ -300,7 +296,6 @@ BMenu::BMenu(BMessage* archive)
|
|||||||
:
|
:
|
||||||
BView(archive),
|
BView(archive),
|
||||||
fChosenItem(NULL),
|
fChosenItem(NULL),
|
||||||
fPad(14.0f, 2.0f, 20.0f, 0.0f),
|
|
||||||
fSelected(NULL),
|
fSelected(NULL),
|
||||||
fCachedMenuWindow(NULL),
|
fCachedMenuWindow(NULL),
|
||||||
fSuper(NULL),
|
fSuper(NULL),
|
||||||
@@ -1508,6 +1503,10 @@ BMenu::_InitData(BMessage* archive)
|
|||||||
|
|
||||||
fExtraMenuData = new (nothrow) BPrivate::ExtraMenuData();
|
fExtraMenuData = new (nothrow) BPrivate::ExtraMenuData();
|
||||||
|
|
||||||
|
const float labelSpacing = be_control_look->DefaultLabelSpacing();
|
||||||
|
fPad = BRect(ceilf(labelSpacing * 2.3f), ceilf(labelSpacing / 3.0f),
|
||||||
|
ceilf((labelSpacing / 3.0f) * 10.0f), 0.0f);
|
||||||
|
|
||||||
fLayoutData = new LayoutData;
|
fLayoutData = new LayoutData;
|
||||||
fLayoutData->lastResizingMode = ResizingMode();
|
fLayoutData->lastResizingMode = ResizingMode();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user