From Alex von Gluck IV <kallisti5@xxxxxxxxxxx>:
Alex von Gluck IV has uploaded this change for review. (
https://review.haiku-os.org/c/haiku/+/2472 )
Change subject: control_look/borderline: Add a new control_look with bordered
menu items
......................................................................
control_look/borderline: Add a new control_look with bordered menu items
* Looks a bit better with lighter / brighter themes.
---
A src/add-ons/control_look/BorderlineControlLook/BorderlineControlLook.cpp
A src/add-ons/control_look/BorderlineControlLook/BorderlineControlLook.h
A src/add-ons/control_look/BorderlineControlLook/BorderlineControlLook.rdef
A src/add-ons/control_look/BorderlineControlLook/Jamfile
M src/add-ons/control_look/Jamfile
5 files changed, 210 insertions(+), 0 deletions(-)
git pull ssh://git.haiku-os.org:22/haiku refs/changes/72/2472/1
diff --git
a/src/add-ons/control_look/BorderlineControlLook/BorderlineControlLook.cpp
b/src/add-ons/control_look/BorderlineControlLook/BorderlineControlLook.cpp
new file mode 100644
index 0000000..a702529
--- /dev/null
+++ b/src/add-ons/control_look/BorderlineControlLook/BorderlineControlLook.cpp
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2019-2020 Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ * Stephan Aßmus, superstippi@xxxxxx
+ * DarkWyrm, bpmagic@xxxxxxxxxxxxxxx
+ * John Scipione, jscipione@xxxxxxxxx
+ * Clemens Zeidler, haiku@xxxxxxxxxxxxxxxxxx
+ * Alexander von Gluck IV, kallisti5@xxxxxxxxxxx
+ */
+
+
+#include "BorderlineControlLook.h"
+
+#include <algorithm>
+#include <cmath>
+#include <new>
+#include <stdio.h>
+
+#include <WindowPrivate.h>
+
+#include <Autolock.h>
+#include <Debug.h>
+#include <GradientLinear.h>
+#include <Rect.h>
+#include <Region.h>
+#include <View.h>
+
+
+//#define DEBUG_CONTROL_LOOK
+#ifdef DEBUG_CONTROL_LOOK
+# define STRACE(x) printf x
+#else
+# define STRACE(x) ;
+#endif
+
+
+BorderlineControlLook::BorderlineControlLook(image_id id)
+ : HaikuControlLook()
+{
+}
+
+
+BorderlineControlLook::~BorderlineControlLook()
+{
+}
+
+
+void
+BorderlineControlLook::DrawMenuBarBackground(BView* view, BRect& rect,
+ const BRect& updateRect, const rgb_color& base, uint32 flags,
+ uint32 borders)
+{
+ if (!rect.IsValid() || !rect.Intersects(updateRect))
+ return;
+
+ // the surface edges
+
+ // colors
+ float topTint;
+ float bottomTint;
+
+ if ((flags & B_ACTIVATED) != 0) {
+ 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);
+ }
+
+ // draw surface top
+ _FillGradient(view, rect, base, topTint, bottomTint);
+}
+
+
+void
+BorderlineControlLook::DrawMenuItemBackground(BView* view, BRect& rect,
+ const BRect& updateRect, const rgb_color& base, uint32 flags,
+ uint32 borders)
+{
+ if (!rect.IsValid() || !rect.Intersects(updateRect))
+ return;
+
+ // surface edges
+ float topTint;
+ float bottomTint;
+ rgb_color selectedColor = base;
+
+ if ((flags & B_ACTIVATED) != 0) {
+ topTint = 0.8;
+ bottomTint = 1.20;
+ } else if ((flags & B_DISABLED) != 0) {
+ topTint = 0.80;
+ bottomTint = 1.07;
+ } else {
+ topTint = 0.6;
+ bottomTint = 1.12;
+ }
+
+ rgb_color borderColor = tint_color(selectedColor, 1.50);
+ rgb_color bevelLightColor = tint_color(selectedColor, topTint);
+ rgb_color bevelShadowColor = tint_color(selectedColor, bottomTint);
+ rgb_color highlightColor = tint_color(selectedColor, 0.5);
+
+ // draw surface top
+ _FillGradient(view, rect, selectedColor, topTint, bottomTint);
+
+ // draw bevel edges
+ BRect bevel = BRect(rect.left + 1, rect.top + 1,
+ rect.right - 1, rect.bottom - 1);
+ _DrawFrame(view, bevel, bevelLightColor, bevelLightColor,
+ bevelShadowColor, bevelShadowColor, borders);
+
+ // draw surface edges
+ _DrawFrame(view, rect, borderColor, borderColor,
+ borderColor, borderColor, borders);
+
+ view->SetLowColor(selectedColor);
+}
+
+
+extern "C" BControlLook* (instantiate_control_look)(image_id id)
+{
+ return new (std::nothrow)BorderlineControlLook(id);
+}
+
diff --git
a/src/add-ons/control_look/BorderlineControlLook/BorderlineControlLook.h
b/src/add-ons/control_look/BorderlineControlLook/BorderlineControlLook.h
new file mode 100644
index 0000000..9caddc0
--- /dev/null
+++ b/src/add-ons/control_look/BorderlineControlLook/BorderlineControlLook.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2009-2019 Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ * François Revol, revol@xxxxxxx
+ */
+#ifndef BE_CONTROL_LOOK_H
+#define BE_CONTROL_LOOK_H
+
+
+#include <ControlLook.h>
+
+#include "HaikuControlLook.h"
+
+
+class BBitmap;
+class BControl;
+class BGradientLinear;
+class BView;
+
+using BPrivate::HaikuControlLook;
+
+
+class BorderlineControlLook : public HaikuControlLook {
+public:
+
BorderlineControlLook(image_id id);
+ virtual
~BorderlineControlLook();
+
+
+ virtual void DrawMenuBarBackground(BView*
view, BRect& rect,
+ const
BRect& updateRect,
+ const
rgb_color& base,
+ uint32
flags = 0,
+ uint32
borders = B_ALL_BORDERS);
+
+ virtual void DrawMenuItemBackground(BView*
view,
+ BRect&
rect, const BRect& updateRect,
+ const
rgb_color& base, uint32 flags = 0,
+ uint32
borders = B_ALL_BORDERS);
+};
+
+
+#endif // BE_CONTROL_LOOK_H
diff --git
a/src/add-ons/control_look/BorderlineControlLook/BorderlineControlLook.rdef
b/src/add-ons/control_look/BorderlineControlLook/BorderlineControlLook.rdef
new file mode 100644
index 0000000..c747e1b
--- /dev/null
+++ b/src/add-ons/control_look/BorderlineControlLook/BorderlineControlLook.rdef
@@ -0,0 +1,9 @@
+resource app_version {
+ major = 1,
+ middle = 0,
+ minor = 0,
+ variety = B_APPV_ALPHA,
+ internal = 0,
+ short_info = "Borderline Control Look",
+ long_info = "Bolder, sharper borders. ©2019-2020 Haiku, Inc."
+};
diff --git a/src/add-ons/control_look/BorderlineControlLook/Jamfile
b/src/add-ons/control_look/BorderlineControlLook/Jamfile
new file mode 100644
index 0000000..5e023c9
--- /dev/null
+++ b/src/add-ons/control_look/BorderlineControlLook/Jamfile
@@ -0,0 +1,10 @@
+SubDir HAIKU_TOP src add-ons control_look BorderlineControlLook ;
+
+UsePrivateHeaders interface ;
+
+AddResources BorderlineControlLook : BorderlineControlLook.rdef ;
+
+Addon BorderlineControlLook :
+ BorderlineControlLook.cpp
+ : be <nogrist>app_server [ TargetLibstdc++ ] [ TargetLibsupc++ ]
+;
diff --git a/src/add-ons/control_look/Jamfile b/src/add-ons/control_look/Jamfile
index cfe86e9..6c299e2 100644
--- a/src/add-ons/control_look/Jamfile
+++ b/src/add-ons/control_look/Jamfile
@@ -1,4 +1,5 @@
SubDir HAIKU_TOP src add-ons control_look ;
SubInclude HAIKU_TOP src add-ons control_look BeControlLook ;
+SubInclude HAIKU_TOP src add-ons control_look BorderlineControlLook ;
--
To view, visit https://review.haiku-os.org/c/haiku/+/2472
To unsubscribe, or for help writing mail filters, visit
https://review.haiku-os.org/settings
Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: Ia00f702a0647d9f940c2d966dc842f7ebc1ea465
Gerrit-Change-Number: 2472
Gerrit-PatchSet: 1
Gerrit-Owner: Alex von Gluck IV <kallisti5@xxxxxxxxxxx>
Gerrit-MessageType: newchange