Added support for buttons and menuframes with rounded corners.
* Not turned on for default buttons and menuframes right now.
* Updated Deskcalc and Keymap to use buttons with rounded corners.
* Overloaded methods with radium parameters are not virtual right
now so as to not break vtables. Added /*virtual*/ before each
method that should be made virtual in ControlLook.h
* Added a light line to the left border of the down arrow frame
on menu frames as a small visual tweak.
* Replace StrokeRect() with StrokeRoundRect() when drawing the
default button indicator. This gives them a rounded
appearance if the button is also rounded.
* Added protected methods _DrawMenuFieldBackgroundOutside and
_DrawMenuFieldBackgroundInside.
* Created some protected methods to get the edge, frame, and bevel
colors from a passed in base color because it was a mess and I
needed to calculate the colors from mutiple methods. It is much
cleaner now.
* Added myself to ControlLook.cpp authors list. Assigned copyright
to Haiku, Inc. Stippi also retains his copyright.
* Tons of style fixes.
- Change all instances of `if (flags & B_FLAG)` to
`if ((flags & B_FLAG) != 0)`
- Reorder some methods.
- Reorder includes.
- Spacing.
- Updated comments.
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2009, Haiku, Inc. All rights reserved.
|
* Copyright 2009-2012, Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _CONTROL_LOOK_H
|
#ifndef _CONTROL_LOOK_H
|
||||||
#define _CONTROL_LOOK_H
|
#define _CONTROL_LOOK_H
|
||||||
|
|
||||||
|
|
||||||
#include <Alignment.h>
|
#include <Alignment.h>
|
||||||
#include <Font.h>
|
#include <Font.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
@@ -78,12 +79,12 @@ public:
|
|||||||
virtual BAlignment DefaultLabelAlignment() const;
|
virtual BAlignment DefaultLabelAlignment() const;
|
||||||
virtual float DefaultLabelSpacing() const;
|
virtual float DefaultLabelSpacing() const;
|
||||||
|
|
||||||
/* TODO: virtual*/
|
// TODO: Make methods virtual before R1 release
|
||||||
float DefaultItemSpacing() const;
|
/*virtual*/ float DefaultItemSpacing() const;
|
||||||
|
|
||||||
static float ComposeSpacing(float spacing);
|
static float ComposeSpacing(float spacing);
|
||||||
|
|
||||||
uint32 Flags(BControl* control) const;
|
/*virtual*/ uint32 Flags(BControl* control) const;
|
||||||
|
|
||||||
virtual void DrawButtonFrame(BView* view, BRect& rect,
|
virtual void DrawButtonFrame(BView* view, BRect& rect,
|
||||||
const BRect& updateRect,
|
const BRect& updateRect,
|
||||||
@@ -91,6 +92,23 @@ public:
|
|||||||
const rgb_color& background,
|
const rgb_color& background,
|
||||||
uint32 flags = 0,
|
uint32 flags = 0,
|
||||||
uint32 borders = B_ALL_BORDERS);
|
uint32 borders = B_ALL_BORDERS);
|
||||||
|
/*virtual*/ void DrawButtonFrame(BView* view, BRect& rect,
|
||||||
|
const BRect& updateRect,
|
||||||
|
float radius,
|
||||||
|
const rgb_color& base,
|
||||||
|
const rgb_color& background,
|
||||||
|
uint32 flags = 0,
|
||||||
|
uint32 borders = B_ALL_BORDERS);
|
||||||
|
/*virtual*/ void DrawButtonFrame(BView* view, BRect& rect,
|
||||||
|
const BRect& updateRect,
|
||||||
|
float leftTopRadius,
|
||||||
|
float rightTopRadius,
|
||||||
|
float leftBottomRadius,
|
||||||
|
float rightBottomRadius,
|
||||||
|
const rgb_color& base,
|
||||||
|
const rgb_color& background,
|
||||||
|
uint32 flags = 0,
|
||||||
|
uint32 borders = B_ALL_BORDERS);
|
||||||
|
|
||||||
virtual void DrawButtonBackground(BView* view, BRect& rect,
|
virtual void DrawButtonBackground(BView* view, BRect& rect,
|
||||||
const BRect& updateRect,
|
const BRect& updateRect,
|
||||||
@@ -99,6 +117,25 @@ public:
|
|||||||
uint32 borders = B_ALL_BORDERS,
|
uint32 borders = B_ALL_BORDERS,
|
||||||
enum orientation orientation
|
enum orientation orientation
|
||||||
= B_HORIZONTAL);
|
= B_HORIZONTAL);
|
||||||
|
/*virtual*/ void DrawButtonBackground(BView* view, BRect& rect,
|
||||||
|
const BRect& updateRect,
|
||||||
|
float radius,
|
||||||
|
const rgb_color& base,
|
||||||
|
uint32 flags = 0,
|
||||||
|
uint32 borders = B_ALL_BORDERS,
|
||||||
|
enum orientation orientation
|
||||||
|
= B_HORIZONTAL);
|
||||||
|
/*virtual*/ void DrawButtonBackground(BView* view, BRect& rect,
|
||||||
|
const BRect& updateRect,
|
||||||
|
float leftTopRadius,
|
||||||
|
float rightTopRadius,
|
||||||
|
float leftBottomRadius,
|
||||||
|
float rightBottomRadius,
|
||||||
|
const rgb_color& base,
|
||||||
|
uint32 flags = 0,
|
||||||
|
uint32 borders = B_ALL_BORDERS,
|
||||||
|
enum orientation orientation
|
||||||
|
= B_HORIZONTAL);
|
||||||
|
|
||||||
virtual void DrawMenuBarBackground(BView* view, BRect& rect,
|
virtual void DrawMenuBarBackground(BView* view, BRect& rect,
|
||||||
const BRect& updateRect,
|
const BRect& updateRect,
|
||||||
@@ -112,12 +149,40 @@ public:
|
|||||||
const rgb_color& background,
|
const rgb_color& background,
|
||||||
uint32 flags = 0,
|
uint32 flags = 0,
|
||||||
uint32 borders = B_ALL_BORDERS);
|
uint32 borders = B_ALL_BORDERS);
|
||||||
|
/*virtual*/ void DrawMenuFieldFrame(BView* view, BRect& rect,
|
||||||
|
const BRect& updateRect,
|
||||||
|
float radius,
|
||||||
|
const rgb_color& base,
|
||||||
|
const rgb_color& background,
|
||||||
|
uint32 flags = 0,
|
||||||
|
uint32 borders = B_ALL_BORDERS);
|
||||||
|
/*virtual*/ void DrawMenuFieldFrame(BView* view, BRect& rect,
|
||||||
|
const BRect& updateRect,
|
||||||
|
float leftTopRadius,
|
||||||
|
float rightTopRadius,
|
||||||
|
float leftBottomRadius,
|
||||||
|
float rightBottomRadius,
|
||||||
|
const rgb_color& base,
|
||||||
|
const rgb_color& background,
|
||||||
|
uint32 flags = 0,
|
||||||
|
uint32 borders = B_ALL_BORDERS);
|
||||||
|
|
||||||
virtual void DrawMenuFieldBackground(BView* view,
|
virtual void DrawMenuFieldBackground(BView* view,
|
||||||
BRect& rect, const BRect& updateRect,
|
BRect& rect, const BRect& updateRect,
|
||||||
const rgb_color& base, bool popupIndicator,
|
const rgb_color& base, bool popupIndicator,
|
||||||
uint32 flags = 0);
|
uint32 flags = 0);
|
||||||
|
/*virtual*/ void DrawMenuFieldBackground(BView* view,
|
||||||
|
BRect& rect, const BRect& updateRect,
|
||||||
|
float radius, const rgb_color& base,
|
||||||
|
bool popupIndicator, uint32 flags = 0);
|
||||||
|
/*virtual*/ void DrawMenuFieldBackground(BView* view,
|
||||||
|
BRect& rect, const BRect& updateRect,
|
||||||
|
float leftTopRadius,
|
||||||
|
float rightTopRadius,
|
||||||
|
float leftBottomRadius,
|
||||||
|
float rightBottomRadius,
|
||||||
|
const rgb_color& base,
|
||||||
|
bool popupIndicator, uint32 flags = 0);
|
||||||
virtual void DrawMenuFieldBackground(BView* view,
|
virtual void DrawMenuFieldBackground(BView* view,
|
||||||
BRect& rect, const BRect& updateRect,
|
BRect& rect, const BRect& updateRect,
|
||||||
const rgb_color& base, uint32 flags = 0,
|
const rgb_color& base, uint32 flags = 0,
|
||||||
@@ -154,14 +219,12 @@ public:
|
|||||||
const BRect& updateRect,
|
const BRect& updateRect,
|
||||||
const rgb_color& base, uint32 flags,
|
const rgb_color& base, uint32 flags,
|
||||||
enum orientation orientation);
|
enum orientation orientation);
|
||||||
|
|
||||||
virtual void DrawScrollBarBackground(BView* view,
|
virtual void DrawScrollBarBackground(BView* view,
|
||||||
BRect& rect, const BRect& updateRect,
|
BRect& rect, const BRect& updateRect,
|
||||||
const rgb_color& base, uint32 flags,
|
const rgb_color& base, uint32 flags,
|
||||||
enum orientation orientation);
|
enum orientation orientation);
|
||||||
|
|
||||||
// TODO: Make all these virtual before R1 release
|
/*virtual*/ void DrawScrollViewFrame(BView* view,
|
||||||
void DrawScrollViewFrame(BView* view,
|
|
||||||
BRect& rect, const BRect& updateRect,
|
BRect& rect, const BRect& updateRect,
|
||||||
BRect verticalScrollBarFrame,
|
BRect verticalScrollBarFrame,
|
||||||
BRect horizontalScrollBarFrame,
|
BRect horizontalScrollBarFrame,
|
||||||
@@ -170,7 +233,7 @@ public:
|
|||||||
uint32 flags = 0,
|
uint32 flags = 0,
|
||||||
uint32 borders = B_ALL_BORDERS);
|
uint32 borders = B_ALL_BORDERS);
|
||||||
|
|
||||||
void DrawArrowShape(BView* view,
|
/*virtual*/ void DrawArrowShape(BView* view,
|
||||||
BRect& rect, const BRect& updateRect,
|
BRect& rect, const BRect& updateRect,
|
||||||
const rgb_color& base, uint32 direction,
|
const rgb_color& base, uint32 direction,
|
||||||
uint32 flags = 0,
|
uint32 flags = 0,
|
||||||
@@ -185,7 +248,6 @@ public:
|
|||||||
rgb_color rightFillColor,
|
rgb_color rightFillColor,
|
||||||
float sliderScale, uint32 flags,
|
float sliderScale, uint32 flags,
|
||||||
enum orientation orientation);
|
enum orientation orientation);
|
||||||
|
|
||||||
virtual void DrawSliderBar(BView* view, BRect rect,
|
virtual void DrawSliderBar(BView* view, BRect rect,
|
||||||
const BRect& updateRect,
|
const BRect& updateRect,
|
||||||
const rgb_color& base, rgb_color fillColor,
|
const rgb_color& base, rgb_color fillColor,
|
||||||
@@ -196,11 +258,10 @@ public:
|
|||||||
const rgb_color& base, uint32 flags,
|
const rgb_color& base, uint32 flags,
|
||||||
enum orientation orientation);
|
enum orientation orientation);
|
||||||
|
|
||||||
void DrawSliderTriangle(BView* view, BRect& rect,
|
/*virtual*/ void DrawSliderTriangle(BView* view, BRect& rect,
|
||||||
const BRect& updateRect,
|
const BRect& updateRect,
|
||||||
const rgb_color& base, uint32 flags,
|
const rgb_color& base, uint32 flags,
|
||||||
enum orientation orientation);
|
enum orientation orientation);
|
||||||
|
|
||||||
virtual void DrawSliderTriangle(BView* view, BRect& rect,
|
virtual void DrawSliderTriangle(BView* view, BRect& rect,
|
||||||
const BRect& updateRect,
|
const BRect& updateRect,
|
||||||
const rgb_color& base,
|
const rgb_color& base,
|
||||||
@@ -255,20 +316,17 @@ public:
|
|||||||
|
|
||||||
// aligned labels
|
// aligned labels
|
||||||
|
|
||||||
void DrawLabel(BView* view, const char* label,
|
/*virtual*/ void DrawLabel(BView* view, const char* label,
|
||||||
BRect rect, const BRect& updateRect,
|
BRect rect, const BRect& updateRect,
|
||||||
const rgb_color& base, uint32 flags);
|
const rgb_color& base, uint32 flags);
|
||||||
|
|
||||||
virtual void DrawLabel(BView* view, const char* label,
|
virtual void DrawLabel(BView* view, const char* label,
|
||||||
BRect rect, const BRect& updateRect,
|
BRect rect, const BRect& updateRect,
|
||||||
const rgb_color& base, uint32 flags,
|
const rgb_color& base, uint32 flags,
|
||||||
const BAlignment& alignment);
|
const BAlignment& alignment);
|
||||||
|
|
||||||
// TODO: This should also be virtual
|
|
||||||
// TODO: Would be nice to have a (non-virtual) version of this method
|
// TODO: Would be nice to have a (non-virtual) version of this method
|
||||||
// which takes an array of labels and locations. That would save some
|
// which takes an array of labels and locations. That would save some
|
||||||
// setup with the view graphics state.
|
// setup with the view graphics state.
|
||||||
void DrawLabel(BView* view, const char* label,
|
/*virtual*/ void DrawLabel(BView* view, const char* label,
|
||||||
const rgb_color& base, uint32 flags,
|
const rgb_color& base, uint32 flags,
|
||||||
const BPoint& where);
|
const BPoint& where);
|
||||||
|
|
||||||
@@ -278,6 +336,10 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void _DrawButtonFrame(BView* view, BRect& rect,
|
void _DrawButtonFrame(BView* view, BRect& rect,
|
||||||
const BRect& updateRect,
|
const BRect& updateRect,
|
||||||
|
float leftTopRadius,
|
||||||
|
float rightTopRadius,
|
||||||
|
float leftBottomRadius,
|
||||||
|
float rightBottomRadius,
|
||||||
const rgb_color& base,
|
const rgb_color& base,
|
||||||
const rgb_color& background,
|
const rgb_color& background,
|
||||||
float contrast, float brightness = 1.0,
|
float contrast, float brightness = 1.0,
|
||||||
@@ -297,7 +359,6 @@ protected:
|
|||||||
const rgb_color& right,
|
const rgb_color& right,
|
||||||
const rgb_color& bottom,
|
const rgb_color& bottom,
|
||||||
uint32 borders = B_ALL_BORDERS);
|
uint32 borders = B_ALL_BORDERS);
|
||||||
|
|
||||||
void _DrawFrame(BView* view, BRect& rect,
|
void _DrawFrame(BView* view, BRect& rect,
|
||||||
const rgb_color& left,
|
const rgb_color& left,
|
||||||
const rgb_color& top,
|
const rgb_color& top,
|
||||||
@@ -307,6 +368,161 @@ protected:
|
|||||||
const rgb_color& leftBottom,
|
const rgb_color& leftBottom,
|
||||||
uint32 borders = B_ALL_BORDERS);
|
uint32 borders = B_ALL_BORDERS);
|
||||||
|
|
||||||
|
void _DrawButtonBackground(BView* view, BRect& rect,
|
||||||
|
const BRect& updateRect,
|
||||||
|
float leftTopRadius,
|
||||||
|
float rightTopRadius,
|
||||||
|
float leftBottomRadius,
|
||||||
|
float rightBottomRadius,
|
||||||
|
const rgb_color& base,
|
||||||
|
uint32 flags = 0,
|
||||||
|
uint32 borders = B_ALL_BORDERS,
|
||||||
|
enum orientation orientation
|
||||||
|
= B_HORIZONTAL);
|
||||||
|
|
||||||
|
void _DrawMenuFieldBackgroundOutside(BView* view,
|
||||||
|
BRect& rect, const BRect& updateRect,
|
||||||
|
float leftTopRadius,
|
||||||
|
float rightTopRadius,
|
||||||
|
float leftBottomRadius,
|
||||||
|
float rightBottomRadius,
|
||||||
|
const rgb_color& base,
|
||||||
|
bool popupIndicator = false,
|
||||||
|
uint32 flags = 0);
|
||||||
|
|
||||||
|
void _DrawMenuFieldBackgroundInside(BView* view,
|
||||||
|
BRect& rect, const BRect& updateRect,
|
||||||
|
float leftTopRadius,
|
||||||
|
float rightTopRadius,
|
||||||
|
float leftBottomRadius,
|
||||||
|
float rightBottomRadius,
|
||||||
|
const rgb_color& base, uint32 flags = 0,
|
||||||
|
uint32 borders = B_ALL_BORDERS);
|
||||||
|
|
||||||
|
// Rounded corner methods
|
||||||
|
void _DrawRoundCornerLeftTop(BView* view,
|
||||||
|
BRect& cornerRect, const BRect& updateRect,
|
||||||
|
const rgb_color& background,
|
||||||
|
const rgb_color& edgeColor,
|
||||||
|
const rgb_color& frameColor,
|
||||||
|
const rgb_color& bevelColor,
|
||||||
|
const BGradientLinear& fillGradient);
|
||||||
|
|
||||||
|
void _DrawRoundCornerFrameLeftTop(BView* view,
|
||||||
|
BRect& cornerRect, const BRect& updateRect,
|
||||||
|
const rgb_color& background,
|
||||||
|
const rgb_color& edgeColor,
|
||||||
|
const rgb_color& frameColor);
|
||||||
|
|
||||||
|
void _DrawRoundCornerBackgroundLeftTop(BView* view,
|
||||||
|
BRect& cornerRect, const BRect& updateRect,
|
||||||
|
const rgb_color& bevelColor,
|
||||||
|
const BGradientLinear& fillGradient);
|
||||||
|
|
||||||
|
void _DrawRoundCornerRightTop(BView* view,
|
||||||
|
BRect& cornerRect, const BRect& updateRect,
|
||||||
|
const rgb_color& background,
|
||||||
|
const rgb_color& edgeTopColor,
|
||||||
|
const rgb_color& edgeRightColor,
|
||||||
|
const rgb_color& frameTopColor,
|
||||||
|
const rgb_color& frameRightColor,
|
||||||
|
const rgb_color& bevelTopColor,
|
||||||
|
const rgb_color& bevelRightColor,
|
||||||
|
const BGradientLinear& fillGradient);
|
||||||
|
|
||||||
|
void _DrawRoundCornerFrameRightTop(BView* view,
|
||||||
|
BRect& cornerRect, const BRect& updateRect,
|
||||||
|
const rgb_color& background,
|
||||||
|
const rgb_color& edgeTopColor,
|
||||||
|
const rgb_color& edgeRightColor,
|
||||||
|
const rgb_color& frameTopColor,
|
||||||
|
const rgb_color& frameRightColor);
|
||||||
|
|
||||||
|
void _DrawRoundCornerBackgroundRightTop(BView* view,
|
||||||
|
BRect& cornerRect, const BRect& updateRect,
|
||||||
|
const rgb_color& bevelTopColor,
|
||||||
|
const rgb_color& bevelRightColor,
|
||||||
|
const BGradientLinear& fillGradient);
|
||||||
|
|
||||||
|
void _DrawRoundCornerLeftBottom(BView* view,
|
||||||
|
BRect& cornerRect, const BRect& updateRect,
|
||||||
|
const rgb_color& background,
|
||||||
|
const rgb_color& edgeLeftColor,
|
||||||
|
const rgb_color& edgeBottomColor,
|
||||||
|
const rgb_color& frameLeftColor,
|
||||||
|
const rgb_color& frameBottomColor,
|
||||||
|
const rgb_color& bevelLeftColor,
|
||||||
|
const rgb_color& bevelBottomColor,
|
||||||
|
const BGradientLinear& fillGradient);
|
||||||
|
|
||||||
|
void _DrawRoundCornerFrameLeftBottom(BView* view,
|
||||||
|
BRect& cornerRect, const BRect& updateRect,
|
||||||
|
const rgb_color& background,
|
||||||
|
const rgb_color& edgeLeftColor,
|
||||||
|
const rgb_color& edgeBottomColor,
|
||||||
|
const rgb_color& frameLeftColor,
|
||||||
|
const rgb_color& frameBottomColor);
|
||||||
|
|
||||||
|
void _DrawRoundCornerBackgroundLeftBottom(BView* view,
|
||||||
|
BRect& cornerRect, const BRect& updateRect,
|
||||||
|
const rgb_color& bevelLeftColor,
|
||||||
|
const rgb_color& bevelBottomColor,
|
||||||
|
const BGradientLinear& fillGradient);
|
||||||
|
|
||||||
|
void _DrawRoundCornerRightBottom(BView* view,
|
||||||
|
BRect& cornerRect, const BRect& updateRect,
|
||||||
|
const rgb_color& background,
|
||||||
|
const rgb_color& edgeColor,
|
||||||
|
const rgb_color& frameColor,
|
||||||
|
const rgb_color& bevelColor,
|
||||||
|
const BGradientLinear& fillGradient);
|
||||||
|
|
||||||
|
void _DrawRoundCornerFrameRightBottom(BView* view,
|
||||||
|
BRect& cornerRect, const BRect& updateRect,
|
||||||
|
const rgb_color& background,
|
||||||
|
const rgb_color& edgeColor,
|
||||||
|
const rgb_color& frameColor);
|
||||||
|
|
||||||
|
void _DrawRoundCornerBackgroundRightBottom(
|
||||||
|
BView* view,
|
||||||
|
BRect& cornerRect, const BRect& updateRect,
|
||||||
|
const rgb_color& bevelColor,
|
||||||
|
const BGradientLinear& fillGradient);
|
||||||
|
|
||||||
|
void _DrawRoundBarCorner(BView* view, BRect& rect,
|
||||||
|
const BRect& updateRect,
|
||||||
|
const rgb_color& edgeLightColor,
|
||||||
|
const rgb_color& edgeShadowColor,
|
||||||
|
const rgb_color& frameLightColor,
|
||||||
|
const rgb_color& frameShadowColor,
|
||||||
|
const rgb_color& fillLightColor,
|
||||||
|
const rgb_color& fillShadowColor,
|
||||||
|
float leftInset, float topInset,
|
||||||
|
float rightInset, float bottomInset,
|
||||||
|
enum orientation orientation);
|
||||||
|
|
||||||
|
// Border color methods
|
||||||
|
rgb_color _EdgeLightColor(const rgb_color& base,
|
||||||
|
float contrast, float brightness,
|
||||||
|
uint32 flags);
|
||||||
|
|
||||||
|
rgb_color _EdgeShadowColor(const rgb_color& base,
|
||||||
|
float contrast, float brightness,
|
||||||
|
uint32 flags);
|
||||||
|
|
||||||
|
rgb_color _FrameLightColor(const rgb_color& base,
|
||||||
|
uint32 flags);
|
||||||
|
|
||||||
|
rgb_color _FrameShadowColor(const rgb_color& base,
|
||||||
|
uint32 flags);
|
||||||
|
|
||||||
|
rgb_color _BevelLightColor(const rgb_color& base,
|
||||||
|
uint32 flags);
|
||||||
|
|
||||||
|
rgb_color _BevelShadowColor(const rgb_color& base,
|
||||||
|
uint32 flags);
|
||||||
|
|
||||||
|
// Background gradient methods
|
||||||
void _FillGradient(BView* view, const BRect& rect,
|
void _FillGradient(BView* view, const BRect& rect,
|
||||||
const rgb_color& base, float topTint,
|
const rgb_color& base, float topTint,
|
||||||
float bottomTint,
|
float bottomTint,
|
||||||
@@ -333,39 +549,15 @@ protected:
|
|||||||
enum orientation orientation
|
enum orientation orientation
|
||||||
= B_HORIZONTAL) const;
|
= B_HORIZONTAL) const;
|
||||||
|
|
||||||
|
void _MakeButtonGradient(BGradientLinear& gradient,
|
||||||
|
BRect& rect, const rgb_color& base,
|
||||||
|
uint32 flags, enum orientation orientation
|
||||||
|
= B_HORIZONTAL) const;
|
||||||
|
|
||||||
bool _RadioButtonAndCheckBoxMarkColor(
|
bool _RadioButtonAndCheckBoxMarkColor(
|
||||||
const rgb_color& base, rgb_color& color,
|
const rgb_color& base, rgb_color& color,
|
||||||
uint32 flags) const;
|
uint32 flags) const;
|
||||||
|
|
||||||
void _DrawRoundBarCorner(BView* view, BRect& rect,
|
|
||||||
const BRect& updateRect,
|
|
||||||
const rgb_color& edgeLightColor,
|
|
||||||
const rgb_color& edgeShadowColor,
|
|
||||||
const rgb_color& frameLightColor,
|
|
||||||
const rgb_color& frameShadowColor,
|
|
||||||
const rgb_color& fillLightColor,
|
|
||||||
const rgb_color& fillShadowColor,
|
|
||||||
float leftInset, float topInset,
|
|
||||||
float rightInset, float bottomInset,
|
|
||||||
enum orientation orientation);
|
|
||||||
|
|
||||||
void _DrawRoundCornerLeftTop(BView* view,
|
|
||||||
BRect& rect, const BRect& updateRect,
|
|
||||||
const rgb_color& base,
|
|
||||||
const rgb_color& edgeColor,
|
|
||||||
const rgb_color& frameColor,
|
|
||||||
const rgb_color& bevelColor,
|
|
||||||
const BGradientLinear& fillGradient);
|
|
||||||
void _DrawRoundCornerRightTop(BView* view,
|
|
||||||
BRect& rect, const BRect& updateRect,
|
|
||||||
const rgb_color& base,
|
|
||||||
const rgb_color& edgeTopColor,
|
|
||||||
const rgb_color& edgeRightColor,
|
|
||||||
const rgb_color& frameTopColor,
|
|
||||||
const rgb_color& frameRightColor,
|
|
||||||
const rgb_color& bevelTopColor,
|
|
||||||
const rgb_color& bevelRightColor,
|
|
||||||
const BGradientLinear& fillGradient);
|
|
||||||
private:
|
private:
|
||||||
bool fCachedOutline;
|
bool fCachedOutline;
|
||||||
int32 fCachedWorkspace;
|
int32 fCachedWorkspace;
|
||||||
@@ -382,4 +574,5 @@ extern BControlLook* be_control_look;
|
|||||||
using BPrivate::BControlLook;
|
using BPrivate::BControlLook;
|
||||||
using BPrivate::be_control_look;
|
using BPrivate::be_control_look;
|
||||||
|
|
||||||
|
|
||||||
#endif // _CONTROL_LOOK_H
|
#endif // _CONTROL_LOOK_H
|
||||||
|
|||||||
@@ -419,10 +419,10 @@ CalcView::Draw(BRect updateRect)
|
|||||||
flags |= BControlLook::B_IGNORE_OUTLINE;
|
flags |= BControlLook::B_IGNORE_OUTLINE;
|
||||||
|
|
||||||
be_control_look->DrawButtonFrame(this, frame, updateRect,
|
be_control_look->DrawButtonFrame(this, frame, updateRect,
|
||||||
fBaseColor, fBaseColor, flags);
|
6.0f, fBaseColor, fBaseColor, flags);
|
||||||
|
|
||||||
be_control_look->DrawButtonBackground(this, frame, updateRect,
|
be_control_look->DrawButtonBackground(this, frame, updateRect,
|
||||||
fBaseColor, flags);
|
6.0f, fBaseColor, flags);
|
||||||
|
|
||||||
be_control_look->DrawLabel(this, key->label, frame, updateRect,
|
be_control_look->DrawLabel(this, key->label, frame, updateRect,
|
||||||
fBaseColor, flags, BAlignment(B_ALIGN_HORIZONTAL_CENTER,
|
fBaseColor, flags, BAlignment(B_ALIGN_HORIZONTAL_CENTER,
|
||||||
|
|||||||
+1309
-577
File diff suppressed because it is too large
Load Diff
@@ -564,9 +564,9 @@ void
|
|||||||
KeyboardLayoutView::_DrawKeyButton(BView* view, BRect& rect, BRect updateRect,
|
KeyboardLayoutView::_DrawKeyButton(BView* view, BRect& rect, BRect updateRect,
|
||||||
rgb_color base, rgb_color background, bool pressed)
|
rgb_color base, rgb_color background, bool pressed)
|
||||||
{
|
{
|
||||||
be_control_look->DrawButtonFrame(view, rect, updateRect, base,
|
be_control_look->DrawButtonFrame(view, rect, updateRect, 4.0f, base,
|
||||||
background, pressed ? BControlLook::B_ACTIVATED : 0);
|
background, pressed ? BControlLook::B_ACTIVATED : 0);
|
||||||
be_control_look->DrawButtonBackground(view, rect, updateRect,
|
be_control_look->DrawButtonBackground(view, rect, updateRect, 4.0f,
|
||||||
base, pressed ? BControlLook::B_ACTIVATED : 0);
|
base, pressed ? BControlLook::B_ACTIVATED : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -622,11 +622,21 @@ KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
|
|||||||
region.Exclude(missingRect);
|
region.Exclude(missingRect);
|
||||||
view->ConstrainClippingRegion(®ion);
|
view->ConstrainClippingRegion(®ion);
|
||||||
|
|
||||||
_DrawKeyButton(view, rect, updateRect, base, background, pressed);
|
be_control_look->DrawButtonFrame(view, rect, updateRect,
|
||||||
|
4.0f, 4.0f, 0.0f, 0.0f, base, background,
|
||||||
|
pressed ? BControlLook::B_ACTIVATED : 0);
|
||||||
|
|
||||||
|
view->ConstrainClippingRegion(®ion);
|
||||||
|
|
||||||
|
be_control_look->DrawButtonBackground(view, rect, updateRect,
|
||||||
|
4.0f, 4.0f, 0.0f, 0.0f, base,
|
||||||
|
pressed ? BControlLook::B_ACTIVATED : 0);
|
||||||
|
|
||||||
rect.left = missingRect.right;
|
rect.left = missingRect.right;
|
||||||
_GetAbbreviatedKeyLabelIfNeeded(view, rect, key, text, sizeof(text));
|
_GetAbbreviatedKeyLabelIfNeeded(view, rect, key, text, sizeof(text));
|
||||||
|
|
||||||
|
view->ConstrainClippingRegion(®ion);
|
||||||
|
|
||||||
be_control_look->DrawLabel(view, text, rect, updateRect,
|
be_control_look->DrawLabel(view, text, rect, updateRect,
|
||||||
base, 0, BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));
|
base, 0, BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));
|
||||||
|
|
||||||
@@ -637,7 +647,18 @@ KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
|
|||||||
|
|
||||||
rect = originalRect;
|
rect = originalRect;
|
||||||
rect.bottom = missingRect.top + 2;
|
rect.bottom = missingRect.top + 2;
|
||||||
_DrawKeyButton(view, rect, updateRect, base, background, pressed);
|
|
||||||
|
be_control_look->DrawButtonFrame(view, rect, updateRect,
|
||||||
|
0.0f, 0.0f, 4.0f, 0.0f, base, background,
|
||||||
|
pressed ? BControlLook::B_ACTIVATED : 0,
|
||||||
|
BControlLook::B_LEFT_BORDER | BControlLook::B_BOTTOM_BORDER);
|
||||||
|
|
||||||
|
view->ConstrainClippingRegion(®ion);
|
||||||
|
|
||||||
|
be_control_look->DrawButtonBackground(view, rect, updateRect,
|
||||||
|
0.0f, 0.0f, 4.0f, 0.0f, base,
|
||||||
|
pressed ? BControlLook::B_ACTIVATED : 0,
|
||||||
|
BControlLook::B_LEFT_BORDER | BControlLook::B_BOTTOM_BORDER);
|
||||||
|
|
||||||
missingRect.left = missingRect.right;
|
missingRect.left = missingRect.right;
|
||||||
missingRect.right++;
|
missingRect.right++;
|
||||||
@@ -648,7 +669,20 @@ KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
|
|||||||
rect = originalRect;
|
rect = originalRect;
|
||||||
rect.left = missingRect.right - 2;
|
rect.left = missingRect.right - 2;
|
||||||
rect.top = missingRect.top - 2;
|
rect.top = missingRect.top - 2;
|
||||||
_DrawKeyButton(view, rect, updateRect, base, background, pressed);
|
|
||||||
|
be_control_look->DrawButtonFrame(view, rect, updateRect,
|
||||||
|
0.0f, 0.0f, 4.0f, 4.0f, base, background,
|
||||||
|
pressed ? BControlLook::B_ACTIVATED : 0,
|
||||||
|
BControlLook::B_LEFT_BORDER | BControlLook::B_RIGHT_BORDER
|
||||||
|
| BControlLook::B_BOTTOM_BORDER);
|
||||||
|
|
||||||
|
view->ConstrainClippingRegion(®ion);
|
||||||
|
|
||||||
|
be_control_look->DrawButtonBackground(view, rect, updateRect,
|
||||||
|
0.0f, 0.0f, 4.0f, 4.0f, base,
|
||||||
|
pressed ? BControlLook::B_ACTIVATED : 0,
|
||||||
|
BControlLook::B_LEFT_BORDER | BControlLook::B_RIGHT_BORDER
|
||||||
|
| BControlLook::B_BOTTOM_BORDER);
|
||||||
|
|
||||||
view->ConstrainClippingRegion(NULL);
|
view->ConstrainClippingRegion(NULL);
|
||||||
}
|
}
|
||||||
@@ -1033,8 +1067,8 @@ KeyboardLayoutView::_FrameFor(BRect keyFrame)
|
|||||||
{
|
{
|
||||||
BRect rect;
|
BRect rect;
|
||||||
rect.left = ceilf(keyFrame.left * fFactor);
|
rect.left = ceilf(keyFrame.left * fFactor);
|
||||||
rect.right = floorf((keyFrame.Width()) * fFactor + rect.left - fGap - 1);
|
|
||||||
rect.top = ceilf(keyFrame.top * fFactor);
|
rect.top = ceilf(keyFrame.top * fFactor);
|
||||||
|
rect.right = floorf((keyFrame.Width()) * fFactor + rect.left - fGap - 1);
|
||||||
rect.bottom = floorf((keyFrame.Height()) * fFactor + rect.top - fGap - 1);
|
rect.bottom = floorf((keyFrame.Height()) * fFactor + rect.top - fGap - 1);
|
||||||
rect.OffsetBy(fOffset);
|
rect.OffsetBy(fOffset);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user