Some style fixes in MenuItem

This commit is contained in:
John Scipione
2013-05-05 13:12:15 -04:00
parent dff48661fd
commit ddd6037113
+4 -3
View File
@@ -406,15 +406,16 @@ BMenuItem::DrawContent()
float frameWidth = fBounds.Width(); float frameWidth = fBounds.Width();
if (menuPrivate.State() == MENU_STATE_CLOSED) { if (menuPrivate.State() == MENU_STATE_CLOSED) {
float rightMargin, leftMargin; float leftMargin;
float rightMargin;
menuPrivate.GetItemMargins(&leftMargin, NULL, &rightMargin, NULL); menuPrivate.GetItemMargins(&leftMargin, NULL, &rightMargin, NULL);
frameWidth = fSuper->Frame().Width() - (rightMargin + leftMargin); frameWidth = fSuper->Frame().Width() - rightMargin + leftMargin;
} }
// truncate if needed
if (frameWidth >= labelWidth) if (frameWidth >= labelWidth)
fSuper->DrawString(fLabel); fSuper->DrawString(fLabel);
else { else {
// truncate the label to fit
char* truncatedLabel = new char[strlen(fLabel) + 4]; char* truncatedLabel = new char[strlen(fLabel) + 4];
TruncateLabel(frameWidth, truncatedLabel); TruncateLabel(frameWidth, truncatedLabel);
fSuper->DrawString(truncatedLabel); fSuper->DrawString(truncatedLabel);