Don't resize items if not needed, small change
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16810 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -122,7 +122,7 @@ BMenu::BMenu(const char *name, menu_layout layout)
|
|||||||
fExtraMenuData(NULL),
|
fExtraMenuData(NULL),
|
||||||
fTrigger(0),
|
fTrigger(0),
|
||||||
fResizeToFit(true),
|
fResizeToFit(true),
|
||||||
fUseCachedMenuLayout(true),
|
fUseCachedMenuLayout(false),
|
||||||
fEnabled(true),
|
fEnabled(true),
|
||||||
fDynamicName(false),
|
fDynamicName(false),
|
||||||
fRadioMode(false),
|
fRadioMode(false),
|
||||||
@@ -155,7 +155,7 @@ BMenu::BMenu(const char *name, float width, float height)
|
|||||||
fExtraMenuData(NULL),
|
fExtraMenuData(NULL),
|
||||||
fTrigger(0),
|
fTrigger(0),
|
||||||
fResizeToFit(true),
|
fResizeToFit(true),
|
||||||
fUseCachedMenuLayout(true),
|
fUseCachedMenuLayout(false),
|
||||||
fEnabled(true),
|
fEnabled(true),
|
||||||
fDynamicName(false),
|
fDynamicName(false),
|
||||||
fRadioMode(false),
|
fRadioMode(false),
|
||||||
@@ -877,7 +877,7 @@ BMenu::BMenu(BRect frame, const char *name, uint32 resizingMode, uint32 flags,
|
|||||||
fExtraMenuData(NULL),
|
fExtraMenuData(NULL),
|
||||||
fTrigger(0),
|
fTrigger(0),
|
||||||
fResizeToFit(resizeToFit),
|
fResizeToFit(resizeToFit),
|
||||||
fUseCachedMenuLayout(true),
|
fUseCachedMenuLayout(false),
|
||||||
fEnabled(true),
|
fEnabled(true),
|
||||||
fDynamicName(false),
|
fDynamicName(false),
|
||||||
fRadioMode(false),
|
fRadioMode(false),
|
||||||
@@ -1333,9 +1333,10 @@ BMenu::ComputeLayout(int32 index, bool bestFit, bool moveItems,
|
|||||||
if (fMaxContentWidth > 0)
|
if (fMaxContentWidth > 0)
|
||||||
frame.right = min_c(frame.right, fMaxContentWidth);
|
frame.right = min_c(frame.right, fMaxContentWidth);
|
||||||
|
|
||||||
for (int32 i = 0; i < fItems.CountItems(); i++)
|
if (moveItems) {
|
||||||
ItemAt(i)->fBounds.right = frame.right;
|
for (int32 i = 0; i < fItems.CountItems(); i++)
|
||||||
|
ItemAt(i)->fBounds.right = frame.right;
|
||||||
|
}
|
||||||
frame.right = ceilf(frame.right);
|
frame.right = ceilf(frame.right);
|
||||||
frame.bottom--;
|
frame.bottom--;
|
||||||
break;
|
break;
|
||||||
@@ -1361,8 +1362,10 @@ BMenu::ComputeLayout(int32 index, bool bestFit, bool moveItems,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32 i = 0; i < fItems.CountItems(); i++)
|
if (moveItems) {
|
||||||
ItemAt(i)->fBounds.bottom = frame.bottom;
|
for (int32 i = 0; i < fItems.CountItems(); i++)
|
||||||
|
ItemAt(i)->fBounds.bottom = frame.bottom;
|
||||||
|
}
|
||||||
|
|
||||||
frame.right = ceilf(frame.right);
|
frame.right = ceilf(frame.right);
|
||||||
break;
|
break;
|
||||||
@@ -1517,7 +1520,8 @@ BMenu::ScrollIntoView(BMenuItem *item)
|
|||||||
void
|
void
|
||||||
BMenu::DrawItems(BRect updateRect)
|
BMenu::DrawItems(BRect updateRect)
|
||||||
{
|
{
|
||||||
for (int32 i = 0; i < fItems.CountItems(); i++) {
|
int32 itemCount = fItems.CountItems();
|
||||||
|
for (int32 i = 0; i < itemCount; i++) {
|
||||||
BMenuItem *item = ItemAt(i);
|
BMenuItem *item = ItemAt(i);
|
||||||
if (item->Frame().Intersects(updateRect))
|
if (item->Frame().Intersects(updateRect))
|
||||||
item->Draw();
|
item->Draw();
|
||||||
|
|||||||
Reference in New Issue
Block a user