Add a BeControlLook addon
Very simple for now, just reuses the Haiku one with some gradients removed. Add it to the haiku_extras package. Change-Id: I41729ed65b147fed72bf56e7c5c89367b75563bb Reviewed-on: https://review.haiku-os.org/c/1431 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
629397f222
commit
26b5a18eb0
@@ -7,5 +7,7 @@ HaikuPackage $(extrasPackage) ;
|
|||||||
AddFilesToPackage add-ons kernel partitioning_systems
|
AddFilesToPackage add-ons kernel partitioning_systems
|
||||||
: amiga_rdb@!m68k apple@!ppc ;
|
: amiga_rdb@!m68k apple@!ppc ;
|
||||||
|
|
||||||
|
AddFilesToPackage add-ons control_look : BeControlLook ;
|
||||||
|
|
||||||
BuildHaikuPackage $(extrasPackage) : haiku_extras ;
|
BuildHaikuPackage $(extrasPackage) : haiku_extras ;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
SubDir HAIKU_TOP src add-ons ;
|
SubDir HAIKU_TOP src add-ons ;
|
||||||
|
|
||||||
SubInclude HAIKU_TOP src add-ons accelerants ;
|
SubInclude HAIKU_TOP src add-ons accelerants ;
|
||||||
|
SubInclude HAIKU_TOP src add-ons control_look ;
|
||||||
SubInclude HAIKU_TOP src add-ons decorators ;
|
SubInclude HAIKU_TOP src add-ons decorators ;
|
||||||
SubInclude HAIKU_TOP src add-ons disk_systems ;
|
SubInclude HAIKU_TOP src add-ons disk_systems ;
|
||||||
SubInclude HAIKU_TOP src add-ons index_server ;
|
SubInclude HAIKU_TOP src add-ons index_server ;
|
||||||
|
|||||||
@@ -0,0 +1,144 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2019 Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Stephan Aßmus, [email protected]
|
||||||
|
* DarkWyrm, [email protected]
|
||||||
|
* John Scipione, [email protected]
|
||||||
|
* Clemens Zeidler, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*! BControlLook resembling BeOS R5 */
|
||||||
|
|
||||||
|
|
||||||
|
#include "BeControlLook.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
|
||||||
|
|
||||||
|
|
||||||
|
BeControlLook::BeControlLook(image_id id)
|
||||||
|
: HaikuControlLook()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BeControlLook::~BeControlLook()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BeControlLook::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);
|
||||||
|
view->SetLowColor(base);
|
||||||
|
view->FillRect(rect, B_SOLID_LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BeControlLook::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.9;
|
||||||
|
bottomTint = 1.05;
|
||||||
|
} else if ((flags & B_DISABLED) != 0) {
|
||||||
|
topTint = 0.80;
|
||||||
|
bottomTint = 1.07;
|
||||||
|
} else {
|
||||||
|
topTint = 0.6;
|
||||||
|
bottomTint = 1.12;
|
||||||
|
}
|
||||||
|
|
||||||
|
rgb_color bevelLightColor = tint_color(selectedColor, topTint);
|
||||||
|
rgb_color bevelShadowColor = tint_color(selectedColor, bottomTint);
|
||||||
|
|
||||||
|
// draw surface edges
|
||||||
|
_DrawFrame(view, rect,
|
||||||
|
bevelLightColor, bevelLightColor,
|
||||||
|
bevelShadowColor, bevelShadowColor,
|
||||||
|
borders);
|
||||||
|
|
||||||
|
// draw surface top
|
||||||
|
view->SetLowColor(selectedColor);
|
||||||
|
//_FillGradient(view, rect, selectedColor, topTint, bottomTint);
|
||||||
|
view->FillRect(rect, B_SOLID_LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" BControlLook* (instantiate_control_look)(image_id id)
|
||||||
|
{
|
||||||
|
return new (std::nothrow)BeControlLook(id);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009-2019 Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* François Revol, [email protected]
|
||||||
|
*/
|
||||||
|
#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 BeControlLook : public HaikuControlLook {
|
||||||
|
public:
|
||||||
|
BeControlLook(image_id id);
|
||||||
|
virtual ~BeControlLook();
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
resource app_version {
|
||||||
|
major = 1,
|
||||||
|
middle = 0,
|
||||||
|
minor = 0,
|
||||||
|
variety = B_APPV_ALPHA,
|
||||||
|
internal = 0,
|
||||||
|
short_info = "Be Control Look",
|
||||||
|
long_info = "BeOS-like Control Look add-on ©2019 Haiku, Inc."
|
||||||
|
};
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
SubDir HAIKU_TOP src add-ons control_look BeControlLook ;
|
||||||
|
|
||||||
|
UsePrivateHeaders interface ;
|
||||||
|
|
||||||
|
AddResources BeControlLook : BeControlLook.rdef ;
|
||||||
|
|
||||||
|
Addon BeControlLook :
|
||||||
|
BeControlLook.cpp
|
||||||
|
: be <nogrist>app_server [ TargetLibstdc++ ] [ TargetLibsupc++ ]
|
||||||
|
;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
SubDir HAIKU_TOP src add-ons control_look ;
|
||||||
|
|
||||||
|
SubInclude HAIKU_TOP src add-ons control_look BeControlLook ;
|
||||||
|
|
||||||
Reference in New Issue
Block a user