Cleanups.
Removed code path for be_control_look == NULL. Improve comments.
This commit is contained in:
@@ -362,45 +362,16 @@ BMenuField::Draw(BRect update)
|
|||||||
|
|
||||||
BRect frame(fMenuBar->Frame());
|
BRect frame(fMenuBar->Frame());
|
||||||
|
|
||||||
if (be_control_look != NULL) {
|
frame.InsetBy(-kVMargin, -kVMargin);
|
||||||
frame.InsetBy(-kVMargin, -kVMargin);
|
rgb_color base = fMenuBar->LowColor();
|
||||||
rgb_color base = fMenuBar->LowColor();
|
rgb_color background = LowColor();
|
||||||
rgb_color background = LowColor();
|
uint32 flags = 0;
|
||||||
uint32 flags = 0;
|
if (!fMenuBar->IsEnabled())
|
||||||
if (!fMenuBar->IsEnabled())
|
flags |= BControlLook::B_DISABLED;
|
||||||
flags |= BControlLook::B_DISABLED;
|
if (active)
|
||||||
if (active)
|
flags |= BControlLook::B_FOCUSED;
|
||||||
flags |= BControlLook::B_FOCUSED;
|
be_control_look->DrawMenuFieldFrame(this, frame, update, base,
|
||||||
be_control_look->DrawMenuFieldFrame(this, frame, update, base,
|
background, flags);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -283,9 +283,11 @@ BPopUpMenu::AsyncAutoDestruct() const
|
|||||||
BPoint
|
BPoint
|
||||||
BPopUpMenu::ScreenLocation()
|
BPopUpMenu::ScreenLocation()
|
||||||
{
|
{
|
||||||
|
// This case is when the BPopUpMenu is standalone
|
||||||
if (fUseWhere)
|
if (fUseWhere)
|
||||||
return fWhere;
|
return fWhere;
|
||||||
|
|
||||||
|
// This case is when the BPopUpMenu is inside a BMenuField
|
||||||
BMenuItem* superItem = Superitem();
|
BMenuItem* superItem = Superitem();
|
||||||
BMenu* superMenu = Supermenu();
|
BMenu* superMenu = Supermenu();
|
||||||
BMenuItem* selectedItem = FindItem(superItem->Label());
|
BMenuItem* selectedItem = FindItem(superItem->Label());
|
||||||
@@ -421,11 +423,10 @@ BMenuItem*
|
|||||||
BPopUpMenu::_StartTrack(BPoint where, bool autoInvoke, bool startOpened,
|
BPopUpMenu::_StartTrack(BPoint where, bool autoInvoke, bool startOpened,
|
||||||
BRect* _specialRect)
|
BRect* _specialRect)
|
||||||
{
|
{
|
||||||
fWhere = where;
|
|
||||||
|
|
||||||
// I know, this doesn't look senseful, but don't be fooled,
|
// I know, this doesn't look senseful, but don't be fooled,
|
||||||
// fUseWhere is used in ScreenLocation(), which is a virtual
|
// fUseWhere is used in ScreenLocation(), which is a virtual
|
||||||
// called by BMenu::Track()
|
// called by BMenu::Track()
|
||||||
|
fWhere = where;
|
||||||
fUseWhere = true;
|
fUseWhere = true;
|
||||||
|
|
||||||
// Determine when mouse-down-up will be taken as a 'press',
|
// Determine when mouse-down-up will be taken as a 'press',
|
||||||
|
|||||||
Reference in New Issue
Block a user