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.
|
||||
*/
|
||||
#ifndef _CONTROL_LOOK_H
|
||||
#define _CONTROL_LOOK_H
|
||||
|
||||
|
||||
#include <Alignment.h>
|
||||
#include <Font.h>
|
||||
#include <Rect.h>
|
||||
@@ -78,12 +79,12 @@ public:
|
||||
virtual BAlignment DefaultLabelAlignment() const;
|
||||
virtual float DefaultLabelSpacing() const;
|
||||
|
||||
/* TODO: virtual*/
|
||||
float DefaultItemSpacing() const;
|
||||
// TODO: Make methods virtual before R1 release
|
||||
/*virtual*/ float DefaultItemSpacing() const;
|
||||
|
||||
static float ComposeSpacing(float spacing);
|
||||
|
||||
uint32 Flags(BControl* control) const;
|
||||
/*virtual*/ uint32 Flags(BControl* control) const;
|
||||
|
||||
virtual void DrawButtonFrame(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
@@ -91,16 +92,52 @@ public:
|
||||
const rgb_color& background,
|
||||
uint32 flags = 0,
|
||||
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 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 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 rgb_color& base,
|
||||
uint32 flags = 0,
|
||||
@@ -112,56 +149,82 @@ public:
|
||||
const rgb_color& background,
|
||||
uint32 flags = 0,
|
||||
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,
|
||||
const rgb_color& base, bool popupIndicator,
|
||||
uint32 flags = 0);
|
||||
|
||||
virtual void DrawMenuFieldBackground(BView* view,
|
||||
/*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,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
virtual void DrawMenuBackground(BView* view,
|
||||
virtual void DrawMenuBackground(BView* view,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
virtual void DrawMenuItemBackground(BView* view,
|
||||
virtual void DrawMenuItemBackground(BView* view,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
virtual void DrawStatusBar(BView* view, BRect& rect,
|
||||
virtual void DrawStatusBar(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base,
|
||||
const rgb_color& barColor,
|
||||
float progressPosition);
|
||||
|
||||
virtual void DrawCheckBox(BView* view, BRect& rect,
|
||||
virtual void DrawCheckBox(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base,
|
||||
uint32 flags = 0);
|
||||
|
||||
virtual void DrawRadioButton(BView* view, BRect& rect,
|
||||
virtual void DrawRadioButton(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base,
|
||||
uint32 flags = 0);
|
||||
|
||||
virtual void DrawScrollBarBackground(BView* view,
|
||||
virtual void DrawScrollBarBackground(BView* view,
|
||||
BRect& rect1, BRect& rect2,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
enum orientation orientation);
|
||||
|
||||
virtual void DrawScrollBarBackground(BView* view,
|
||||
virtual void DrawScrollBarBackground(BView* view,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
enum orientation orientation);
|
||||
|
||||
// TODO: Make all these virtual before R1 release
|
||||
void DrawScrollViewFrame(BView* view,
|
||||
/*virtual*/ void DrawScrollViewFrame(BView* view,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
BRect verticalScrollBarFrame,
|
||||
BRect horizontalScrollBarFrame,
|
||||
@@ -170,7 +233,7 @@ public:
|
||||
uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
void DrawArrowShape(BView* view,
|
||||
/*virtual*/ void DrawArrowShape(BView* view,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 direction,
|
||||
uint32 flags = 0,
|
||||
@@ -178,14 +241,13 @@ public:
|
||||
|
||||
virtual rgb_color SliderBarColor(const rgb_color& base);
|
||||
|
||||
virtual void DrawSliderBar(BView* view, BRect rect,
|
||||
virtual void DrawSliderBar(BView* view, BRect rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base,
|
||||
rgb_color leftFillColor,
|
||||
rgb_color rightFillColor,
|
||||
float sliderScale, uint32 flags,
|
||||
enum orientation orientation);
|
||||
|
||||
virtual void DrawSliderBar(BView* view, BRect rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, rgb_color fillColor,
|
||||
@@ -196,11 +258,10 @@ public:
|
||||
const rgb_color& base, uint32 flags,
|
||||
enum orientation orientation);
|
||||
|
||||
void DrawSliderTriangle(BView* view, BRect& rect,
|
||||
/*virtual*/ void DrawSliderTriangle(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
enum orientation orientation);
|
||||
|
||||
virtual void DrawSliderTriangle(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base,
|
||||
@@ -213,12 +274,12 @@ public:
|
||||
hash_mark_location location,
|
||||
uint32 flags, enum orientation orientation);
|
||||
|
||||
virtual void DrawActiveTab(BView* view, BRect& rect,
|
||||
virtual void DrawActiveTab(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
virtual void DrawInactiveTab(BView* view, BRect& rect,
|
||||
virtual void DrawInactiveTab(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
@@ -232,43 +293,40 @@ public:
|
||||
|
||||
// various borders
|
||||
|
||||
virtual void DrawBorder(BView* view, BRect& rect,
|
||||
virtual void DrawBorder(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base,
|
||||
border_style border, uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
virtual void DrawRaisedBorder(BView* view, BRect& rect,
|
||||
virtual void DrawRaisedBorder(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
virtual void DrawGroupFrame(BView* view, BRect& rect,
|
||||
virtual void DrawGroupFrame(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
virtual void DrawTextControlBorder(BView* view, BRect& rect,
|
||||
virtual void DrawTextControlBorder(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
// aligned labels
|
||||
|
||||
void DrawLabel(BView* view, const char* label,
|
||||
/*virtual*/ void DrawLabel(BView* view, const char* label,
|
||||
BRect rect, const BRect& updateRect,
|
||||
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,
|
||||
const rgb_color& base, uint32 flags,
|
||||
const BAlignment& alignment);
|
||||
|
||||
// TODO: This should also be virtual
|
||||
// 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
|
||||
// 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 BPoint& where);
|
||||
|
||||
@@ -278,6 +336,10 @@ public:
|
||||
protected:
|
||||
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,
|
||||
float contrast, float brightness = 1.0,
|
||||
@@ -297,7 +359,6 @@ protected:
|
||||
const rgb_color& right,
|
||||
const rgb_color& bottom,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
void _DrawFrame(BView* view, BRect& rect,
|
||||
const rgb_color& left,
|
||||
const rgb_color& top,
|
||||
@@ -307,6 +368,161 @@ protected:
|
||||
const rgb_color& leftBottom,
|
||||
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,
|
||||
const rgb_color& base, float topTint,
|
||||
float bottomTint,
|
||||
@@ -333,39 +549,15 @@ protected:
|
||||
enum orientation orientation
|
||||
= B_HORIZONTAL) const;
|
||||
|
||||
void _MakeButtonGradient(BGradientLinear& gradient,
|
||||
BRect& rect, const rgb_color& base,
|
||||
uint32 flags, enum orientation orientation
|
||||
= B_HORIZONTAL) const;
|
||||
|
||||
bool _RadioButtonAndCheckBoxMarkColor(
|
||||
const rgb_color& base, rgb_color& color,
|
||||
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:
|
||||
bool fCachedOutline;
|
||||
int32 fCachedWorkspace;
|
||||
@@ -382,4 +574,5 @@ extern BControlLook* be_control_look;
|
||||
using BPrivate::BControlLook;
|
||||
using BPrivate::be_control_look;
|
||||
|
||||
|
||||
#endif // _CONTROL_LOOK_H
|
||||
|
||||
@@ -419,10 +419,10 @@ CalcView::Draw(BRect updateRect)
|
||||
flags |= BControlLook::B_IGNORE_OUTLINE;
|
||||
|
||||
be_control_look->DrawButtonFrame(this, frame, updateRect,
|
||||
fBaseColor, fBaseColor, flags);
|
||||
6.0f, fBaseColor, fBaseColor, flags);
|
||||
|
||||
be_control_look->DrawButtonBackground(this, frame, updateRect,
|
||||
fBaseColor, flags);
|
||||
6.0f, fBaseColor, flags);
|
||||
|
||||
be_control_look->DrawLabel(this, key->label, frame, updateRect,
|
||||
fBaseColor, flags, BAlignment(B_ALIGN_HORIZONTAL_CENTER,
|
||||
|
||||
+1338
-606
File diff suppressed because it is too large
Load Diff
@@ -564,9 +564,9 @@ void
|
||||
KeyboardLayoutView::_DrawKeyButton(BView* view, BRect& rect, BRect updateRect,
|
||||
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);
|
||||
be_control_look->DrawButtonBackground(view, rect, updateRect,
|
||||
be_control_look->DrawButtonBackground(view, rect, updateRect, 4.0f,
|
||||
base, pressed ? BControlLook::B_ACTIVATED : 0);
|
||||
}
|
||||
|
||||
@@ -622,11 +622,21 @@ KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
|
||||
region.Exclude(missingRect);
|
||||
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;
|
||||
_GetAbbreviatedKeyLabelIfNeeded(view, rect, key, text, sizeof(text));
|
||||
|
||||
view->ConstrainClippingRegion(®ion);
|
||||
|
||||
be_control_look->DrawLabel(view, text, rect, updateRect,
|
||||
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.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.right++;
|
||||
@@ -648,7 +669,20 @@ KeyboardLayoutView::_DrawKey(BView* view, BRect updateRect, const Key* key,
|
||||
rect = originalRect;
|
||||
rect.left = missingRect.right - 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);
|
||||
}
|
||||
@@ -1032,9 +1066,9 @@ BRect
|
||||
KeyboardLayoutView::_FrameFor(BRect keyFrame)
|
||||
{
|
||||
BRect rect;
|
||||
rect.left = ceilf(keyFrame.left * fFactor);
|
||||
rect.right = floorf((keyFrame.Width()) * fFactor + rect.left - fGap - 1);
|
||||
rect.top = ceilf(keyFrame.top * fFactor);
|
||||
rect.left = ceilf(keyFrame.left * 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.OffsetBy(fOffset);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user