From fdfeaa4eec63d2259c6232cbaa0105f27ff60a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 25 Mar 2009 10:52:01 +0000 Subject: [PATCH] Small code simplifications. No functional change. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29690 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Menu.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index b7684ef2fd..d58828d2f6 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -2029,7 +2029,7 @@ BMenu::_ComputeColumnLayout(int32 index, bool bestFit, bool moveItems, if (index > 0) frame = ItemAt(index - 1)->Frame(); else - frame.Set(0, 0, 0, 0); + frame.Set(0, 0, 0, -1); for (; index < fItems.CountItems(); index++) { BMenuItem *item = ItemAt(index); @@ -2048,7 +2048,7 @@ BMenu::_ComputeColumnLayout(int32 index, bool bestFit, bool moveItems, } item->fBounds.left = 0.0f; - item->fBounds.top = frame.bottom + (index > 0 ? 1.0f : 0.0f); + item->fBounds.top = frame.bottom + 1.0f; item->fBounds.bottom = item->fBounds.top + height + fPad.top + fPad.bottom; @@ -2090,18 +2090,17 @@ BMenu::_ComputeRowLayout(int32 index, bool bestFit, bool moveItems, for (int32 i = 0; i < fItems.CountItems(); i++) { BMenuItem *item = ItemAt(i); + float width, height; - if (item != NULL) { - item->GetContentSize(&width, &height); + item->GetContentSize(&width, &height); - item->fBounds.left = frame.right; - item->fBounds.top = 0.0f; - item->fBounds.right = item->fBounds.left + width + fPad.left - + fPad.right; + item->fBounds.left = frame.right; + item->fBounds.top = 0.0f; + item->fBounds.right = item->fBounds.left + width + fPad.left + + fPad.right; - frame.right = item->Frame().right + 1.0f; - frame.bottom = max_c(frame.bottom, height + fPad.top + fPad.bottom); - } + frame.right = item->Frame().right + 1.0f; + frame.bottom = max_c(frame.bottom, height + fPad.top + fPad.bottom); } if (moveItems) {