* setting a different menu color with the menu preflet gives now visually
agreeable results (I hope) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21967 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -146,7 +146,7 @@ _BMCMenuBar_::Draw(BRect updateRect)
|
|||||||
bounds.bottom += 1.0;
|
bounds.bottom += 1.0;
|
||||||
|
|
||||||
// prepare some colors
|
// prepare some colors
|
||||||
rgb_color normalNoTint = ui_color(B_MENU_BACKGROUND_COLOR);
|
rgb_color normalNoTint = LowColor();
|
||||||
rgb_color noTint = tint_color(normalNoTint, 0.74);
|
rgb_color noTint = tint_color(normalNoTint, 0.74);
|
||||||
rgb_color darken4;
|
rgb_color darken4;
|
||||||
rgb_color normalDarken4;
|
rgb_color normalDarken4;
|
||||||
|
|||||||
@@ -152,15 +152,17 @@ BMenuBar::Draw(BRect updateRect)
|
|||||||
// Restore the background of the previously selected menuitem
|
// Restore the background of the previously selected menuitem
|
||||||
DrawBackground(bounds & updateRect);
|
DrawBackground(bounds & updateRect);
|
||||||
|
|
||||||
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_LIGHTEN_2_TINT));
|
rgb_color noTint = LowColor();
|
||||||
|
|
||||||
|
SetHighColor(tint_color(noTint, B_LIGHTEN_2_TINT));
|
||||||
StrokeLine(BPoint(0.0f, bounds.bottom - 2.0f), BPoint(0.0f, 0.0f));
|
StrokeLine(BPoint(0.0f, bounds.bottom - 2.0f), BPoint(0.0f, 0.0f));
|
||||||
StrokeLine(BPoint(bounds.right, 0.0f));
|
StrokeLine(BPoint(bounds.right, 0.0f));
|
||||||
|
|
||||||
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_1_TINT));
|
SetHighColor(tint_color(noTint, B_DARKEN_1_TINT));
|
||||||
StrokeLine(BPoint(1.0f, bounds.bottom - 1.0f),
|
StrokeLine(BPoint(1.0f, bounds.bottom - 1.0f),
|
||||||
BPoint(bounds.right, bounds.bottom - 1.0f));
|
BPoint(bounds.right, bounds.bottom - 1.0f));
|
||||||
|
|
||||||
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT));
|
SetHighColor(tint_color(noTint, B_DARKEN_2_TINT));
|
||||||
StrokeLine(BPoint(0.0f, bounds.bottom), BPoint(bounds.right, bounds.bottom));
|
StrokeLine(BPoint(0.0f, bounds.bottom), BPoint(bounds.right, bounds.bottom));
|
||||||
StrokeLine(BPoint(bounds.right, 0.0f), BPoint(bounds.right, bounds.bottom));
|
StrokeLine(BPoint(bounds.right, 0.0f), BPoint(bounds.right, bounds.bottom));
|
||||||
|
|
||||||
|
|||||||
@@ -442,12 +442,17 @@ BMenuItem::Draw()
|
|||||||
bool enabled = IsEnabled();
|
bool enabled = IsEnabled();
|
||||||
bool selected = IsSelected();
|
bool selected = IsSelected();
|
||||||
|
|
||||||
rgb_color noTint = ui_color(B_MENU_BACKGROUND_COLOR);
|
// rgb_color noTint = ui_color(B_MENU_BACKGROUND_COLOR);
|
||||||
|
// TODO: the above is currently broken, because ui_color is
|
||||||
|
// not informed of changes to the app_server palette yet
|
||||||
|
rgb_color noTint = fSuper->LowColor();
|
||||||
rgb_color bgColor = noTint;
|
rgb_color bgColor = noTint;
|
||||||
|
|
||||||
// set low color and fill background if selected
|
// set low color and fill background if selected
|
||||||
if (selected && (enabled || Submenu()) /*&& fSuper->fRedrawAfterSticky*/) {
|
if (selected && (enabled || Submenu()) /*&& fSuper->fRedrawAfterSticky*/) {
|
||||||
bgColor = ui_color(B_MENU_SELECTED_BACKGROUND_COLOR);
|
// bgColor = ui_color(B_MENU_SELECTED_BACKGROUND_COLOR);
|
||||||
|
// see above
|
||||||
|
bgColor = tint_color(bgColor, B_DARKEN_3_TINT);
|
||||||
fSuper->SetLowColor(bgColor);
|
fSuper->SetLowColor(bgColor);
|
||||||
fSuper->FillRect(Frame(), B_SOLID_LOW);
|
fSuper->FillRect(Frame(), B_SOLID_LOW);
|
||||||
} else
|
} else
|
||||||
@@ -478,6 +483,8 @@ BMenuItem::Draw()
|
|||||||
if (Submenu())
|
if (Submenu())
|
||||||
_DrawSubmenuSymbol(bgColor);
|
_DrawSubmenuSymbol(bgColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fSuper->SetLowColor(noTint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -699,7 +706,7 @@ BMenuItem::_DrawShortcutSymbol()
|
|||||||
BFont font;
|
BFont font;
|
||||||
menu->GetFont(&font);
|
menu->GetFont(&font);
|
||||||
BPoint where = ContentLocation();
|
BPoint where = ContentLocation();
|
||||||
where.x = fBounds.right - font.Size();
|
where.x = fBounds.right - font.Size();
|
||||||
if (menu->fSubmenus)
|
if (menu->fSubmenus)
|
||||||
where.x -= fBounds.Height() - 4;
|
where.x -= fBounds.Height() - 4;
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <SeparatorItem.h>
|
#include <SeparatorItem.h>
|
||||||
|
#include <Font.h>
|
||||||
|
|
||||||
|
|
||||||
BSeparatorItem::BSeparatorItem()
|
BSeparatorItem::BSeparatorItem()
|
||||||
@@ -61,10 +62,14 @@ void
|
|||||||
BSeparatorItem::GetContentSize(float* _width, float* _height)
|
BSeparatorItem::GetContentSize(float* _width, float* _height)
|
||||||
{
|
{
|
||||||
if (_width != NULL)
|
if (_width != NULL)
|
||||||
*_width = 2.0f;
|
*_width = 2.0;
|
||||||
|
|
||||||
if (_height != NULL)
|
if (_height != NULL) {
|
||||||
*_height = 8.0f;
|
BFont font(be_plain_font);
|
||||||
|
if (Menu())
|
||||||
|
Menu()->GetFont(&font);
|
||||||
|
*_height = floorf(font.Size() * 0.8);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -77,11 +82,14 @@ BSeparatorItem::Draw()
|
|||||||
|
|
||||||
BRect bounds = Frame();
|
BRect bounds = Frame();
|
||||||
rgb_color oldColor = menu->HighColor();
|
rgb_color oldColor = menu->HighColor();
|
||||||
|
rgb_color lowColor = menu->LowColor();
|
||||||
|
|
||||||
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_1_TINT));
|
menu->SetHighColor(tint_color(lowColor, B_DARKEN_1_TINT));
|
||||||
menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 4.0f), BPoint(bounds.right - 1.0f, bounds.top + 4.0f));
|
menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 4.0f),
|
||||||
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_LIGHTEN_2_TINT));
|
BPoint(bounds.right - 1.0f, bounds.top + 4.0f));
|
||||||
menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 5.0f), BPoint(bounds.right - 1.0f, bounds.top + 5.0f));
|
menu->SetHighColor(tint_color(lowColor, B_LIGHTEN_2_TINT));
|
||||||
|
menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 5.0f),
|
||||||
|
BPoint(bounds.right - 1.0f, bounds.top + 5.0f));
|
||||||
|
|
||||||
menu->SetHighColor(oldColor);
|
menu->SetHighColor(oldColor);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user