From 1a72cb4139bb0b6ae48a09c6dacf64018ceb694f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Wed, 18 Mar 2009 17:18:06 +0000 Subject: [PATCH] Make BMenuBar background drawing more flexible and also support an "activated" state. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29597 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/os/interface/ControlLook.h | 1 + src/kits/interface/ControlLook.cpp | 43 +++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/headers/os/interface/ControlLook.h b/headers/os/interface/ControlLook.h index 3e645102cf..4e6909b1d2 100644 --- a/headers/os/interface/ControlLook.h +++ b/headers/os/interface/ControlLook.h @@ -78,6 +78,7 @@ public: virtual void DrawMenuBarBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, + uint32 flags = 0, uint32 borders = B_ALL_BORDERS); virtual void DrawMenuFieldFrame(BView* view, BRect& rect, diff --git a/src/kits/interface/ControlLook.cpp b/src/kits/interface/ControlLook.cpp index ddfff40a52..c0e06e4f14 100644 --- a/src/kits/interface/ControlLook.cpp +++ b/src/kits/interface/ControlLook.cpp @@ -174,7 +174,8 @@ BControlLook::DrawButtonBackground(BView* view, BRect& rect, void BControlLook::DrawMenuBarBackground(BView* view, BRect& rect, - const BRect& updateRect, const rgb_color& base, uint32 borders) + const BRect& updateRect, const rgb_color& base, uint32 flags, + uint32 borders) { if (!rect.IsValid() || !updateRect.Intersects(rect)) return; @@ -182,22 +183,38 @@ BControlLook::DrawMenuBarBackground(BView* view, BRect& rect, // the surface edges // colors - rgb_color cornerColor = tint_color(base, 0.9); - rgb_color bevelColor1 = tint_color(base, 0.5); - rgb_color bevelColor2 = tint_color(base, 0.7); - rgb_color bevelColor3 = tint_color(base, 1.08); + float topTint; + float bottomTint; - _DrawFrame(view, rect, - bevelColor2, bevelColor1, - bevelColor3, bevelColor3, - cornerColor, cornerColor, - borders); + if (flags & B_ACTIVATED) { + rgb_color bevelColor1 = tint_color(base, 1.40); + rgb_color bevelColor2 = tint_color(base, 1.25); + + topTint = 1.25; + bottomTint = 1.20; + + _DrawFrame(view, rect, + bevelColor1, bevelColor1, + bevelColor2, bevelColor2, + borders & B_TOP_BORDER); + } else { + rgb_color cornerColor = tint_color(base, 0.9); + rgb_color bevelColorTop = tint_color(base, 0.5); + rgb_color bevelColorLeft = tint_color(base, 0.7); + rgb_color bevelColorRightBottom = tint_color(base, 1.08); + + topTint = 0.69; + bottomTint = 1.03; + + _DrawFrame(view, rect, + bevelColorLeft, bevelColorTop, + bevelColorRightBottom, bevelColorRightBottom, + cornerColor, cornerColor, + borders); + } // the actual surface top - float topTint = 0.69; - float bottomTint = 1.03; - _FillGradient(view, rect, base, topTint, bottomTint); }