Cleanups.

Removed code path for be_control_look == NULL.
Improve comments.
This commit is contained in:
Stefano Ceccherini 2013-05-02 20:59:56 +02:00
parent ca4f3ba33c
commit bb16974758
2 changed files with 13 additions and 41 deletions

View File

@ -362,45 +362,16 @@ BMenuField::Draw(BRect update)
BRect frame(fMenuBar->Frame());
if (be_control_look != NULL) {
frame.InsetBy(-kVMargin, -kVMargin);
rgb_color base = fMenuBar->LowColor();
rgb_color background = LowColor();
uint32 flags = 0;
if (!fMenuBar->IsEnabled())
flags |= BControlLook::B_DISABLED;
if (active)
flags |= BControlLook::B_FOCUSED;
be_control_look->DrawMenuFieldFrame(this, frame, update, base,
background, flags);
return;
}
if (frame.InsetByCopy(-kVMargin, -kVMargin).Intersects(update)) {
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT));
StrokeLine(BPoint(frame.left - 1.0f, frame.top - 1.0f),
BPoint(frame.left - 1.0f, frame.bottom - 1.0f));
StrokeLine(BPoint(frame.left - 1.0f, frame.top - 1.0f),
BPoint(frame.right - 1.0f, frame.top - 1.0f));
StrokeLine(BPoint(frame.left + 1.0f, frame.bottom + 1.0f),
BPoint(frame.right + 1.0f, frame.bottom + 1.0f));
StrokeLine(BPoint(frame.right + 1.0f, frame.top + 1.0f));
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_4_TINT));
StrokeLine(BPoint(frame.left - 1.0f, frame.bottom),
BPoint(frame.left - 1.0f, frame.bottom));
StrokeLine(BPoint(frame.right, frame.top - 1.0f),
BPoint(frame.right, frame.top - 1.0f));
}
if (active || fTransition) {
SetHighColor(active ? ui_color(B_KEYBOARD_NAVIGATION_COLOR) :
ViewColor());
StrokeRect(frame.InsetByCopy(-kVMargin, -kVMargin));
fTransition = false;
}
frame.InsetBy(-kVMargin, -kVMargin);
rgb_color base = fMenuBar->LowColor();
rgb_color background = LowColor();
uint32 flags = 0;
if (!fMenuBar->IsEnabled())
flags |= BControlLook::B_DISABLED;
if (active)
flags |= BControlLook::B_FOCUSED;
be_control_look->DrawMenuFieldFrame(this, frame, update, base,
background, flags);
}

View File

@ -283,9 +283,11 @@ BPopUpMenu::AsyncAutoDestruct() const
BPoint
BPopUpMenu::ScreenLocation()
{
// This case is when the BPopUpMenu is standalone
if (fUseWhere)
return fWhere;
// This case is when the BPopUpMenu is inside a BMenuField
BMenuItem* superItem = Superitem();
BMenu* superMenu = Supermenu();
BMenuItem* selectedItem = FindItem(superItem->Label());
@ -421,11 +423,10 @@ BMenuItem*
BPopUpMenu::_StartTrack(BPoint where, bool autoInvoke, bool startOpened,
BRect* _specialRect)
{
fWhere = where;
// I know, this doesn't look senseful, but don't be fooled,
// fUseWhere is used in ScreenLocation(), which is a virtual
// called by BMenu::Track()
fWhere = where;
fUseWhere = true;
// Determine when mouse-down-up will be taken as a 'press',