At least for the column menu layout, don't recalculate the whole layout
if the calling function supplied an item index. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22658 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -54,6 +54,7 @@ private:
|
|||||||
BList fList;
|
BList fList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ExtraMenuData {
|
class ExtraMenuData {
|
||||||
public:
|
public:
|
||||||
menu_tracking_hook trackingHook;
|
menu_tracking_hook trackingHook;
|
||||||
@@ -1655,7 +1656,9 @@ BMenu::_ComputeLayout(int32 index, bool bestFit, bool moveItems,
|
|||||||
// Recalculate only the needed items,
|
// Recalculate only the needed items,
|
||||||
// not the whole layout every time
|
// not the whole layout every time
|
||||||
|
|
||||||
BRect frame(0, 0, 0, 0);
|
BRect frame(0, 0, 0, 0);
|
||||||
|
if (index > 0)
|
||||||
|
frame = Bounds();
|
||||||
switch (fLayout) {
|
switch (fLayout) {
|
||||||
case B_ITEMS_IN_COLUMN:
|
case B_ITEMS_IN_COLUMN:
|
||||||
_ComputeColumnLayout(index, bestFit, moveItems, frame);
|
_ComputeColumnLayout(index, bestFit, moveItems, frame);
|
||||||
@@ -1710,7 +1713,7 @@ BMenu::_ComputeColumnLayout(int32 index, bool bestFit, bool moveItems,
|
|||||||
bool command = false;
|
bool command = false;
|
||||||
bool control = false;
|
bool control = false;
|
||||||
bool shift = false;
|
bool shift = false;
|
||||||
for (int32 i = 0; i < fItems.CountItems(); i++) {
|
for (int32 i = index; i < fItems.CountItems(); i++) {
|
||||||
BMenuItem *item = ItemAt(i);
|
BMenuItem *item = ItemAt(i);
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
float iWidth, iHeight;
|
float iWidth, iHeight;
|
||||||
@@ -1798,6 +1801,7 @@ BMenu::_ComputeRowLayout(int32 index, bool bestFit, bool moveItems,
|
|||||||
void
|
void
|
||||||
BMenu::_ComputeMatrixLayout(BRect &frame)
|
BMenu::_ComputeMatrixLayout(BRect &frame)
|
||||||
{
|
{
|
||||||
|
frame.Set(0, 0, 0, 0);
|
||||||
for (int32 i = 0; i < CountItems(); i++) {
|
for (int32 i = 0; i < CountItems(); i++) {
|
||||||
BMenuItem *item = ItemAt(i);
|
BMenuItem *item = ItemAt(i);
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user