Refactor _BMCMenuBar_::Draw a bit

Move the comments around, expand on them and an 80 char fix.
This commit is contained in:
John Scipione 2013-05-26 01:48:53 -04:00
parent 9af9f5150d
commit f7c092f5db
1 changed files with 12 additions and 7 deletions

View File

@ -139,17 +139,22 @@ _BMCMenuBar_::AttachedToWindow()
void void
_BMCMenuBar_::Draw(BRect updateRect) _BMCMenuBar_::Draw(BRect updateRect)
{ {
// Set the width of the menu bar because the menu bar bounds may have if (fFixedSize) {
// been expanded by the selected menu item. // Set the width of the menu bar because the menu bar bounds may have
if (fFixedSize) // been expanded by the selected menu item.
ResizeTo(fMenuField->_MenuBarWidth(), Bounds().Height()); ResizeTo(fMenuField->_MenuBarWidth(), Bounds().Height());
else { } else {
// For compatability with BeOS R5 set the height to the preferred height // For compatability with BeOS R5:
// in auto-size mode ignoring the height of the menu field. // - Set to the minimum of the menu bar width set by the menu frame
// and the selected menu item width.
// - Set the height to the preferred height ignoring the height of the
// menu field.
float height; float height;
BMenuBar::GetPreferredSize(NULL, &height); BMenuBar::GetPreferredSize(NULL, &height);
ResizeTo(std::min(Bounds().Width(), fMenuField->_MenuBarWidth()), height); ResizeTo(std::min(Bounds().Width(), fMenuField->_MenuBarWidth()),
height);
} }
BRect rect(Bounds()); BRect rect(Bounds());
rgb_color base = ui_color(B_MENU_BACKGROUND_COLOR); rgb_color base = ui_color(B_MENU_BACKGROUND_COLOR);
uint32 flags = 0; uint32 flags = 0;