* 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:
Stephan Aßmus
2007-08-15 20:38:29 +00:00
parent 91d0586a7d
commit bd57c145be
4 changed files with 31 additions and 14 deletions
+1 -1
View File
@@ -146,7 +146,7 @@ _BMCMenuBar_::Draw(BRect updateRect)
bounds.bottom += 1.0;
// 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 darken4;
rgb_color normalDarken4;
+5 -3
View File
@@ -152,15 +152,17 @@ BMenuBar::Draw(BRect updateRect)
// Restore the background of the previously selected menuitem
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(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),
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(bounds.right, 0.0f), BPoint(bounds.right, bounds.bottom));
+10 -3
View File
@@ -442,12 +442,17 @@ BMenuItem::Draw()
bool enabled = IsEnabled();
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;
// set low color and fill background if selected
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->FillRect(Frame(), B_SOLID_LOW);
} else
@@ -478,6 +483,8 @@ BMenuItem::Draw()
if (Submenu())
_DrawSubmenuSymbol(bgColor);
}
fSuper->SetLowColor(noTint);
}
@@ -699,7 +706,7 @@ BMenuItem::_DrawShortcutSymbol()
BFont font;
menu->GetFont(&font);
BPoint where = ContentLocation();
where.x = fBounds.right - font.Size();
where.x = fBounds.right - font.Size();
if (menu->fSubmenus)
where.x -= fBounds.Height() - 4;
+15 -7
View File
@@ -12,6 +12,7 @@
#include <SeparatorItem.h>
#include <Font.h>
BSeparatorItem::BSeparatorItem()
@@ -61,10 +62,14 @@ void
BSeparatorItem::GetContentSize(float* _width, float* _height)
{
if (_width != NULL)
*_width = 2.0f;
*_width = 2.0;
if (_height != NULL)
*_height = 8.0f;
if (_height != NULL) {
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();
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->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 4.0f), BPoint(bounds.right - 1.0f, bounds.top + 4.0f));
menu->SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), 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(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->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);
}