Implemented a new look for the Haiku interface controls. It was
overheard that they looked too ninety-ish. TODO: The code behind this is work in progress. The basic idea is to extract all drawing code into a new class BControlLook, of which there is a global instance be_control_look, instantiated in InterfaceDefs.cpp. At the moment, all the old drawing code is still there, and the usage of be_control_look is inside if-bodies checking the instance against NULL. In another words, by not instanitating be_control_look, you can revert back to the old look. BControlLook's job is to provide reusable methods for drawing certain types of frames, backgrounds and labels, so that application developers can make controls that re-use the same drawing code as built-in controls and adopt to changes made there. I have added the notion of "borders". Each of the frame drawing methods can be made to draw certain borders only, which is supposed to help when controls shall visually attach. This feature is not fully explored at all ATM. TODO: Update BColumnListView header view and BStringItem text spacing. Update other apps where it makes sense to use BControlLook. For the moment, only Tracker and LaunchBox are updated. More... NOTE: The new look is not very radically different, so that existing apps do not immediately look too ugly or out of place. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29221 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
700ab492a9
commit
2f86ba4557
@ -17,58 +17,67 @@
|
||||
#include <ChannelControl.h>
|
||||
|
||||
|
||||
class BChannelSlider : public BChannelControl
|
||||
{
|
||||
class BChannelSlider : public BChannelControl {
|
||||
public:
|
||||
BChannelSlider(BRect area, const char* name,
|
||||
const char* label, BMessage* message,
|
||||
int32 channels = 1,
|
||||
uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
uint32 flags = B_WILL_DRAW);
|
||||
BChannelSlider(BRect area, const char* name,
|
||||
const char* label, BMessage* message,
|
||||
orientation o, int32 channels = 1,
|
||||
uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
uint32 flags = B_WILL_DRAW);
|
||||
BChannelSlider(BMessage* archive);
|
||||
virtual ~BChannelSlider();
|
||||
BChannelSlider(BRect area, const char* name,
|
||||
const char* label, BMessage* message,
|
||||
int32 channels = 1,
|
||||
uint32 resizeMode
|
||||
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
uint32 flags = B_WILL_DRAW);
|
||||
BChannelSlider(BRect area, const char* name,
|
||||
const char* label, BMessage* message,
|
||||
enum orientation orientation,
|
||||
int32 channels = 1,
|
||||
uint32 resizeMode
|
||||
= B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||
uint32 flags = B_WILL_DRAW);
|
||||
BChannelSlider(const char* name,
|
||||
const char* label, BMessage* message,
|
||||
enum orientation orientation,
|
||||
int32 channels = 1,
|
||||
uint32 flags = B_WILL_DRAW);
|
||||
BChannelSlider(BMessage* archive);
|
||||
virtual ~BChannelSlider();
|
||||
|
||||
static BArchivable* Instantiate(BMessage* from);
|
||||
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
||||
static BArchivable* Instantiate(BMessage* from);
|
||||
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
||||
|
||||
virtual orientation Orientation() const;
|
||||
void SetOrientation(orientation o);
|
||||
virtual orientation Orientation() const;
|
||||
void SetOrientation(enum orientation orientation);
|
||||
|
||||
virtual int32 MaxChannelCount() const;
|
||||
virtual bool SupportsIndividualLimits() const;
|
||||
virtual int32 MaxChannelCount() const;
|
||||
virtual bool SupportsIndividualLimits() const;
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void AllAttached();
|
||||
virtual void DetachedFromWindow();
|
||||
virtual void AllDetached();
|
||||
virtual void AttachedToWindow();
|
||||
virtual void AllAttached();
|
||||
virtual void DetachedFromWindow();
|
||||
virtual void AllDetached();
|
||||
|
||||
virtual void MessageReceived(BMessage* msg);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
virtual void Draw(BRect area);
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void MouseUp(BPoint pt);
|
||||
virtual void MouseMoved(BPoint pt,uint32 code,
|
||||
const BMessage* message);
|
||||
virtual void WindowActivated(bool state);
|
||||
virtual void KeyDown(const char* bytes, int32 numBytes);
|
||||
virtual void KeyUp(const char* bytes, int32 numBytes);
|
||||
virtual void FrameResized(float width, float height);
|
||||
virtual void Draw(BRect area);
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void MouseUp(BPoint where);
|
||||
virtual void MouseMoved(BPoint where, uint32 transit,
|
||||
const BMessage* dragMessage);
|
||||
virtual void WindowActivated(bool state);
|
||||
virtual void KeyDown(const char* bytes, int32 numBytes);
|
||||
virtual void KeyUp(const char* bytes, int32 numBytes);
|
||||
virtual void FrameResized(float width, float height);
|
||||
|
||||
virtual void SetFont(const BFont* font, uint32 mask = B_FONT_ALL);
|
||||
virtual void MakeFocus(bool focusState = true);
|
||||
virtual void SetFont(const BFont* font,
|
||||
uint32 mask = B_FONT_ALL);
|
||||
virtual void MakeFocus(bool focusState = true);
|
||||
|
||||
virtual void SetEnabled(bool on);
|
||||
virtual void SetEnabled(bool on);
|
||||
|
||||
virtual void GetPreferredSize(float* width, float* height);
|
||||
virtual void GetPreferredSize(float* _width, float* _height);
|
||||
|
||||
virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index,
|
||||
BMessage* specifier, int32 form, const char* p);
|
||||
virtual status_t GetSupportedSuites(BMessage* data);
|
||||
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
|
||||
BMessage* specifier, int32 form,
|
||||
const char* p);
|
||||
virtual status_t GetSupportedSuites(BMessage* data);
|
||||
|
||||
// Perform rendering for an entire slider channel.
|
||||
virtual void DrawChannel(BView* into, int32 channel, BRect area,
|
||||
|
297
headers/os/interface/ControlLook.h
Normal file
297
headers/os/interface/ControlLook.h
Normal file
@ -0,0 +1,297 @@
|
||||
/*
|
||||
* Copyright 2009, Stephan Aßmus <superstippi@gmx.de>
|
||||
* 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>
|
||||
#include <Slider.h>
|
||||
|
||||
|
||||
class BControl;
|
||||
class BGradientLinear;
|
||||
class BView;
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class BControlLook {
|
||||
public:
|
||||
BControlLook();
|
||||
virtual ~BControlLook();
|
||||
|
||||
enum frame_type {
|
||||
B_BUTTON_FRAME,
|
||||
B_MENU_FRAME,
|
||||
B_LISTVIEW_FRAME,
|
||||
B_INPUT_FRAME
|
||||
};
|
||||
|
||||
enum background_type {
|
||||
B_BUTTON_BACKGROUND,
|
||||
B_MENU_BACKGROUND,
|
||||
B_LISTVIEW_BACKGROUND,
|
||||
B_INPUT_BACKGROUND
|
||||
};
|
||||
|
||||
enum {
|
||||
B_LEFT_BORDER = 1 << 0,
|
||||
B_RIGHT_BORDER = 1 << 1,
|
||||
B_TOP_BORDER = 1 << 2,
|
||||
B_BOTTOM_BORDER = 1 << 3,
|
||||
|
||||
B_ALL_BORDERS = B_LEFT_BORDER | B_RIGHT_BORDER
|
||||
| B_TOP_BORDER | B_BOTTOM_BORDER
|
||||
};
|
||||
|
||||
enum {
|
||||
B_FOCUSED = 1 << 0,
|
||||
B_CLICKED = 1 << 1, // some controls activate on mouse up
|
||||
B_ACTIVATED = 1 << 2,
|
||||
B_HOVER = 1 << 3,
|
||||
B_DISABLED = 1 << 4,
|
||||
B_DEFAULT_BUTTON = 1 << 5
|
||||
};
|
||||
|
||||
virtual BAlignment DefaultLabelAlignment() const;
|
||||
virtual float DefaultLabelSpacing() const;
|
||||
uint32 Flags(BControl* control) const;
|
||||
|
||||
virtual void DrawButtonFrame(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base,
|
||||
uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
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 DrawMenuBarBackground(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
virtual void DrawMenuFieldBackground(BView* view,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
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,
|
||||
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);
|
||||
|
||||
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,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base,
|
||||
uint32 flags = 0);
|
||||
|
||||
virtual void DrawRadioButton(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base,
|
||||
uint32 flags = 0);
|
||||
|
||||
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,
|
||||
BRect& rect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
enum orientation orientation);
|
||||
|
||||
virtual rgb_color SliderBarColor(const rgb_color& base);
|
||||
|
||||
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,
|
||||
uint32 flags, enum orientation orientation);
|
||||
|
||||
virtual void DrawSliderThumb(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, uint32 flags,
|
||||
enum orientation orientation);
|
||||
|
||||
virtual void DrawSliderHashMarks(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, int32 count,
|
||||
hash_mark_location location,
|
||||
uint32 flags, enum orientation orientation);
|
||||
|
||||
virtual void DrawActiveTab(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
virtual void DrawInctiveTab(BView* view, BRect& rect,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
// various borders
|
||||
|
||||
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,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
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,
|
||||
const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags = 0,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
// aligned labels
|
||||
|
||||
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,
|
||||
BRect rect, const BRect& updateRect,
|
||||
const rgb_color& base, uint32 flags,
|
||||
const BAlignment& alignment);
|
||||
|
||||
protected:
|
||||
void _DrawOuterResessedFrame(BView* view,
|
||||
BRect& rect, const rgb_color& base,
|
||||
float contrast = 1.0f,
|
||||
float brightness = 1.0f,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
void _DrawFrame(BView* view, BRect& rect,
|
||||
const rgb_color& left,
|
||||
const rgb_color& top,
|
||||
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,
|
||||
const rgb_color& right,
|
||||
const rgb_color& bottom,
|
||||
const rgb_color& rightTop,
|
||||
const rgb_color& leftBottom,
|
||||
uint32 borders = B_ALL_BORDERS);
|
||||
|
||||
void _FillGradient(BView* view, const BRect& rect,
|
||||
const rgb_color& base, float topTint,
|
||||
float bottomTint,
|
||||
enum orientation orientation
|
||||
= B_HORIZONTAL);
|
||||
|
||||
void _FillGlossyGradient(BView* view,
|
||||
const BRect& rect, const rgb_color& base,
|
||||
float topTint, float middle1Tint,
|
||||
float middle2Tint, float bottomTint,
|
||||
enum orientation orientation
|
||||
= B_HORIZONTAL);
|
||||
|
||||
void _MakeGradient(BGradientLinear& gradient,
|
||||
const BRect& rect, const rgb_color& base,
|
||||
float topTint, float bottomTint,
|
||||
enum orientation orientation
|
||||
= B_HORIZONTAL) const;
|
||||
|
||||
void _MakeGlossyGradient(BGradientLinear& gradient,
|
||||
const BRect& rect, const rgb_color& base,
|
||||
float topTint, float middle1Tint,
|
||||
float middle2Tint, float bottomTint,
|
||||
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);
|
||||
};
|
||||
|
||||
extern BControlLook* be_control_look;
|
||||
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
using BPrivate::BControlLook;
|
||||
using BPrivate::be_control_look;
|
||||
|
||||
#endif // _CONTROL_LOOK_H
|
@ -206,8 +206,10 @@ private:
|
||||
|
||||
BRect _CalcFrame(BPoint where, bool* scrollOn);
|
||||
|
||||
protected:
|
||||
void _DrawItems(BRect updateRect);
|
||||
|
||||
private:
|
||||
bool _OverSuper(BPoint loc);
|
||||
bool _OverSubmenu(BMenuItem* item, BPoint loc);
|
||||
BPrivate::BMenuWindow* _MenuWindow();
|
||||
|
@ -56,6 +56,13 @@ public:
|
||||
void SetOrientation(enum orientation orientation);
|
||||
orientation Orientation() const;
|
||||
|
||||
// TODO: make this a virtual method, it should be one,
|
||||
// but it's not important right now. This is supposed
|
||||
// to be used in case the BScrollBar should draw part of
|
||||
// the focus indication of the target view for aesthetical
|
||||
// reasons. BScrollView will forward this method.
|
||||
status_t SetBorderHighlighted(bool state);
|
||||
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void MouseDown(BPoint pt);
|
||||
virtual void MouseUp(BPoint pt);
|
||||
|
@ -177,6 +177,7 @@ class BSlider : public BControl {
|
||||
|
||||
BSlider& operator=(const BSlider &);
|
||||
|
||||
void _InitBarColor();
|
||||
void _InitObject();
|
||||
|
||||
private:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2008, Haiku.
|
||||
* Copyright 2006-2009, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -17,6 +17,7 @@
|
||||
#include <Application.h>
|
||||
#include <Bitmap.h>
|
||||
#include <Control.h>
|
||||
#include <ControlLook.h>
|
||||
#include <Entry.h>
|
||||
#include <Looper.h>
|
||||
#include <Message.h>
|
||||
@ -80,8 +81,47 @@ IconButton::Draw(BRect area)
|
||||
rgb_color background = LowColor();
|
||||
if (BView* parent = Parent())
|
||||
background = parent->LowColor();
|
||||
rgb_color lightShadow, shadow, darkShadow, light;
|
||||
|
||||
BRect r(Bounds());
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
uint32 flags = 0;
|
||||
BBitmap* bitmap = fNormalBitmap;
|
||||
if (!IsEnabled()) {
|
||||
flags |= BControlLook::B_DISABLED;
|
||||
bitmap = fDisabledBitmap;
|
||||
}
|
||||
if (_HasFlags(STATE_PRESSED) || _HasFlags(STATE_FORCE_PRESSED))
|
||||
flags |= BControlLook::B_ACTIVATED;
|
||||
|
||||
if (DrawBorder()) {
|
||||
be_control_look->DrawButtonFrame(this, r, area, background, flags);
|
||||
be_control_look->DrawButtonBackground(this, r, area, background,
|
||||
flags);
|
||||
} else {
|
||||
SetHighColor(background);
|
||||
FillRect(r);
|
||||
}
|
||||
|
||||
if (bitmap && bitmap->IsValid()) {
|
||||
float x = r.left + floorf((r.Width()
|
||||
- bitmap->Bounds().Width()) / 2.0 + 0.5);
|
||||
float y = r.top + floorf((r.Height()
|
||||
- bitmap->Bounds().Height()) / 2.0 + 0.5);
|
||||
BPoint point(x, y);
|
||||
if (_HasFlags(STATE_PRESSED) || _HasFlags(STATE_FORCE_PRESSED))
|
||||
point += BPoint(1.0, 1.0);
|
||||
if (bitmap->ColorSpace() == B_RGBA32
|
||||
|| bitmap->ColorSpace() == B_RGBA32_BIG) {
|
||||
SetDrawingMode(B_OP_ALPHA);
|
||||
SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
|
||||
}
|
||||
DrawBitmap(bitmap, point);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
rgb_color lightShadow, shadow, darkShadow, light;
|
||||
BBitmap* bitmap = fNormalBitmap;
|
||||
// adjust colors and bitmap according to flags
|
||||
if (IsEnabled()) {
|
||||
@ -151,7 +191,7 @@ IconButton::Draw(BRect area)
|
||||
// background
|
||||
SetDrawingMode(B_OP_COPY);
|
||||
FillRect(r, B_SOLID_LOW);
|
||||
ConstrainClippingRegion(&originalClippingRegion);
|
||||
ConstrainClippingRegion(NULL);
|
||||
// label
|
||||
if (fLabel.CountChars() > 0) {
|
||||
SetDrawingMode(B_OP_COPY);
|
||||
@ -243,8 +283,8 @@ IconButton::GetPreferredSize(float* width, float* height)
|
||||
if (minHeight < MIN_SPACE)
|
||||
minHeight = MIN_SPACE;
|
||||
|
||||
float hPadding = max_c(4.0, ceilf(minHeight / 4.0));
|
||||
float vPadding = max_c(4.0, ceilf(minWidth / 4.0));
|
||||
float hPadding = max_c(6.0, ceilf(minHeight / 4.0));
|
||||
float vPadding = max_c(6.0, ceilf(minWidth / 4.0));
|
||||
|
||||
if (fLabel.CountChars() > 0) {
|
||||
font_height fh;
|
||||
|
@ -253,8 +253,8 @@ LaunchButton::PreferredSize()
|
||||
float minWidth = fIconSize;
|
||||
float minHeight = fIconSize;
|
||||
|
||||
float hPadding = max_c(4.0, ceilf(minHeight / 4.0));
|
||||
float vPadding = max_c(4.0, ceilf(minWidth / 4.0));
|
||||
float hPadding = max_c(6.0, ceilf(minHeight / 3.0));
|
||||
float vPadding = max_c(6.0, ceilf(minWidth / 3.0));
|
||||
|
||||
if (fLabel.CountChars() > 0) {
|
||||
font_height fh;
|
||||
|
@ -7,9 +7,11 @@
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
|
||||
#include <BMCPrivate.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <BMCPrivate.h>
|
||||
#include <ControlLook.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <MenuField.h>
|
||||
#include <MenuItem.h>
|
||||
@ -122,12 +124,44 @@ _BMCMenuBar_::AttachedToWindow()
|
||||
if (fFixedSize)
|
||||
SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
|
||||
Window()->SetKeyMenuBar(menuBar);
|
||||
|
||||
float left, top, right, bottom;
|
||||
GetItemMargins(&left, &top, &right, &bottom);
|
||||
|
||||
// TODO: Better fix would be to make BMenuItem draw text properly
|
||||
// centered
|
||||
font_height fontHeight;
|
||||
GetFontHeight(&fontHeight);
|
||||
top = ceilf((Bounds().Height() - ceilf(fontHeight.ascent)
|
||||
- ceilf(fontHeight.descent)) / 2) + 1;
|
||||
bottom = top - 1;
|
||||
|
||||
if (be_control_look)
|
||||
left = right = be_control_look->DefaultLabelSpacing();
|
||||
|
||||
SetItemMargins(left, top, right + fShowPopUpMarker ? 10 : 0, bottom);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_BMCMenuBar_::Draw(BRect updateRect)
|
||||
{
|
||||
if (be_control_look != NULL) {
|
||||
BRect rect(Bounds());
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
uint32 flags = 0;
|
||||
if (!IsEnabled())
|
||||
flags |= BControlLook::B_DISABLED;
|
||||
if (IsFocus())
|
||||
flags |= BControlLook::B_FOCUSED;
|
||||
be_control_look->DrawMenuFieldBackground(this, rect,
|
||||
updateRect, base, fShowPopUpMarker, flags);
|
||||
|
||||
_DrawItems(updateRect);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fShowPopUpMarker) {
|
||||
BMenuBar::Draw(updateRect);
|
||||
return;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ControlLook.h>
|
||||
#include <Layout.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <Message.h>
|
||||
@ -53,8 +54,7 @@ BBox::BBox(BRect frame, const char *name, uint32 resizingMode, uint32 flags,
|
||||
|
||||
|
||||
BBox::BBox(const char* name, uint32 flags, border_style border, BView* child)
|
||||
: BView(BRect(0, 0, -1, -1), name, B_FOLLOW_NONE,
|
||||
flags | B_WILL_DRAW | B_FRAME_EVENTS | B_SUPPORTS_LAYOUT),
|
||||
: BView(name, flags | B_WILL_DRAW | B_FRAME_EVENTS),
|
||||
fStyle(border)
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
@ -68,8 +68,7 @@ BBox::BBox(const char* name, uint32 flags, border_style border, BView* child)
|
||||
|
||||
|
||||
BBox::BBox(border_style border, BView* child)
|
||||
: BView(BRect(0, 0, -1, -1), NULL, B_FOLLOW_NONE,
|
||||
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP | B_SUPPORTS_LAYOUT),
|
||||
: BView(NULL, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP),
|
||||
fStyle(border)
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
@ -639,15 +638,27 @@ BBox::_DrawPlain(BRect labelBox)
|
||||
BRect rect = Bounds();
|
||||
rect.top += TopBorderOffset();
|
||||
|
||||
rgb_color shadow = tint_color(ViewColor(), B_DARKEN_3_TINT);
|
||||
float lightTint;
|
||||
float shadowTint;
|
||||
if (be_control_look != NULL) {
|
||||
lightTint = B_LIGHTEN_1_TINT;
|
||||
shadowTint = B_DARKEN_1_TINT;
|
||||
} else {
|
||||
lightTint = B_LIGHTEN_MAX_TINT;
|
||||
shadowTint = B_DARKEN_3_TINT;
|
||||
}
|
||||
|
||||
if (rect.Height() == 0.0 || rect.Width() == 0.0) {
|
||||
// used as separator
|
||||
rgb_color shadow = tint_color(ViewColor(), B_DARKEN_2_TINT);
|
||||
|
||||
SetHighColor(shadow);
|
||||
StrokeLine(rect.LeftTop(),rect.RightBottom());
|
||||
} else {
|
||||
// used as box
|
||||
rgb_color light = tint_color(ViewColor(), B_LIGHTEN_MAX_TINT);
|
||||
rgb_color light = tint_color(ViewColor(), lightTint);
|
||||
rgb_color shadow = tint_color(ViewColor(), shadowTint);
|
||||
|
||||
BeginLineArray(4);
|
||||
AddLine(BPoint(rect.left, rect.bottom),
|
||||
BPoint(rect.left, rect.top), light);
|
||||
@ -668,6 +679,23 @@ BBox::_DrawFancy(BRect labelBox)
|
||||
BRect rect = Bounds();
|
||||
rect.top += TopBorderOffset();
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
rgb_color base = ViewColor();
|
||||
if (rect.Height() == 1.0) {
|
||||
// used as horizontal separator
|
||||
be_control_look->DrawGroupFrame(this, rect, rect, base,
|
||||
BControlLook::B_TOP_BORDER);
|
||||
} else if (rect.Width() == 1.0) {
|
||||
// used as vertical separator
|
||||
be_control_look->DrawGroupFrame(this, rect, rect, base,
|
||||
BControlLook::B_LEFT_BORDER);
|
||||
} else {
|
||||
// used as box
|
||||
be_control_look->DrawGroupFrame(this, rect, rect, base);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
rgb_color light = tint_color(ViewColor(), B_LIGHTEN_MAX_TINT);
|
||||
rgb_color shadow = tint_color(ViewColor(), B_DARKEN_3_TINT);
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include <new>
|
||||
|
||||
#include <ControlLook.h>
|
||||
#include <Font.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <String.h>
|
||||
@ -102,6 +103,24 @@ BButton::Archive(BMessage* archive, bool deep) const
|
||||
void
|
||||
BButton::Draw(BRect updateRect)
|
||||
{
|
||||
if (be_control_look != NULL) {
|
||||
BRect rect(Bounds());
|
||||
rgb_color base = LowColor();
|
||||
uint32 flags = be_control_look->Flags(this);
|
||||
if (IsDefault())
|
||||
flags |= BControlLook::B_DEFAULT_BUTTON;
|
||||
be_control_look->DrawButtonFrame(this, rect, updateRect,
|
||||
base, flags);
|
||||
be_control_look->DrawButtonBackground(this, rect, updateRect,
|
||||
base, flags);
|
||||
|
||||
// always leave some room around the label
|
||||
rect.InsetBy(3.0, 3.0);
|
||||
be_control_look->DrawLabel(this, Label(), rect, updateRect,
|
||||
base, flags, BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE));
|
||||
return;
|
||||
}
|
||||
|
||||
font_height fh;
|
||||
GetFontHeight(&fh);
|
||||
|
||||
|
@ -4,8 +4,10 @@
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include <Bitmap.h>
|
||||
#include <ChannelSlider.h>
|
||||
|
||||
#include <Bitmap.h>
|
||||
#include <ControlLook.h>
|
||||
#include <Debug.h>
|
||||
#include <PropertyInfo.h>
|
||||
#include <Screen.h>
|
||||
@ -79,12 +81,24 @@ BChannelSlider::BChannelSlider(BRect area, const char *name, const char *label,
|
||||
|
||||
|
||||
BChannelSlider::BChannelSlider(BRect area, const char *name, const char *label,
|
||||
BMessage *model, orientation o, int32 channels, uint32 resizeMode, uint32 flags)
|
||||
BMessage *model, enum orientation orientation, int32 channels,
|
||||
uint32 resizeMode, uint32 flags)
|
||||
: BChannelControl(area, name, label, model, channels, resizeMode, flags)
|
||||
|
||||
{
|
||||
_InitData();
|
||||
SetOrientation(o);
|
||||
SetOrientation(orientation);
|
||||
}
|
||||
|
||||
|
||||
BChannelSlider::BChannelSlider(const char *name, const char *label,
|
||||
BMessage *model, enum orientation orientation, int32 channels,
|
||||
uint32 flags)
|
||||
: BChannelControl(name, label, model, channels, flags)
|
||||
|
||||
{
|
||||
_InitData();
|
||||
SetOrientation(orientation);
|
||||
}
|
||||
|
||||
|
||||
@ -138,9 +152,9 @@ BChannelSlider::Orientation() const
|
||||
|
||||
|
||||
void
|
||||
BChannelSlider::SetOrientation(orientation _orientation)
|
||||
BChannelSlider::SetOrientation(enum orientation orientation)
|
||||
{
|
||||
bool isVertical = _orientation == B_VERTICAL;
|
||||
bool isVertical = orientation == B_VERTICAL;
|
||||
if (isVertical != _Vertical()) {
|
||||
fVertical = isVertical;
|
||||
Invalidate(Bounds());
|
||||
@ -415,6 +429,10 @@ void
|
||||
BChannelSlider::FrameResized(float newWidth, float newHeight)
|
||||
{
|
||||
BChannelControl::FrameResized(newWidth, newHeight);
|
||||
|
||||
delete fBacking;
|
||||
fBacking = NULL;
|
||||
|
||||
Invalidate(Bounds());
|
||||
}
|
||||
|
||||
@ -533,6 +551,20 @@ BChannelSlider::DrawGroove(BView *into, int32 channel, BPoint leftTop,
|
||||
ASSERT(into != NULL);
|
||||
BRect rect(leftTop, bottomRight);
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
rect.InsetBy(-2.5, -2.5);
|
||||
rect.left = floorf(rect.left);
|
||||
rect.top = floorf(rect.top);
|
||||
rect.right = floorf(rect.right);
|
||||
rect.bottom = floorf(rect.bottom);
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
rgb_color barColor = be_control_look->SliderBarColor(base);
|
||||
uint32 flags = 0;
|
||||
be_control_look->DrawSliderBar(into, rect, rect, base,
|
||||
barColor, flags, Orientation());
|
||||
return;
|
||||
}
|
||||
|
||||
_DrawGrooveFrame(fBackingView, rect.InsetByCopy(-2.5, -2.5));
|
||||
|
||||
rect.InsetBy(-0.5, -0.5);
|
||||
@ -553,6 +585,22 @@ BChannelSlider::DrawThumb(BView* into, int32 channel, BPoint where, bool pressed
|
||||
where.x -= bitmapBounds.right / 2.0;
|
||||
where.y -= bitmapBounds.bottom / 2.0;
|
||||
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
BRect rect(bitmapBounds.OffsetToCopy(where));
|
||||
rect.InsetBy(1, 1);
|
||||
rect.left = floorf(rect.left);
|
||||
rect.top = floorf(rect.top);
|
||||
rect.right = ceilf(rect.right + 0.5);
|
||||
rect.bottom = ceilf(rect.bottom + 0.5);
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
uint32 flags = 0;
|
||||
be_control_look->DrawSliderThumb(into, rect, rect, base,
|
||||
flags, Orientation());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
into->PushState();
|
||||
|
||||
into->SetDrawingMode(B_OP_OVER);
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <CheckBox.h>
|
||||
|
||||
#include <ControlLook.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <Window.h>
|
||||
|
||||
@ -82,6 +83,26 @@ BCheckBox::Archive(BMessage *archive, bool deep) const
|
||||
void
|
||||
BCheckBox::Draw(BRect updateRect)
|
||||
{
|
||||
if (be_control_look) {
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
|
||||
uint32 flags = be_control_look->Flags(this);
|
||||
if (fOutlined)
|
||||
flags |= BControlLook::B_CLICKED;
|
||||
|
||||
BRect checkBoxRect(_CheckBoxFrame());
|
||||
BRect rect(checkBoxRect);
|
||||
be_control_look->DrawCheckBox(this, rect, updateRect,base, flags);
|
||||
|
||||
BRect labelRect(Bounds());
|
||||
labelRect.left = checkBoxRect.right
|
||||
+ be_control_look->DefaultLabelSpacing();
|
||||
|
||||
be_control_look->DrawLabel(this, Label(), labelRect, updateRect,
|
||||
base, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
font_height fontHeight;
|
||||
GetFontHeight(&fontHeight);
|
||||
|
||||
@ -551,7 +572,7 @@ BCheckBox::_CheckBoxFrame() const
|
||||
font_height fontHeight;
|
||||
GetFontHeight(&fontHeight);
|
||||
|
||||
return BRect(1.0f, 3.0f, ceilf(3.0f + fontHeight.ascent),
|
||||
return BRect(0.0f, 2.0f, ceilf(3.0f + fontHeight.ascent),
|
||||
ceilf(5.0f + fontHeight.ascent));
|
||||
}
|
||||
|
||||
|
@ -11,11 +11,12 @@
|
||||
|
||||
/** BColorControl displays a palette of selectable colors. */
|
||||
|
||||
#include <ColorControl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ColorControl.h>
|
||||
#include <ControlLook.h>
|
||||
#include <Bitmap.h>
|
||||
#include <TextControl.h>
|
||||
#include <Region.h>
|
||||
@ -391,16 +392,12 @@ BColorControl::Draw(BRect updateRect)
|
||||
if (!fBitmap->Lock())
|
||||
return;
|
||||
|
||||
if (fOffscreenView->Bounds().Intersects(updateRect)) {
|
||||
BRegion region(updateRect);
|
||||
ConstrainClippingRegion(®ion);
|
||||
if (fOffscreenView->Bounds().Intersects(updateRect))
|
||||
DrawBitmap(fBitmap, B_ORIGIN);
|
||||
ConstrainClippingRegion(NULL);
|
||||
}
|
||||
|
||||
fBitmap->Unlock();
|
||||
_DrawSelectors(this);
|
||||
|
||||
|
||||
} else {
|
||||
_DrawColorArea(this, updateRect);
|
||||
_DrawSelectors(this);
|
||||
@ -413,44 +410,56 @@ BColorControl::_DrawColorArea(BView* target, BRect update)
|
||||
{
|
||||
BRegion region(update);
|
||||
target->ConstrainClippingRegion(®ion);
|
||||
|
||||
rgb_color noTint = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
rgb_color lighten1 = tint_color(noTint, B_LIGHTEN_1_TINT);
|
||||
rgb_color lightenmax = tint_color(noTint, B_LIGHTEN_MAX_TINT);
|
||||
rgb_color darken1 = tint_color(noTint, B_DARKEN_1_TINT);
|
||||
rgb_color darken2 = tint_color(noTint, B_DARKEN_2_TINT);
|
||||
rgb_color darken4 = tint_color(noTint, B_DARKEN_4_TINT);
|
||||
|
||||
|
||||
BRect bevelRect = fPaletteFrame.InsetByCopy(-2.0,-2.0); //bevel
|
||||
|
||||
bool enabled = IsEnabled();
|
||||
|
||||
// First bevel
|
||||
if (enabled)
|
||||
target->SetHighColor(darken1);
|
||||
else
|
||||
|
||||
rgb_color noTint = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
rgb_color darken1 = tint_color(noTint, B_DARKEN_1_TINT);
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
uint32 flags = 0;
|
||||
if (!enabled)
|
||||
flags |= BControlLook::B_DISABLED;
|
||||
be_control_look->DrawTextControlBorder(target, bevelRect, update,
|
||||
noTint, flags);
|
||||
} else {
|
||||
rgb_color lighten1 = tint_color(noTint, B_LIGHTEN_1_TINT);
|
||||
rgb_color lightenmax = tint_color(noTint, B_LIGHTEN_MAX_TINT);
|
||||
rgb_color darken2 = tint_color(noTint, B_DARKEN_2_TINT);
|
||||
rgb_color darken4 = tint_color(noTint, B_DARKEN_4_TINT);
|
||||
|
||||
// First bevel
|
||||
if (enabled)
|
||||
target->SetHighColor(darken1);
|
||||
else
|
||||
target->SetHighColor(noTint);
|
||||
target->StrokeLine(bevelRect.LeftBottom(), bevelRect.LeftTop());
|
||||
target->StrokeLine(bevelRect.LeftTop(), bevelRect.RightTop());
|
||||
if (enabled)
|
||||
target->SetHighColor(lightenmax);
|
||||
else
|
||||
target->SetHighColor(lighten1);
|
||||
target->StrokeLine(BPoint(bevelRect.left + 1.0f, bevelRect.bottom),
|
||||
bevelRect.RightBottom());
|
||||
target->StrokeLine(bevelRect.RightBottom(),
|
||||
BPoint(bevelRect.right, bevelRect.top + 1.0f));
|
||||
|
||||
bevelRect.InsetBy(1.0f, 1.0f);
|
||||
|
||||
// Second bevel
|
||||
if (enabled)
|
||||
target->SetHighColor(darken4);
|
||||
else
|
||||
target->SetHighColor(darken2);
|
||||
target->StrokeLine(bevelRect.LeftBottom(), bevelRect.LeftTop());
|
||||
target->StrokeLine(bevelRect.LeftTop(), bevelRect.RightTop());
|
||||
target->SetHighColor(noTint);
|
||||
target->StrokeLine(bevelRect.LeftBottom(), bevelRect.LeftTop());
|
||||
target->StrokeLine(bevelRect.LeftTop(), bevelRect.RightTop());
|
||||
if (enabled)
|
||||
target->SetHighColor(lightenmax);
|
||||
else
|
||||
target->SetHighColor(lighten1);
|
||||
target->StrokeLine(BPoint(bevelRect.left + 1.0f, bevelRect.bottom), bevelRect.RightBottom());
|
||||
target->StrokeLine(bevelRect.RightBottom(), BPoint(bevelRect.right, bevelRect.top + 1.0f));
|
||||
|
||||
bevelRect.InsetBy(1.0f, 1.0f);
|
||||
|
||||
// Second bevel
|
||||
if (enabled)
|
||||
target->SetHighColor(darken4);
|
||||
else
|
||||
target->SetHighColor(darken2);
|
||||
target->StrokeLine(bevelRect.LeftBottom(), bevelRect.LeftTop());
|
||||
target->StrokeLine(bevelRect.LeftTop(), bevelRect.RightTop());
|
||||
target->SetHighColor(noTint);
|
||||
target->StrokeLine(BPoint(bevelRect.left + 1.0f, bevelRect.bottom), bevelRect.RightBottom());
|
||||
target->StrokeLine(bevelRect.RightBottom(), BPoint(bevelRect.right, bevelRect.top + 1.0f));
|
||||
target->StrokeLine(BPoint(bevelRect.left + 1.0f, bevelRect.bottom),
|
||||
bevelRect.RightBottom());
|
||||
target->StrokeLine(bevelRect.RightBottom(),
|
||||
BPoint(bevelRect.right, bevelRect.top + 1.0f));
|
||||
}
|
||||
|
||||
if (fPaletteMode) {
|
||||
int colBegin = max_c(0, -1 + int(update.left) / int(fCellSize));
|
||||
@ -501,7 +510,7 @@ BColorControl::_DrawColorArea(BView* target, BRect update)
|
||||
_ColorRamp(_RampFrame(3), target, blue, compColor, 0, false, update);
|
||||
}
|
||||
|
||||
ConstrainClippingRegion(NULL);
|
||||
target->ConstrainClippingRegion(NULL);
|
||||
}
|
||||
|
||||
|
||||
|
2041
src/kits/interface/ControlLook.cpp
Normal file
2041
src/kits/interface/ControlLook.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -167,6 +167,12 @@ BDragger::Draw(BRect update)
|
||||
// TODO: should draw it differently ?
|
||||
}
|
||||
} else if (IsVisibilityChanging()) {
|
||||
|
||||
//uint32 flags = Parent()->Flags();
|
||||
//Parent()->SetFlags(flags | B_DRAW_ON_CHILDREN);
|
||||
//Parent()->Draw(Frame());
|
||||
//Parent()->SetFlags(flags);
|
||||
|
||||
if (Parent())
|
||||
Parent()->Invalidate(Frame());
|
||||
|
||||
@ -204,7 +210,7 @@ BDragger::MouseDown(BPoint where)
|
||||
|
||||
while (true) {
|
||||
BPoint mousePoint;
|
||||
GetMouse(&mousePoint, &buttons);
|
||||
GetMouse(&mousePoint, &buttons, false);
|
||||
|
||||
if (!buttons || system_time() > time + clickSpeed)
|
||||
break;
|
||||
@ -226,10 +232,10 @@ BDragger::MouseDown(BPoint where)
|
||||
Archive(&archive);
|
||||
else {
|
||||
if (fTarget->Archive(&archive)) {
|
||||
BMessage widget(B_ARCHIVED_OBJECT);
|
||||
BMessage archivedSelf(B_ARCHIVED_OBJECT);
|
||||
|
||||
if (Archive(&widget))
|
||||
archive.AddMessage("__widget", &widget);
|
||||
if (Archive(&archivedSelf))
|
||||
archive.AddMessage("__widget", &archivedSelf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,7 +286,7 @@ BDragger::MessageReceived(BMessage *msg)
|
||||
// this code is used whenever the "are draggers drawn" option is changed
|
||||
if (fRelation == TARGET_IS_CHILD) {
|
||||
fTransition = true;
|
||||
Invalidate();
|
||||
Draw(Bounds());
|
||||
Flush();
|
||||
fTransition = false;
|
||||
} else {
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ControlLook.h>
|
||||
#include <Font.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <Menu.h>
|
||||
@ -932,6 +933,9 @@ _init_interface_kit_()
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
// TODO: Could support different themes here in the future.
|
||||
be_control_look = new BControlLook();
|
||||
|
||||
BPrivate::gWidthBuffer = new BPrivate::WidthBuffer;
|
||||
|
||||
_init_global_fonts_();
|
||||
@ -958,6 +962,9 @@ _fini_interface_kit_()
|
||||
delete BPrivate::gWidthBuffer;
|
||||
BPrivate::gWidthBuffer = NULL;
|
||||
|
||||
delete be_control_look;
|
||||
be_control_look = NULL;
|
||||
|
||||
// TODO: Anything else?
|
||||
|
||||
return B_OK;
|
||||
|
@ -55,6 +55,7 @@ MergeObject <libbe>interface_kit.o :
|
||||
ColorControl.cpp
|
||||
ColorTools.cpp
|
||||
Control.cpp
|
||||
ControlLook.cpp
|
||||
Deskbar.cpp
|
||||
Dragger.cpp
|
||||
Font.cpp
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ControlLook.h>
|
||||
#include <Debug.h>
|
||||
#include <File.h>
|
||||
#include <FindDirectory.h>
|
||||
@ -926,6 +927,7 @@ BMenu::Draw(BRect updateRect)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
DrawBackground(updateRect);
|
||||
_DrawItems(updateRect);
|
||||
}
|
||||
@ -1295,6 +1297,19 @@ BMenu::AddDynamicItem(add_state state)
|
||||
void
|
||||
BMenu::DrawBackground(BRect update)
|
||||
{
|
||||
if (be_control_look != NULL) {
|
||||
rgb_color base = sMenuInfo.background_color;
|
||||
uint32 flags = 0;
|
||||
if (!IsEnabled())
|
||||
flags |= BControlLook::B_DISABLED;
|
||||
if (IsFocus())
|
||||
flags |= BControlLook::B_FOCUSED;
|
||||
BRect rect = Bounds();
|
||||
be_control_look->DrawMenuBackground(this, rect, update, base);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
rgb_color oldColor = HighColor();
|
||||
SetHighColor(sMenuInfo.background_color);
|
||||
FillRect(Bounds() & update, B_SOLID_HIGH);
|
||||
@ -1410,12 +1425,6 @@ BMenu::_Show(bool selectFirstItem)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Move the BMenu to 1, 1, if it's attached to a BMenuWindow,
|
||||
// (that means it's a BMenu, BMenuBars are attached to regular BWindows).
|
||||
// This is needed to be able to draw the frame around the BMenu.
|
||||
if (dynamic_cast<BMenuWindow *>(window) != NULL)
|
||||
MoveTo(1, 1);
|
||||
|
||||
_UpdateWindowViewSize(true);
|
||||
window->Show();
|
||||
|
||||
@ -2584,19 +2593,19 @@ BMenu::_UpdateWindowViewSize(bool updatePosition)
|
||||
|
||||
if (fItems.CountItems() > 0) {
|
||||
if (!scroll) {
|
||||
window->ResizeTo(Bounds().Width() + 2, Bounds().Height() + 2);
|
||||
window->ResizeTo(Bounds().Width(), Bounds().Height());
|
||||
} else {
|
||||
BScreen screen(window);
|
||||
|
||||
// If we need scrolling, resize the window to fit the screen and
|
||||
// attach scrollers to our cached BMenuWindow.
|
||||
if (dynamic_cast<BMenuBar *>(Supermenu()) == NULL) {
|
||||
window->ResizeTo(Bounds().Width() + 2, screen.Frame().bottom);
|
||||
window->ResizeTo(Bounds().Width(), screen.Frame().bottom);
|
||||
frame.top = 0;
|
||||
} else {
|
||||
// Or, in case our parent was a BMenuBar enable scrolling with
|
||||
// normal size.
|
||||
window->ResizeTo(Bounds().Width() + 2, screen.Frame().bottom
|
||||
window->ResizeTo(Bounds().Width(), screen.Frame().bottom
|
||||
- frame.top);
|
||||
}
|
||||
|
||||
|
@ -1,18 +1,20 @@
|
||||
/*
|
||||
* Copyright 2001-2007, Haiku, Inc.
|
||||
* Copyright 2001-2009, Haiku, Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Marc Flerackers (mflerackers@androme.be)
|
||||
* Stefano Ceccherini (burton666@libero.it)
|
||||
* Stephan Aßmus <superstippi@gmx.de>
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <MenuBar.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <Application.h>
|
||||
#include <Autolock.h>
|
||||
#include <ControlLook.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <MenuItem.h>
|
||||
#include <Window.h>
|
||||
@ -149,6 +151,20 @@ BMenuBar::Draw(BRect updateRect)
|
||||
return;
|
||||
}
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
BRect rect(Bounds());
|
||||
rgb_color base = LowColor();
|
||||
uint32 flags = 0;
|
||||
|
||||
be_control_look->DrawBorder(this, rect, updateRect, base,
|
||||
B_PLAIN_BORDER, flags, BControlLook::B_BOTTOM_BORDER);
|
||||
|
||||
be_control_look->DrawMenuBarBackground(this, rect, updateRect, base);
|
||||
|
||||
_DrawItems(updateRect);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: implement additional border styles
|
||||
rgb_color color = HighColor();
|
||||
|
||||
|
@ -8,13 +8,15 @@
|
||||
* Ingo Weinhold <bonefish@cs.tu-berlin.de>
|
||||
*/
|
||||
|
||||
#include <MenuField.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <AbstractLayoutItem.h>
|
||||
#include <ControlLook.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <MenuBar.h>
|
||||
#include <MenuField.h>
|
||||
#include <Message.h>
|
||||
#include <BMCPrivate.h>
|
||||
#include <Window.h>
|
||||
@ -259,15 +261,24 @@ void
|
||||
BMenuField::Draw(BRect update)
|
||||
{
|
||||
BRect bounds(Bounds());
|
||||
bool active = false;
|
||||
|
||||
if (IsFocus())
|
||||
active = Window()->IsActive();
|
||||
bool active = IsFocus() && Window()->IsActive();
|
||||
|
||||
DrawLabel(bounds, update);
|
||||
|
||||
BRect frame(fMenuBar->Frame());
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
frame.InsetBy(-kVMargin, -kVMargin);
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
uint32 flags = 0;
|
||||
if (!fMenuBar->IsEnabled())
|
||||
flags |= BControlLook::B_DISABLED;
|
||||
if (active)
|
||||
flags |= BControlLook::B_FOCUSED;
|
||||
be_control_look->DrawButtonFrame(this, frame, update, base, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
if (frame.InsetByCopy(-kVMargin, -kVMargin).Intersects(update)) {
|
||||
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT));
|
||||
StrokeLine(BPoint(frame.left - 1.0f, frame.top - 1.0f),
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ControlLook.h>
|
||||
#include <Bitmap.h>
|
||||
#include <MenuItem.h>
|
||||
#include <Shape.h>
|
||||
@ -478,27 +479,44 @@ BMenuItem::Draw()
|
||||
bool enabled = IsEnabled();
|
||||
bool selected = IsSelected();
|
||||
|
||||
// rgb_color noTint = ui_color(B_MENU_BACKGROUND_COLOR);
|
||||
// TODO: the above is currently broken, because ui_color is
|
||||
// not informed of changes to the app_server palette yet
|
||||
rgb_color noTint = fSuper->LowColor();
|
||||
rgb_color bgColor = noTint;
|
||||
|
||||
if (be_control_look != NULL)
|
||||
fSuper->SetDrawingMode(B_OP_OVER);
|
||||
|
||||
// set low color and fill background if selected
|
||||
if (selected && (enabled || Submenu()) /*&& fSuper->fRedrawAfterSticky*/) {
|
||||
// bgColor = ui_color(B_MENU_SELECTED_BACKGROUND_COLOR);
|
||||
// see above
|
||||
bool activated = selected && (enabled || Submenu())
|
||||
/*&& fSuper->fRedrawAfterSticky*/;
|
||||
if (activated) {
|
||||
bgColor = tint_color(bgColor, B_DARKEN_3_TINT);
|
||||
if (be_control_look != NULL) {
|
||||
BRect rect = Frame();
|
||||
be_control_look->DrawMenuItemBackground(fSuper, rect, rect,
|
||||
noTint, BControlLook::B_ACTIVATED);
|
||||
} else {
|
||||
fSuper->SetLowColor(bgColor);
|
||||
fSuper->FillRect(Frame(), B_SOLID_LOW);
|
||||
}
|
||||
} else {
|
||||
fSuper->SetLowColor(bgColor);
|
||||
fSuper->FillRect(Frame(), B_SOLID_LOW);
|
||||
} else
|
||||
fSuper->SetLowColor(bgColor);
|
||||
}
|
||||
|
||||
// set high color
|
||||
if (enabled)
|
||||
fSuper->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
|
||||
else
|
||||
fSuper->SetHighColor(tint_color(bgColor, B_DISABLED_LABEL_TINT));
|
||||
if (be_control_look != NULL) {
|
||||
if (enabled) {
|
||||
fSuper->SetHighColor(tint_color(fSuper->LowColor(),
|
||||
B_DARKEN_MAX_TINT));
|
||||
} else {
|
||||
fSuper->SetHighColor(tint_color(fSuper->LowColor(),
|
||||
B_DISABLED_LABEL_TINT));
|
||||
}
|
||||
} else {
|
||||
if (enabled)
|
||||
fSuper->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
|
||||
else
|
||||
fSuper->SetHighColor(tint_color(bgColor, B_DISABLED_LABEL_TINT));
|
||||
}
|
||||
|
||||
// draw content
|
||||
fSuper->MovePenTo(ContentLocation());
|
||||
@ -719,9 +737,6 @@ BMenuItem::_DrawMarkSymbol(rgb_color bgColor)
|
||||
r.left = floorf(center.x - size / 2 + 0.5);
|
||||
r.right = floorf(center.x + size / 2 + 0.5);
|
||||
|
||||
fSuper->SetHighColor(tint_color(bgColor, kLightBGTint));
|
||||
fSuper->FillRoundRect(r, 2, 2);
|
||||
|
||||
BShape arrowShape;
|
||||
center.x += 0.5;
|
||||
center.y += 0.5;
|
||||
@ -819,9 +834,6 @@ BMenuItem::_DrawSubmenuSymbol(rgb_color bgColor)
|
||||
r.left = floorf(center.x - size / 2 + 0.5);
|
||||
r.right = floorf(center.x + size / 2 + 0.5);
|
||||
|
||||
fSuper->SetHighColor(tint_color(bgColor, kLightBGTint));
|
||||
fSuper->FillRoundRect(r, 2, 2);
|
||||
|
||||
BShape arrowShape;
|
||||
center.x += 0.5;
|
||||
center.y += 0.5;
|
||||
|
@ -9,11 +9,12 @@
|
||||
|
||||
//! BMenuWindow is a custom BWindow for BMenus.
|
||||
|
||||
#include <MenuWindow.h>
|
||||
|
||||
#include <ControlLook.h>
|
||||
#include <Debug.h>
|
||||
#include <Menu.h>
|
||||
|
||||
#include <MenuPrivate.h>
|
||||
#include <MenuWindow.h>
|
||||
#include <WindowPrivate.h>
|
||||
|
||||
|
||||
@ -194,15 +195,22 @@ void
|
||||
BMenuFrame::Draw(BRect updateRect)
|
||||
{
|
||||
if (fMenu != NULL && fMenu->CountItems() == 0) {
|
||||
// TODO: Review this as it's a bit hacky.
|
||||
// Menu has a size of 0, 0, since there are no items in it.
|
||||
// So the BMenuFrame class has to fake it and draw an empty item.
|
||||
// Note that we can't add a real "empty" item because then we couldn't
|
||||
// tell if the item was added by us or not.
|
||||
// See also BMenu::UpdateWindowViewSize()
|
||||
SetHighColor(ui_color(B_MENU_BACKGROUND_COLOR));
|
||||
SetLowColor(HighColor());
|
||||
FillRect(updateRect);
|
||||
if (be_control_look != NULL) {
|
||||
BRect rect(Bounds());
|
||||
be_control_look->DrawMenuBackground(this, rect, updateRect,
|
||||
ui_color(B_MENU_BACKGROUND_COLOR));
|
||||
SetDrawingMode(B_OP_OVER);
|
||||
} else {
|
||||
// TODO: Review this as it's a bit hacky.
|
||||
// Menu has a size of 0, 0, since there are no items in it.
|
||||
// So the BMenuFrame class has to fake it and draw an empty item.
|
||||
// Note that we can't add a real "empty" item because then we couldn't
|
||||
// tell if the item was added by us or not.
|
||||
// See also BMenu::UpdateWindowViewSize()
|
||||
SetHighColor(ui_color(B_MENU_BACKGROUND_COLOR));
|
||||
SetLowColor(HighColor());
|
||||
FillRect(updateRect);
|
||||
}
|
||||
|
||||
font_height height;
|
||||
GetFontHeight(&height);
|
||||
@ -211,7 +219,10 @@ BMenuFrame::Draw(BRect updateRect)
|
||||
DrawString(kEmptyMenuLabel, where);
|
||||
}
|
||||
|
||||
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT));
|
||||
if (be_control_look != NULL)
|
||||
return;
|
||||
|
||||
SetHighColor(tint_color(ui_color(B_MENU_BACKGROUND_COLOR), B_DARKEN_2_TINT));
|
||||
BRect bounds(Bounds());
|
||||
|
||||
StrokeLine(BPoint(bounds.right, bounds.top),
|
||||
@ -234,6 +245,7 @@ BMenuWindow::BMenuWindow(const char *name)
|
||||
fUpperScroller(NULL),
|
||||
fLowerScroller(NULL)
|
||||
{
|
||||
SetSizeLimits(2, 10000, 2, 10000);
|
||||
}
|
||||
|
||||
|
||||
@ -375,7 +387,7 @@ BMenuWindow::_Scroll(const BPoint &where)
|
||||
} else
|
||||
return false;
|
||||
|
||||
snooze(10000);
|
||||
snooze(5000);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include <RadioButton.h>
|
||||
|
||||
#include <ControlLook.h>
|
||||
#include <Debug.h>
|
||||
#include <Box.h>
|
||||
#include <LayoutUtils.h>
|
||||
@ -87,6 +88,27 @@ BRadioButton::Draw(BRect updateRect)
|
||||
// its size depends on the text height
|
||||
font_height fontHeight;
|
||||
GetFontHeight(&fontHeight);
|
||||
|
||||
if (be_control_look) {
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
|
||||
uint32 flags = be_control_look->Flags(this);
|
||||
if (fOutlined)
|
||||
flags |= BControlLook::B_CLICKED;
|
||||
|
||||
BRect knobRect(_KnobFrame(fontHeight));
|
||||
BRect rect(knobRect);
|
||||
be_control_look->DrawRadioButton(this, rect, updateRect, base, flags);
|
||||
|
||||
BRect labelRect(Bounds());
|
||||
labelRect.left = knobRect.right
|
||||
+ be_control_look->DefaultLabelSpacing();
|
||||
|
||||
be_control_look->DrawLabel(this, Label(), labelRect, updateRect,
|
||||
base, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
float textHeight = ceilf(fontHeight.ascent + fontHeight.descent);
|
||||
|
||||
// layout the rect for the dot
|
||||
@ -573,6 +595,12 @@ BRadioButton::_KnobFrame() const
|
||||
BRect
|
||||
BRadioButton::_KnobFrame(const font_height& fontHeight) const
|
||||
{
|
||||
if (be_control_look != NULL) {
|
||||
// Same as BCheckBox...
|
||||
return BRect(0.0f, 2.0f, ceilf(3.0f + fontHeight.ascent),
|
||||
ceilf(5.0f + fontHeight.ascent));
|
||||
}
|
||||
|
||||
// layout the rect for the dot
|
||||
BRect rect(Bounds());
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <ScrollBar.h>
|
||||
|
||||
#include <ControlLook.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <Message.h>
|
||||
#include <OS.h>
|
||||
@ -74,6 +75,7 @@ public:
|
||||
fStopValue(0.0),
|
||||
fUpArrowsEnabled(true),
|
||||
fDownArrowsEnabled(true),
|
||||
fBorderHighlighted(false),
|
||||
fButtonDown(NOARROW)
|
||||
{
|
||||
#ifdef TEST_MODE
|
||||
@ -123,6 +125,8 @@ public:
|
||||
bool fUpArrowsEnabled;
|
||||
bool fDownArrowsEnabled;
|
||||
|
||||
bool fBorderHighlighted;
|
||||
|
||||
int8 fButtonDown;
|
||||
};
|
||||
|
||||
@ -584,6 +588,26 @@ BScrollBar::Orientation() const
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BScrollBar::SetBorderHighlighted(bool state)
|
||||
{
|
||||
if (fPrivateData->fBorderHighlighted == state)
|
||||
return B_OK;
|
||||
|
||||
fPrivateData->fBorderHighlighted = state;
|
||||
|
||||
BRect dirty(Bounds());
|
||||
if (fOrientation == B_HORIZONTAL)
|
||||
dirty.bottom = dirty.top;
|
||||
else
|
||||
dirty.right = dirty.left;
|
||||
|
||||
Invalidate(dirty);
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BScrollBar::MessageReceived(BMessage* message)
|
||||
{
|
||||
@ -751,8 +775,33 @@ BScrollBar::Draw(BRect updateRect)
|
||||
|
||||
// stroke a dark frame arround the entire scrollbar
|
||||
// (independent of enabled state)
|
||||
// take care of border highlighting (scroll target is focus view)
|
||||
SetHighColor(tint_color(normal, B_DARKEN_2_TINT));
|
||||
StrokeRect(bounds);
|
||||
if (fPrivateData->fBorderHighlighted && fPrivateData->fEnabled) {
|
||||
rgb_color borderColor = HighColor();
|
||||
rgb_color highlightColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
|
||||
BeginLineArray(4);
|
||||
AddLine(BPoint(bounds.left + 1, bounds.bottom),
|
||||
BPoint(bounds.right, bounds.bottom), borderColor);
|
||||
AddLine(BPoint(bounds.right, bounds.top + 1),
|
||||
BPoint(bounds.right, bounds.bottom - 1), borderColor);
|
||||
if (fOrientation == B_HORIZONTAL) {
|
||||
AddLine(BPoint(bounds.left, bounds.top + 1),
|
||||
BPoint(bounds.left, bounds.bottom), borderColor);
|
||||
} else {
|
||||
AddLine(BPoint(bounds.left, bounds.top),
|
||||
BPoint(bounds.left, bounds.bottom), highlightColor);
|
||||
}
|
||||
if (fOrientation == B_HORIZONTAL) {
|
||||
AddLine(BPoint(bounds.left, bounds.top),
|
||||
BPoint(bounds.right, bounds.top), highlightColor);
|
||||
} else {
|
||||
AddLine(BPoint(bounds.left + 1, bounds.top),
|
||||
BPoint(bounds.right, bounds.top), borderColor);
|
||||
}
|
||||
EndLineArray();
|
||||
} else
|
||||
StrokeRect(bounds);
|
||||
bounds.InsetBy(1.0, 1.0);
|
||||
|
||||
bool enabled = fPrivateData->fEnabled && fMin < fMax
|
||||
@ -842,163 +891,176 @@ BScrollBar::Draw(BRect updateRect)
|
||||
// background for thumb area
|
||||
BRect rect(fPrivateData->fThumbFrame);
|
||||
|
||||
// frame
|
||||
if (fOrientation == B_HORIZONTAL) {
|
||||
int32 totalLines = 0;
|
||||
if (rect.left > thumbBG.left)
|
||||
totalLines += 1;
|
||||
if (rect.left > thumbBG.left + 1)
|
||||
totalLines += 3;
|
||||
if (rect.right < thumbBG.right - 1)
|
||||
totalLines += 3;
|
||||
if (rect.right < thumbBG.right)
|
||||
totalLines += 1;
|
||||
|
||||
if (totalLines > 0) {
|
||||
BeginLineArray(totalLines);
|
||||
if (rect.left > thumbBG.left) {
|
||||
AddLine(BPoint(thumbBG.left, thumbBG.bottom),
|
||||
BPoint(thumbBG.left, thumbBG.top),
|
||||
rect.left > thumbBG.left + 1 ? dark4 : dark);
|
||||
}
|
||||
if (rect.left > thumbBG.left + 1) {
|
||||
AddLine(BPoint(thumbBG.left + 1, thumbBG.top + 1),
|
||||
BPoint(thumbBG.left + 1, thumbBG.bottom), dark2);
|
||||
AddLine(BPoint(thumbBG.left + 1, thumbBG.top),
|
||||
BPoint(rect.left - 1, thumbBG.top), dark2);
|
||||
AddLine(BPoint(rect.left - 1, thumbBG.bottom),
|
||||
BPoint(thumbBG.left + 2, thumbBG.bottom), normal);
|
||||
}
|
||||
|
||||
if (rect.right < thumbBG.right - 1) {
|
||||
AddLine(BPoint(rect.right + 2, thumbBG.top + 1),
|
||||
BPoint(rect.right + 2, thumbBG.bottom), dark2);
|
||||
AddLine(BPoint(rect.right + 1, thumbBG.top),
|
||||
BPoint(thumbBG.right, thumbBG.top), dark2);
|
||||
AddLine(BPoint(thumbBG.right - 1, thumbBG.bottom),
|
||||
BPoint(rect.right + 3, thumbBG.bottom), normal);
|
||||
}
|
||||
if (rect.right < thumbBG.right) {
|
||||
AddLine(BPoint(thumbBG.right, thumbBG.top),
|
||||
BPoint(thumbBG.right, thumbBG.bottom), dark);
|
||||
}
|
||||
if (be_control_look == NULL) {
|
||||
if (fOrientation == B_HORIZONTAL) {
|
||||
BeginLineArray(8);
|
||||
|
||||
if (rect.left > thumbBG.left) {
|
||||
AddLine(BPoint(thumbBG.left, thumbBG.bottom),
|
||||
BPoint(thumbBG.left, thumbBG.top),
|
||||
rect.left > thumbBG.left + 1 ? dark4 : dark);
|
||||
}
|
||||
if (rect.left > thumbBG.left + 1) {
|
||||
AddLine(BPoint(thumbBG.left + 1, thumbBG.top + 1),
|
||||
BPoint(thumbBG.left + 1, thumbBG.bottom), dark2);
|
||||
AddLine(BPoint(thumbBG.left + 1, thumbBG.top),
|
||||
BPoint(rect.left - 1, thumbBG.top), dark2);
|
||||
AddLine(BPoint(rect.left - 1, thumbBG.bottom),
|
||||
BPoint(thumbBG.left + 2, thumbBG.bottom), normal);
|
||||
}
|
||||
|
||||
if (rect.right < thumbBG.right - 1) {
|
||||
AddLine(BPoint(rect.right + 2, thumbBG.top + 1),
|
||||
BPoint(rect.right + 2, thumbBG.bottom), dark2);
|
||||
AddLine(BPoint(rect.right + 1, thumbBG.top),
|
||||
BPoint(thumbBG.right, thumbBG.top), dark2);
|
||||
AddLine(BPoint(thumbBG.right - 1, thumbBG.bottom),
|
||||
BPoint(rect.right + 3, thumbBG.bottom), normal);
|
||||
}
|
||||
if (rect.right < thumbBG.right) {
|
||||
AddLine(BPoint(thumbBG.right, thumbBG.top),
|
||||
BPoint(thumbBG.right, thumbBG.bottom), dark);
|
||||
}
|
||||
|
||||
EndLineArray();
|
||||
}
|
||||
} else {
|
||||
int32 totalLines = 0;
|
||||
if (rect.top > thumbBG.top)
|
||||
totalLines += 1;
|
||||
if (rect.top > thumbBG.top + 1)
|
||||
totalLines += 3;
|
||||
if (rect.bottom < thumbBG.bottom - 1)
|
||||
totalLines += 3;
|
||||
if (rect.bottom < thumbBG.bottom)
|
||||
totalLines += 1;
|
||||
|
||||
if (totalLines > 0) {
|
||||
BeginLineArray(totalLines);
|
||||
if (rect.top > thumbBG.top) {
|
||||
AddLine(BPoint(thumbBG.left, thumbBG.top),
|
||||
BPoint(thumbBG.right, thumbBG.top),
|
||||
rect.top > thumbBG.top + 1 ? dark4 : dark);
|
||||
}
|
||||
if (rect.top > thumbBG.top + 1) {
|
||||
AddLine(BPoint(thumbBG.left + 1, thumbBG.top + 1),
|
||||
BPoint(thumbBG.right, thumbBG.top + 1), dark2);
|
||||
AddLine(BPoint(thumbBG.left, rect.top - 1),
|
||||
BPoint(thumbBG.left, thumbBG.top + 1), dark2);
|
||||
AddLine(BPoint(thumbBG.right, rect.top - 1),
|
||||
BPoint(thumbBG.right, thumbBG.top + 2), normal);
|
||||
}
|
||||
|
||||
if (rect.bottom < thumbBG.bottom - 1) {
|
||||
AddLine(BPoint(thumbBG.left + 1, rect.bottom + 2),
|
||||
BPoint(thumbBG.right, rect.bottom + 2), dark2);
|
||||
AddLine(BPoint(thumbBG.left, rect.bottom + 1),
|
||||
BPoint(thumbBG.left, thumbBG.bottom - 1), dark2);
|
||||
AddLine(BPoint(thumbBG.right, rect.bottom + 3),
|
||||
BPoint(thumbBG.right, thumbBG.bottom - 1), normal);
|
||||
}
|
||||
if (rect.bottom < thumbBG.bottom) {
|
||||
AddLine(BPoint(thumbBG.left, thumbBG.bottom),
|
||||
BPoint(thumbBG.right, thumbBG.bottom), dark);
|
||||
}
|
||||
} else {
|
||||
BeginLineArray(8);
|
||||
|
||||
if (rect.top > thumbBG.top) {
|
||||
AddLine(BPoint(thumbBG.left, thumbBG.top),
|
||||
BPoint(thumbBG.right, thumbBG.top),
|
||||
rect.top > thumbBG.top + 1 ? dark4 : dark);
|
||||
}
|
||||
if (rect.top > thumbBG.top + 1) {
|
||||
AddLine(BPoint(thumbBG.left + 1, thumbBG.top + 1),
|
||||
BPoint(thumbBG.right, thumbBG.top + 1), dark2);
|
||||
AddLine(BPoint(thumbBG.left, rect.top - 1),
|
||||
BPoint(thumbBG.left, thumbBG.top + 1), dark2);
|
||||
AddLine(BPoint(thumbBG.right, rect.top - 1),
|
||||
BPoint(thumbBG.right, thumbBG.top + 2), normal);
|
||||
}
|
||||
|
||||
if (rect.bottom < thumbBG.bottom - 1) {
|
||||
AddLine(BPoint(thumbBG.left + 1, rect.bottom + 2),
|
||||
BPoint(thumbBG.right, rect.bottom + 2), dark2);
|
||||
AddLine(BPoint(thumbBG.left, rect.bottom + 1),
|
||||
BPoint(thumbBG.left, thumbBG.bottom - 1), dark2);
|
||||
AddLine(BPoint(thumbBG.right, rect.bottom + 3),
|
||||
BPoint(thumbBG.right, thumbBG.bottom - 1), normal);
|
||||
}
|
||||
if (rect.bottom < thumbBG.bottom) {
|
||||
AddLine(BPoint(thumbBG.left, thumbBG.bottom),
|
||||
BPoint(thumbBG.right, thumbBG.bottom), dark);
|
||||
}
|
||||
|
||||
EndLineArray();
|
||||
}
|
||||
}
|
||||
|
||||
SetHighColor(dark1);
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
uint32 flags = 0;
|
||||
if (!enabled)
|
||||
flags |= BControlLook::B_DISABLED;
|
||||
|
||||
// fill background besides the thumb
|
||||
if (fOrientation == B_HORIZONTAL) {
|
||||
BRect leftOfThumb(thumbBG.left, thumbBG.top, rect.left - 1,
|
||||
thumbBG.bottom);
|
||||
BRect rightOfThumb(rect.right + 1, thumbBG.top, thumbBG.right,
|
||||
thumbBG.bottom);
|
||||
|
||||
be_control_look->DrawScrollBarBackground(this, leftOfThumb,
|
||||
rightOfThumb, updateRect, normal, flags, fOrientation);
|
||||
} else {
|
||||
BRect topOfThumb(thumbBG.left, thumbBG.top,
|
||||
thumbBG.right, rect.top - 1);
|
||||
|
||||
BRect bottomOfThumb(thumbBG.left, rect.bottom + 1,
|
||||
thumbBG.right, thumbBG.bottom);
|
||||
|
||||
be_control_look->DrawScrollBarBackground(this, topOfThumb,
|
||||
bottomOfThumb, updateRect, normal, flags, fOrientation);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw scroll thumb
|
||||
if (enabled) {
|
||||
// fill and additional dark lines
|
||||
thumbBG.InsetBy(1.0, 1.0);
|
||||
if (fOrientation == B_HORIZONTAL) {
|
||||
BRect leftOfThumb(thumbBG.left + 1, thumbBG.top, rect.left - 1,
|
||||
thumbBG.bottom);
|
||||
if (leftOfThumb.IsValid())
|
||||
FillRect(leftOfThumb);
|
||||
|
||||
BRect rightOfThumb(rect.right + 3, thumbBG.top, thumbBG.right,
|
||||
thumbBG.bottom);
|
||||
if (rightOfThumb.IsValid())
|
||||
FillRect(rightOfThumb);
|
||||
|
||||
// dark lines before and after thumb
|
||||
if (rect.left > thumbBG.left) {
|
||||
SetHighColor(dark);
|
||||
StrokeLine(BPoint(rect.left - 1, rect.top),
|
||||
BPoint(rect.left - 1, rect.bottom));
|
||||
}
|
||||
if (rect.right < thumbBG.right) {
|
||||
SetHighColor(dark4);
|
||||
StrokeLine(BPoint(rect.right + 1, rect.top),
|
||||
BPoint(rect.right + 1, rect.bottom));
|
||||
}
|
||||
} else {
|
||||
BRect topOfThumb(thumbBG.left, thumbBG.top + 1,
|
||||
thumbBG.right, rect.top - 1);
|
||||
if (topOfThumb.IsValid())
|
||||
FillRect(topOfThumb);
|
||||
|
||||
BRect bottomOfThumb(thumbBG.left, rect.bottom + 3,
|
||||
thumbBG.right, thumbBG.bottom);
|
||||
if (bottomOfThumb.IsValid())
|
||||
FillRect(bottomOfThumb);
|
||||
|
||||
// dark lines before and after thumb
|
||||
if (rect.top > thumbBG.top) {
|
||||
SetHighColor(dark);
|
||||
StrokeLine(BPoint(rect.left, rect.top - 1),
|
||||
BPoint(rect.right, rect.top - 1));
|
||||
}
|
||||
if (rect.bottom < thumbBG.bottom) {
|
||||
SetHighColor(dark4);
|
||||
StrokeLine(BPoint(rect.left, rect.bottom + 1),
|
||||
BPoint(rect.right, rect.bottom + 1));
|
||||
if (be_control_look == NULL) {
|
||||
// fill and additional dark lines
|
||||
thumbBG.InsetBy(1.0, 1.0);
|
||||
if (fOrientation == B_HORIZONTAL) {
|
||||
BRect leftOfThumb(thumbBG.left + 1, thumbBG.top, rect.left - 1,
|
||||
thumbBG.bottom);
|
||||
if (leftOfThumb.IsValid())
|
||||
FillRect(leftOfThumb);
|
||||
|
||||
BRect rightOfThumb(rect.right + 3, thumbBG.top, thumbBG.right,
|
||||
thumbBG.bottom);
|
||||
if (rightOfThumb.IsValid())
|
||||
FillRect(rightOfThumb);
|
||||
|
||||
// dark lines before and after thumb
|
||||
if (rect.left > thumbBG.left) {
|
||||
SetHighColor(dark);
|
||||
StrokeLine(BPoint(rect.left - 1, rect.top),
|
||||
BPoint(rect.left - 1, rect.bottom));
|
||||
}
|
||||
if (rect.right < thumbBG.right) {
|
||||
SetHighColor(dark4);
|
||||
StrokeLine(BPoint(rect.right + 1, rect.top),
|
||||
BPoint(rect.right + 1, rect.bottom));
|
||||
}
|
||||
} else {
|
||||
BRect topOfThumb(thumbBG.left, thumbBG.top + 1,
|
||||
thumbBG.right, rect.top - 1);
|
||||
if (topOfThumb.IsValid())
|
||||
FillRect(topOfThumb);
|
||||
|
||||
BRect bottomOfThumb(thumbBG.left, rect.bottom + 3,
|
||||
thumbBG.right, thumbBG.bottom);
|
||||
if (bottomOfThumb.IsValid())
|
||||
FillRect(bottomOfThumb);
|
||||
|
||||
// dark lines before and after thumb
|
||||
if (rect.top > thumbBG.top) {
|
||||
SetHighColor(dark);
|
||||
StrokeLine(BPoint(rect.left, rect.top - 1),
|
||||
BPoint(rect.right, rect.top - 1));
|
||||
}
|
||||
if (rect.bottom < thumbBG.bottom) {
|
||||
SetHighColor(dark4);
|
||||
StrokeLine(BPoint(rect.left, rect.bottom + 1),
|
||||
BPoint(rect.right, rect.bottom + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BeginLineArray(4);
|
||||
AddLine(BPoint(rect.left, rect.bottom),
|
||||
BPoint(rect.left, rect.top), light);
|
||||
AddLine(BPoint(rect.left + 1, rect.top),
|
||||
BPoint(rect.right, rect.top), light);
|
||||
AddLine(BPoint(rect.right, rect.top + 1),
|
||||
BPoint(rect.right, rect.bottom), dark1);
|
||||
AddLine(BPoint(rect.right - 1, rect.bottom),
|
||||
BPoint(rect.left + 1, rect.bottom), dark1);
|
||||
EndLineArray();
|
||||
|
||||
// fill
|
||||
rect.InsetBy(1.0, 1.0);
|
||||
/*if (fPrivateData->fButtonDown == THUMB)
|
||||
SetHighColor(tint_color(normal, (B_NO_TINT + B_DARKEN_1_TINT) / 2));
|
||||
else*/
|
||||
SetHighColor(normal);
|
||||
|
||||
FillRect(rect);
|
||||
|
||||
// fill the clickable surface of the thumb
|
||||
if (be_control_look) {
|
||||
be_control_look->DrawButtonBackground(this, rect, updateRect,
|
||||
normal, 0, BControlLook::B_ALL_BORDERS, fOrientation);
|
||||
} else {
|
||||
BeginLineArray(4);
|
||||
AddLine(BPoint(rect.left, rect.bottom),
|
||||
BPoint(rect.left, rect.top), light);
|
||||
AddLine(BPoint(rect.left + 1, rect.top),
|
||||
BPoint(rect.right, rect.top), light);
|
||||
AddLine(BPoint(rect.right, rect.top + 1),
|
||||
BPoint(rect.right, rect.bottom), dark1);
|
||||
AddLine(BPoint(rect.right - 1, rect.bottom),
|
||||
BPoint(rect.left + 1, rect.bottom), dark1);
|
||||
EndLineArray();
|
||||
|
||||
// fill
|
||||
rect.InsetBy(1.0, 1.0);
|
||||
/*if (fPrivateData->fButtonDown == THUMB)
|
||||
SetHighColor(tint_color(normal, (B_NO_TINT + B_DARKEN_1_TINT) / 2));
|
||||
else*/
|
||||
SetHighColor(normal);
|
||||
|
||||
FillRect(rect);
|
||||
}
|
||||
// TODO: Add the other thumb styles - dots and lines
|
||||
} else {
|
||||
if (fMin >= fMax || fProportion >= 1.0 || fProportion < 0.0) {
|
||||
@ -1708,8 +1770,18 @@ BScrollBar::_DrawArrowButton(int32 direction, bool doubleArrows, BRect r,
|
||||
}
|
||||
|
||||
r.InsetBy(-(hInset - 1), -(vInset - 1));
|
||||
SetHighColor(normal);
|
||||
FillRect(r);
|
||||
if (be_control_look != NULL) {
|
||||
BRect temp(r.InsetByCopy(-1, -1));
|
||||
uint32 flags = 0;
|
||||
if (down)
|
||||
flags |= BControlLook::B_ACTIVATED;
|
||||
be_control_look->DrawButtonBackground(this, temp, updateRect,
|
||||
down ? c : normal, flags, BControlLook::B_ALL_BORDERS,
|
||||
fOrientation);
|
||||
} else {
|
||||
SetHighColor(normal);
|
||||
FillRect(r);
|
||||
}
|
||||
|
||||
BShape arrowShape;
|
||||
arrowShape.MoveTo(tri1);
|
||||
@ -1721,6 +1793,9 @@ BScrollBar::_DrawArrowButton(int32 direction, bool doubleArrows, BRect r,
|
||||
StrokeShape(&arrowShape);
|
||||
SetPenSize(1.0);
|
||||
|
||||
if (be_control_look != NULL)
|
||||
return;
|
||||
|
||||
r.InsetBy(-1, -1);
|
||||
BeginLineArray(4);
|
||||
if (direction == ARROW_LEFT || direction == ARROW_RIGHT) {
|
||||
|
@ -2,12 +2,14 @@
|
||||
* Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#include <ScrollView.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ControlLook.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <ScrollView.h>
|
||||
#include <Message.h>
|
||||
#include <Region.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include <binary_compatibility/Interface.h>
|
||||
@ -90,6 +92,9 @@ BScrollView::_Init(bool horizontal, bool vertical)
|
||||
fVerticalScrollBar = NULL;
|
||||
fHighlighted = false;
|
||||
|
||||
if (be_control_look != NULL)
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
BRect targetFrame;
|
||||
if (fTarget) {
|
||||
// layout target and add it
|
||||
@ -218,6 +223,43 @@ BScrollView::AllDetached()
|
||||
void
|
||||
BScrollView::Draw(BRect updateRect)
|
||||
{
|
||||
if (be_control_look != NULL) {
|
||||
uint32 flags = 0;
|
||||
if (fHighlighted && Window()->IsActive())
|
||||
flags |= BControlLook::B_FOCUSED;
|
||||
BRect rect(Bounds());
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
if (fBorder == B_FANCY_BORDER
|
||||
&& fHorizontalScrollBar && fVerticalScrollBar) {
|
||||
BRect scrollCornerRect(rect);
|
||||
scrollCornerRect.left = fHorizontalScrollBar->Frame().right + 2;
|
||||
scrollCornerRect.top = fVerticalScrollBar->Frame().bottom + 2;
|
||||
BRegion region(rect);
|
||||
region.Exclude(scrollCornerRect);
|
||||
ConstrainClippingRegion(®ion);
|
||||
}
|
||||
|
||||
be_control_look->DrawBorder(this, rect, updateRect, base, fBorder,
|
||||
flags);
|
||||
|
||||
if (fBorder == B_FANCY_BORDER
|
||||
&& fHorizontalScrollBar && fVerticalScrollBar) {
|
||||
ConstrainClippingRegion(NULL);
|
||||
|
||||
rect = Bounds().InsetByCopy(1, 1);
|
||||
rect.right = fHorizontalScrollBar->Frame().right + 1;
|
||||
be_control_look->DrawBorder(this, rect, updateRect, base, fBorder,
|
||||
flags, BControlLook::B_RIGHT_BORDER);
|
||||
|
||||
rect = Bounds().InsetByCopy(1, 1);
|
||||
rect.bottom = fVerticalScrollBar->Frame().bottom + 1;
|
||||
be_control_look->DrawBorder(this, rect, updateRect, base, fBorder,
|
||||
flags, BControlLook::B_BOTTOM_BORDER);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (fBorder == B_PLAIN_BORDER) {
|
||||
SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_2_TINT));
|
||||
StrokeRect(Bounds());
|
||||
@ -339,7 +381,15 @@ BScrollView::SetBorderHighlighted(bool state)
|
||||
|
||||
fHighlighted = state;
|
||||
|
||||
if (fHorizontalScrollBar != NULL)
|
||||
fHorizontalScrollBar->SetBorderHighlighted(state);
|
||||
if (fVerticalScrollBar != NULL)
|
||||
fVerticalScrollBar->SetBorderHighlighted(state);
|
||||
|
||||
BRect bounds = Bounds();
|
||||
if (be_control_look != NULL)
|
||||
bounds.InsetBy(1, 1);
|
||||
|
||||
Invalidate(BRect(bounds.left, bounds.top, bounds.right, bounds.top));
|
||||
Invalidate(BRect(bounds.left, bounds.top + 1, bounds.left,
|
||||
bounds.bottom - 1));
|
||||
@ -444,11 +494,22 @@ BScrollView::FrameResized(float width, float height)
|
||||
if (fBorder == B_NO_BORDER)
|
||||
return;
|
||||
|
||||
// changes in width
|
||||
|
||||
BRect bounds = Bounds();
|
||||
float border = _BorderSize() - 1;
|
||||
|
||||
if (be_control_look && fHorizontalScrollBar && fVerticalScrollBar) {
|
||||
BRect scrollCorner(bounds);
|
||||
scrollCorner.left = min_c(
|
||||
fPreviousWidth - fVerticalScrollBar->Frame().Height(),
|
||||
fHorizontalScrollBar->Frame().right + 1);
|
||||
scrollCorner.top = min_c(
|
||||
fPreviousHeight - fHorizontalScrollBar->Frame().Width(),
|
||||
fVerticalScrollBar->Frame().bottom + 1);
|
||||
Invalidate(scrollCorner);
|
||||
}
|
||||
|
||||
// changes in width
|
||||
|
||||
if (bounds.Width() > fPreviousWidth) {
|
||||
// invalidate the region between the old and the new right border
|
||||
BRect rect = bounds;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <Bitmap.h>
|
||||
#include <ControlLook.h>
|
||||
#include <Errors.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <Message.h>
|
||||
@ -48,10 +49,7 @@ BSlider::BSlider(BRect frame, const char* name, const char* label,
|
||||
fOrientation(B_HORIZONTAL),
|
||||
fBarThickness(6.0)
|
||||
{
|
||||
SetBarColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||
B_DARKEN_4_TINT));
|
||||
|
||||
UseFillColor(false, NULL);
|
||||
_InitBarColor();
|
||||
|
||||
_InitObject();
|
||||
SetValue(0);
|
||||
@ -81,10 +79,7 @@ BSlider::BSlider(BRect frame, const char *name, const char *label,
|
||||
fOrientation(posture),
|
||||
fBarThickness(6.0)
|
||||
{
|
||||
SetBarColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||
B_DARKEN_4_TINT));
|
||||
|
||||
UseFillColor(false, NULL);
|
||||
_InitBarColor();
|
||||
|
||||
_InitObject();
|
||||
SetValue(0);
|
||||
@ -113,10 +108,7 @@ BSlider::BSlider(const char *name, const char *label, BMessage *message,
|
||||
fOrientation(posture),
|
||||
fBarThickness(6.0)
|
||||
{
|
||||
SetBarColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||
B_DARKEN_4_TINT));
|
||||
|
||||
UseFillColor(false, NULL);
|
||||
_InitBarColor();
|
||||
|
||||
_InitObject();
|
||||
SetValue(0);
|
||||
@ -212,6 +204,21 @@ BSlider::~BSlider()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BSlider::_InitBarColor()
|
||||
{
|
||||
if (be_control_look != NULL) {
|
||||
SetBarColor(be_control_look->SliderBarColor(
|
||||
ui_color(B_PANEL_BACKGROUND_COLOR)));
|
||||
} else {
|
||||
SetBarColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||
B_DARKEN_4_TINT));
|
||||
}
|
||||
|
||||
UseFillColor(false, NULL);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
BSlider::_InitObject()
|
||||
{
|
||||
@ -791,8 +798,17 @@ BSlider::Draw(BRect updateRect)
|
||||
// ToDo: the triangle thumb doesn't delete its background, so we still have
|
||||
// to do it Note, this also creates a different behaviour for subclasses,
|
||||
// depending on the thumb style - if possible this should be avoided.
|
||||
if (Style() == B_BLOCK_THUMB)
|
||||
background.Exclude(ThumbFrame());
|
||||
if (Style() == B_BLOCK_THUMB) {
|
||||
BRect thumbFrame = ThumbFrame();
|
||||
if (be_control_look != NULL) {
|
||||
// fill background where shadow will be...
|
||||
// TODO: Such drawint dependent behavior should be moved into
|
||||
// BControlLook of course.
|
||||
thumbFrame.right--;
|
||||
thumbFrame.bottom--;
|
||||
}
|
||||
background.Exclude(thumbFrame);
|
||||
}
|
||||
|
||||
#if USE_OFF_SCREEN_VIEW
|
||||
if (!fOffScreenBits)
|
||||
@ -849,6 +865,16 @@ BSlider::DrawBar()
|
||||
BRect frame = BarFrame();
|
||||
BView *view = OffscreenView();
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
uint32 flags = be_control_look->Flags(this);
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
rgb_color rightFillColor = fBarColor;
|
||||
rgb_color leftFillColor = fUseFillColor ? fFillColor : fBarColor;
|
||||
be_control_look->DrawSliderBar(view, frame, frame, base, leftFillColor,
|
||||
rightFillColor, Position(), flags, fOrientation);
|
||||
return;
|
||||
}
|
||||
|
||||
rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
rgb_color lightenmax;
|
||||
rgb_color darken1;
|
||||
@ -974,6 +1000,14 @@ BSlider::DrawHashMarks()
|
||||
BRect frame = HashMarksFrame();
|
||||
BView* view = OffscreenView();
|
||||
|
||||
if (be_control_look) {
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
uint32 flags = be_control_look->Flags(this);
|
||||
be_control_look->DrawSliderHashMarks(view, frame, frame, base,
|
||||
fHashMarkCount, fHashMarks, flags, fOrientation);
|
||||
return;
|
||||
}
|
||||
|
||||
rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
rgb_color lightenmax;
|
||||
rgb_color darken2;
|
||||
@ -1685,6 +1719,14 @@ BSlider::_DrawBlockThumb()
|
||||
BRect frame = ThumbFrame();
|
||||
BView *view = OffscreenView();
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
uint32 flags = be_control_look->Flags(this);
|
||||
be_control_look->DrawSliderThumb(view, frame, frame, base, flags,
|
||||
fOrientation);
|
||||
return;
|
||||
}
|
||||
|
||||
rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
rgb_color lighten2;
|
||||
rgb_color lighten1;
|
||||
@ -1811,6 +1853,14 @@ BSlider::_DrawTriangleThumb()
|
||||
BRect frame = ThumbFrame();
|
||||
BView *view = OffscreenView();
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
uint32 flags = be_control_look->Flags(this);
|
||||
be_control_look->DrawSliderTriangle(view, frame, frame, base, flags,
|
||||
fOrientation);
|
||||
return;
|
||||
}
|
||||
|
||||
rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
rgb_color lightenmax;
|
||||
rgb_color lighten1;
|
||||
|
@ -15,11 +15,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Message.h>
|
||||
#include <Region.h>
|
||||
|
||||
#include <ControlLook.h>
|
||||
#include <Layout.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <Message.h>
|
||||
#include <Region.h>
|
||||
|
||||
#include <binary_compatibility/Interface.h>
|
||||
|
||||
@ -265,6 +265,12 @@ BStatusBar::Draw(BRect updateRect)
|
||||
|
||||
rect = outerFrame;
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
be_control_look->DrawStatusBar(this, rect, updateRect,
|
||||
backgroundColor, fBarColor, _BarPosition(barFrame));
|
||||
return;
|
||||
}
|
||||
|
||||
// First bevel
|
||||
SetHighColor(tint_color(ui_color ( B_PANEL_BACKGROUND_COLOR ), B_DARKEN_1_TINT));
|
||||
StrokeLine(rect.LeftBottom(), rect.LeftTop());
|
||||
@ -411,6 +417,10 @@ BStatusBar::SetTo(float value, const char* text, const char* trailingText)
|
||||
update.right = ceilf(oldPosition);
|
||||
}
|
||||
|
||||
// TODO: Ask the BControlLook in the first place about dirty rect.
|
||||
if (be_control_look)
|
||||
update.InsetBy(-1, -1);
|
||||
|
||||
Invalidate(update);
|
||||
}
|
||||
|
||||
@ -794,6 +804,7 @@ BStatusBar::_BarPosition(const BRect& barFrame) const
|
||||
if (fCurrent == 0)
|
||||
return barFrame.left - 1;
|
||||
|
||||
return roundf(barFrame.left + ceilf(fCurrent * barFrame.Width() / fMax));
|
||||
return roundf(barFrame.left - 1
|
||||
+ (fCurrent * (barFrame.Width() + 3) / fMax));
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,14 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <CardLayout.h>
|
||||
#include <ControlLook.h>
|
||||
#include <GroupLayout.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <List.h>
|
||||
#include <Message.h>
|
||||
#include <PropertyInfo.h>
|
||||
#include <Rect.h>
|
||||
#include <Region.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
@ -251,6 +253,7 @@ BTab::DrawLabel(BView *owner, BRect frame)
|
||||
owner->GetFontHeight(&fh);
|
||||
}
|
||||
|
||||
owner->SetDrawingMode(B_OP_OVER);
|
||||
owner->SetHighColor(ui_color(B_CONTROL_TEXT_COLOR));
|
||||
owner->DrawString(label.String(),
|
||||
BPoint((frame.left + frame.right - width) / 2.0,
|
||||
@ -263,6 +266,38 @@ void
|
||||
BTab::DrawTab(BView *owner, BRect frame, tab_position position, bool full)
|
||||
{
|
||||
rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
// uint32 borders = BControlLook::B_RIGHT_BORDER
|
||||
// | BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER;
|
||||
// if (frame.left == owner->Bounds().left)
|
||||
// borders |= BControlLook::B_LEFT_BORDER;
|
||||
// be_control_look->DrawButtonFrame(owner, frame, frame,
|
||||
// no_tint, 0, borders);
|
||||
// if (position == B_TAB_FRONT)
|
||||
// no_tint = tint_color(no_tint, B_DARKEN_2_TINT);
|
||||
// be_control_look->DrawButtonBackground(owner, frame, frame, no_tint);
|
||||
|
||||
uint32 borders = BControlLook::B_TOP_BORDER
|
||||
| BControlLook::B_BOTTOM_BORDER;
|
||||
if (frame.left == owner->Bounds().left)
|
||||
borders |= BControlLook::B_LEFT_BORDER;
|
||||
if (frame.right == owner->Bounds().right)
|
||||
borders |= BControlLook::B_RIGHT_BORDER;
|
||||
|
||||
if (position == B_TAB_FRONT) {
|
||||
frame.bottom += 1;
|
||||
be_control_look->DrawActiveTab(owner, frame, frame, no_tint, 0,
|
||||
borders);
|
||||
} else {
|
||||
be_control_look->DrawInctiveTab(owner, frame, frame, no_tint, 0,
|
||||
borders);
|
||||
}
|
||||
|
||||
DrawLabel(owner, frame);
|
||||
return;
|
||||
}
|
||||
|
||||
rgb_color lightenmax = tint_color(no_tint, B_LIGHTEN_MAX_TINT);
|
||||
rgb_color darken2 = tint_color(no_tint, B_DARKEN_2_TINT);
|
||||
rgb_color darken3 = tint_color(no_tint, B_DARKEN_3_TINT);
|
||||
@ -782,7 +817,11 @@ BTabView::FocusTab() const
|
||||
void
|
||||
BTabView::Draw(BRect updateRect)
|
||||
{
|
||||
DrawBox(DrawTabs());
|
||||
if (be_control_look != NULL) {
|
||||
DrawBox(TabFrame(fSelection));
|
||||
DrawTabs();
|
||||
} else
|
||||
DrawBox(DrawTabs());
|
||||
|
||||
if (IsFocus() && fFocus != -1)
|
||||
TabAt(fFocus)->DrawFocusMark(this, TabFrame(fFocus));
|
||||
@ -792,10 +831,34 @@ BTabView::Draw(BRect updateRect)
|
||||
BRect
|
||||
BTabView::DrawTabs()
|
||||
{
|
||||
if (be_control_look != NULL) {
|
||||
// BRect rect(Bounds());
|
||||
// rect.bottom = rect.top + fTabHeight;
|
||||
// rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
// be_control_look->DrawButtonFrame(this, rect, rect, base);
|
||||
// be_control_look->DrawButtonBackground(this, rect, rect, base);
|
||||
}
|
||||
|
||||
float left = 0;
|
||||
|
||||
for (int32 i = 0; i < CountTabs(); i++) {
|
||||
TabAt(i)->DrawTab(this, TabFrame(i),
|
||||
BRect tabFrame = TabFrame(i);
|
||||
TabAt(i)->DrawTab(this, tabFrame,
|
||||
i == fSelection ? B_TAB_FRONT : (i == 0) ? B_TAB_FIRST : B_TAB_ANY,
|
||||
i + 1 != fSelection);
|
||||
left = tabFrame.right;
|
||||
}
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
BRect frame(Bounds());
|
||||
frame.left = left;
|
||||
frame.bottom = fTabHeight;
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
uint32 borders = BControlLook::B_TOP_BORDER
|
||||
| BControlLook::B_BOTTOM_BORDER | BControlLook::B_RIGHT_BORDER;
|
||||
if (left == 0)
|
||||
borders |= BControlLook::B_LEFT_BORDER;
|
||||
be_control_look->DrawInctiveTab(this, frame, frame, base, 0, borders);
|
||||
}
|
||||
|
||||
if (fSelection < CountTabs())
|
||||
@ -808,6 +871,24 @@ BTabView::DrawTabs()
|
||||
void
|
||||
BTabView::DrawBox(BRect selTabRect)
|
||||
{
|
||||
if (be_control_look != NULL) {
|
||||
BRect rect(Bounds());
|
||||
rect.top = selTabRect.bottom;
|
||||
|
||||
// BRegion clipping(Bounds());
|
||||
// selTabRect.left += 2;
|
||||
// selTabRect.right -= 2;
|
||||
// clipping.Exclude(selTabRect);
|
||||
// ConstrainClippingRegion(&clipping);
|
||||
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
be_control_look->DrawGroupFrame(this, rect, rect, base);
|
||||
|
||||
// ConstrainClippingRegion(NULL);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
BRect rect = Bounds();
|
||||
BRect lastTabRect = TabFrame(CountTabs() - 1);
|
||||
|
||||
@ -869,6 +950,38 @@ BTabView::DrawBox(BRect selTabRect)
|
||||
BRect
|
||||
BTabView::TabFrame(int32 tab_index) const
|
||||
{
|
||||
if (be_control_look != NULL) {
|
||||
float width = 100.0;
|
||||
float height = fTabHeight;;
|
||||
switch (fTabWidthSetting) {
|
||||
case B_WIDTH_FROM_LABEL:
|
||||
{
|
||||
float x = 0.0;
|
||||
for (int32 i = 0; i < tab_index; i++){
|
||||
x += StringWidth(TabAt(i)->Label()) + 20.0;
|
||||
}
|
||||
|
||||
return BRect(x, 0.0,
|
||||
x + StringWidth(TabAt(tab_index)->Label()) + 20.0,
|
||||
height);
|
||||
}
|
||||
|
||||
case B_WIDTH_FROM_WIDEST:
|
||||
width = 0.0;
|
||||
for (int32 i = 0; i < CountTabs(); i++) {
|
||||
float tabWidth = StringWidth(TabAt(i)->Label()) + 20.0;
|
||||
if (tabWidth > width)
|
||||
width = tabWidth;
|
||||
}
|
||||
// fall through
|
||||
|
||||
case B_WIDTH_AS_USUAL:
|
||||
default:
|
||||
return BRect(tab_index * width, 0.0,
|
||||
tab_index * width + width, height);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: fix to remove "offset" in DrawTab and DrawLabel ...
|
||||
switch (fTabWidthSetting) {
|
||||
case B_WIDTH_FROM_LABEL:
|
||||
@ -1128,7 +1241,8 @@ BTabView::ViewForTab(int32 tabIndex) const
|
||||
void
|
||||
BTabView::_InitObject(bool layouted, button_width width)
|
||||
{
|
||||
SetFont(be_bold_font);
|
||||
if (!be_control_look)
|
||||
SetFont(be_bold_font);
|
||||
|
||||
fTabList = new BList;
|
||||
|
||||
@ -1149,7 +1263,7 @@ BTabView::_InitObject(bool layouted, button_width width)
|
||||
if (layouted) {
|
||||
BGroupLayout* layout = new(std::nothrow) BGroupLayout(B_HORIZONTAL);
|
||||
if (layout) {
|
||||
layout->SetInsets(3.0, 3.0 + TabHeight(), 3.0, 3.0);
|
||||
layout->SetInsets(3.0, 3.0 + TabHeight() - 1, 3.0, 3.0);
|
||||
SetLayout(layout);
|
||||
}
|
||||
|
||||
|
@ -10,12 +10,13 @@
|
||||
|
||||
/*! BTextControl displays text that can act like a control. */
|
||||
|
||||
#include <TextControl.h>
|
||||
|
||||
#include <AbstractLayoutItem.h>
|
||||
#include <ControlLook.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <Message.h>
|
||||
#include <Region.h>
|
||||
#include <TextControl.h>
|
||||
#include <Window.h>
|
||||
|
||||
#include <binary_compatibility/Interface.h>
|
||||
@ -316,6 +317,34 @@ BTextControl::Divider() const
|
||||
void
|
||||
BTextControl::Draw(BRect updateRect)
|
||||
{
|
||||
bool enabled = IsEnabled();
|
||||
bool active = fText->IsFocus() && Window()->IsActive();
|
||||
|
||||
BRect rect = fText->Frame();
|
||||
rect.InsetBy(-2, -2);
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
uint32 flags = 0;
|
||||
if (!enabled)
|
||||
flags |= BControlLook::B_DISABLED;
|
||||
if (active)
|
||||
flags |= BControlLook::B_FOCUSED;
|
||||
be_control_look->DrawTextControlBorder(this, rect, updateRect, base,
|
||||
flags);
|
||||
|
||||
rect = Bounds();
|
||||
rect.right = fDivider - kLabelInputSpacing;
|
||||
// rect.right = fText->Frame().left - 2;
|
||||
// rect.right -= 3;//be_control_look->DefaultLabelSpacing();
|
||||
be_control_look->DrawLabel(this, Label(), rect, updateRect,
|
||||
base, flags, BAlignment(fLabelAlign, B_ALIGN_MIDDLE));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// outer bevel
|
||||
|
||||
rgb_color noTint = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
rgb_color lighten1 = tint_color(noTint, B_LIGHTEN_1_TINT);
|
||||
rgb_color lighten2 = tint_color(noTint, B_LIGHTEN_2_TINT);
|
||||
@ -325,17 +354,6 @@ BTextControl::Draw(BRect updateRect)
|
||||
rgb_color darken4 = tint_color(noTint, B_DARKEN_4_TINT);
|
||||
rgb_color navigationColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
|
||||
|
||||
bool enabled = IsEnabled();
|
||||
bool active = false;
|
||||
|
||||
if (fText->IsFocus() && Window()->IsActive())
|
||||
active = true;
|
||||
|
||||
// outer bevel
|
||||
|
||||
BRect rect = fText->Frame();
|
||||
rect.InsetBy(-2, -2);
|
||||
|
||||
if (enabled)
|
||||
SetHighColor(darken1);
|
||||
else
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <ControlLook.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <LayoutUtils.h>
|
||||
#include <Message.h>
|
||||
@ -168,7 +169,12 @@ _BTextInput_::AlignTextRect()
|
||||
BRect textRect(Bounds());
|
||||
textRect.left = 0.0;
|
||||
float vInset = max_c(1, floorf((textRect.Height() - LineHeight(0)) / 2.0));
|
||||
textRect.InsetBy(2, vInset);
|
||||
float hInset = 2;
|
||||
|
||||
if (be_control_look)
|
||||
hInset = be_control_look->DefaultLabelSpacing();
|
||||
|
||||
textRect.InsetBy(hInset, vInset);
|
||||
SetTextRect(textRect);
|
||||
}
|
||||
|
||||
|
@ -647,7 +647,7 @@ BTextView::MouseMoved(BPoint where, uint32 code, const BMessage *message)
|
||||
// Check if it's a "click'n'move
|
||||
if (_PerformMouseMoved(where, code))
|
||||
return;
|
||||
|
||||
|
||||
bool sync = false;
|
||||
switch (code) {
|
||||
// We force a sync when the mouse enters the view
|
||||
|
@ -39,6 +39,7 @@ All rights reserved.
|
||||
#include <Alert.h>
|
||||
#include <Application.h>
|
||||
#include <AppFileInfo.h>
|
||||
#include <ControlLook.h>
|
||||
#include <Debug.h>
|
||||
#include <Directory.h>
|
||||
#include <Entry.h>
|
||||
@ -499,12 +500,19 @@ DraggableContainerIcon::FrameMoved(BPoint /*newLocation*/)
|
||||
|
||||
|
||||
void
|
||||
DraggableContainerIcon::Draw(BRect /*updateRect*/)
|
||||
DraggableContainerIcon::Draw(BRect updateRect)
|
||||
{
|
||||
BContainerWindow *window = dynamic_cast<BContainerWindow *>(Window());
|
||||
if (window == NULL)
|
||||
return;
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
BRect rect(Bounds());
|
||||
rgb_color base = ui_color(B_MENU_BACKGROUND_COLOR);
|
||||
be_control_look->DrawMenuBarBackground(this, rect, updateRect, base,
|
||||
0);
|
||||
}
|
||||
|
||||
// Draw the icon, straddling the border
|
||||
#ifdef __HAIKU__
|
||||
SetDrawingMode(B_OP_ALPHA);
|
||||
@ -910,8 +918,8 @@ BContainerWindow::Init(const BMessage *message)
|
||||
fPoseView->MoveTo(BPoint(0, navigatorDelta + y_delta));
|
||||
fPoseView->ResizeBy(0, -(y_delta));
|
||||
if (fPoseView->VScrollBar()) {
|
||||
fPoseView->VScrollBar()->MoveBy(0, KeyMenuBar()->Bounds().Height() + 1);
|
||||
fPoseView->VScrollBar()->ResizeBy(0, -(KeyMenuBar()->Bounds().Height() + 1));
|
||||
fPoseView->VScrollBar()->MoveBy(0, KeyMenuBar()->Bounds().Height());
|
||||
fPoseView->VScrollBar()->ResizeBy(0, -(KeyMenuBar()->Bounds().Height()));
|
||||
}
|
||||
|
||||
// add folder icon to menu bar
|
||||
|
@ -37,6 +37,7 @@ All rights reserved.
|
||||
#include "CountView.h"
|
||||
|
||||
#include <Application.h>
|
||||
#include <ControlLook.h>
|
||||
|
||||
#include "AutoLock.h"
|
||||
#include "Bitmaps.h"
|
||||
@ -179,9 +180,19 @@ BCountView::CheckCount()
|
||||
|
||||
|
||||
void
|
||||
BCountView::Draw(BRect)
|
||||
BCountView::Draw(BRect updateRect)
|
||||
{
|
||||
BRect bounds(Bounds());
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
rgb_color base = ViewColor();
|
||||
SetHighColor(tint_color(base, B_DARKEN_2_TINT));
|
||||
StrokeLine(bounds.LeftTop(), bounds.RightTop());
|
||||
bounds.top++;
|
||||
be_control_look->DrawMenuBarBackground(this, bounds, updateRect,
|
||||
ViewColor());
|
||||
}
|
||||
|
||||
BString itemString;
|
||||
if (!IsTypingAhead()) {
|
||||
if (fLastCount == 0)
|
||||
@ -214,13 +225,16 @@ BCountView::Draw(BRect)
|
||||
rgb_color lightShadow = tint_color(ViewColor(), B_DARKEN_1_TINT);
|
||||
|
||||
BeginLineArray(fShowingBarberPole && !fStartSpinningAfter ? 9 : 5);
|
||||
AddLine(bounds.LeftTop(), bounds.RightTop(), light);
|
||||
AddLine(bounds.LeftTop(), bounds.LeftBottom(), light);
|
||||
bounds.top--;
|
||||
|
||||
AddLine(bounds.LeftTop(), bounds.RightTop(), shadow);
|
||||
AddLine(BPoint(bounds.right, bounds.top + 2), bounds.RightBottom(), lightShadow);
|
||||
AddLine(bounds.LeftBottom(), bounds.RightBottom(), lightShadow);
|
||||
if (be_control_look == NULL) {
|
||||
AddLine(bounds.LeftTop(), bounds.RightTop(), light);
|
||||
AddLine(bounds.LeftTop(), bounds.LeftBottom(), light);
|
||||
bounds.top--;
|
||||
|
||||
AddLine(bounds.LeftTop(), bounds.RightTop(), shadow);
|
||||
AddLine(BPoint(bounds.right, bounds.top + 2), bounds.RightBottom(), lightShadow);
|
||||
AddLine(bounds.LeftBottom(), bounds.RightBottom(), lightShadow);
|
||||
}
|
||||
|
||||
if (!fShowingBarberPole || fStartSpinningAfter) {
|
||||
EndLineArray();
|
||||
|
@ -37,6 +37,7 @@ All rights reserved.
|
||||
|
||||
#include <Alert.h>
|
||||
#include <Application.h>
|
||||
#include <ControlLook.h>
|
||||
#include <Debug.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <Window.h>
|
||||
@ -73,7 +74,7 @@ static void
|
||||
_DrawLine(BPoseView *view, BPoint from, BPoint to)
|
||||
{
|
||||
rgb_color highColor = view->HighColor();
|
||||
view->SetHighColor(kHighlightColor);
|
||||
view->SetHighColor(tint_color(view->LowColor(), B_DARKEN_1_TINT));
|
||||
view->StrokeLine(from, to);
|
||||
view->SetHighColor(highColor);
|
||||
}
|
||||
@ -89,7 +90,11 @@ _UndrawLine(BPoseView *view, BPoint from, BPoint to)
|
||||
static void
|
||||
_DrawOutline(BView *view, BRect where)
|
||||
{
|
||||
where.InsetBy(1, 1);
|
||||
if (be_control_look != NULL) {
|
||||
where.right++;
|
||||
where.bottom--;
|
||||
} else
|
||||
where.InsetBy(1, 1);
|
||||
rgb_color highColor = view->HighColor();
|
||||
view->SetHighColor(kHighlightColor);
|
||||
view->StrokeRect(where);
|
||||
@ -221,18 +226,28 @@ BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly,
|
||||
} else
|
||||
view = this;
|
||||
|
||||
// fill background with light gray background
|
||||
if (!updateOnly)
|
||||
view->FillRect(bounds, B_SOLID_LOW);
|
||||
if (be_control_look != NULL) {
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
view->SetHighColor(tint_color(base, B_DARKEN_2_TINT));
|
||||
view->StrokeLine(bounds.LeftBottom(), bounds.RightBottom());
|
||||
bounds.bottom--;
|
||||
|
||||
view->BeginLineArray(4);
|
||||
view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShadowColor);
|
||||
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sShadowColor);
|
||||
// draw lighter gray and white inset lines
|
||||
bounds.InsetBy(0, 1);
|
||||
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sLightShadowColor);
|
||||
view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShineColor);
|
||||
view->EndLineArray();
|
||||
be_control_look->DrawButtonBackground(view, bounds, bounds, base, 0,
|
||||
BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER);
|
||||
} else {
|
||||
// fill background with light gray background
|
||||
if (!updateOnly)
|
||||
view->FillRect(bounds, B_SOLID_LOW);
|
||||
|
||||
view->BeginLineArray(4);
|
||||
view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShadowColor);
|
||||
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sShadowColor);
|
||||
// draw lighter gray and white inset lines
|
||||
bounds.InsetBy(0, 1);
|
||||
view->AddLine(bounds.LeftBottom(), bounds.RightBottom(), sLightShadowColor);
|
||||
view->AddLine(bounds.LeftTop(), bounds.RightTop(), sShineColor);
|
||||
view->EndLineArray();
|
||||
}
|
||||
|
||||
int32 count = fTitleList.CountItems();
|
||||
float minx = bounds.right;
|
||||
@ -247,15 +262,22 @@ BTitleView::Draw(BRect /*updateRect*/, bool useOffscreen, bool updateOnly,
|
||||
maxx = titleBounds.right;
|
||||
}
|
||||
|
||||
// first and last shades before and after first column
|
||||
maxx++;
|
||||
minx--;
|
||||
view->BeginLineArray(2);
|
||||
view->AddLine(BPoint(minx, bounds.top),
|
||||
BPoint(minx, bounds.bottom), sShadowColor);
|
||||
view->AddLine(BPoint(maxx, bounds.top),
|
||||
BPoint(maxx, bounds.bottom), sShineColor);
|
||||
view->EndLineArray();
|
||||
if (be_control_look != NULL) {
|
||||
bounds = Bounds();
|
||||
minx--;
|
||||
view->SetHighColor(sLightShadowColor);
|
||||
view->StrokeLine(BPoint(minx, bounds.top), BPoint(minx, bounds.bottom - 1));
|
||||
} else {
|
||||
// first and last shades before and after first column
|
||||
maxx++;
|
||||
minx--;
|
||||
view->BeginLineArray(2);
|
||||
view->AddLine(BPoint(minx, bounds.top),
|
||||
BPoint(minx, bounds.bottom), sShadowColor);
|
||||
view->AddLine(BPoint(maxx, bounds.top),
|
||||
BPoint(maxx, bounds.bottom), sShineColor);
|
||||
view->EndLineArray();
|
||||
}
|
||||
|
||||
#if !(APP_SERVER_CLEARS_BACKGROUND)
|
||||
FillRect(BRect(bounds.left, bounds.top + 1, minx - 1, bounds.bottom - 1), B_SOLID_LOW);
|
||||
@ -460,8 +482,21 @@ BColumnTitle::Draw(BView *view, bool pressed)
|
||||
BRect bounds(Bounds());
|
||||
BPoint loc(0, bounds.bottom - 4);
|
||||
|
||||
view->SetLowColor(pressed ? sDarkTitleBackground : sTitleBackground);
|
||||
view->FillRect(bounds, B_SOLID_LOW);
|
||||
if (pressed) {
|
||||
if (be_control_look != NULL) {
|
||||
bounds.bottom--;
|
||||
BRect rect(bounds);
|
||||
rect.right--;
|
||||
rgb_color base = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||
B_DARKEN_1_TINT);
|
||||
|
||||
be_control_look->DrawButtonBackground(view, rect, rect, base, 0,
|
||||
BControlLook::B_TOP_BORDER | BControlLook::B_BOTTOM_BORDER);
|
||||
} else {
|
||||
view->SetLowColor(pressed ? sDarkTitleBackground : sTitleBackground);
|
||||
view->FillRect(bounds, B_SOLID_LOW);
|
||||
}
|
||||
}
|
||||
|
||||
BString titleString(fColumn->Title());
|
||||
view->TruncateString(&titleString, B_TRUNCATE_END,
|
||||
@ -483,43 +518,63 @@ BColumnTitle::Draw(BView *view, bool pressed)
|
||||
break;
|
||||
}
|
||||
|
||||
view->SetHighColor(0, 0, 0);
|
||||
view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), 1.75));
|
||||
view->DrawString(titleString.String(), loc);
|
||||
|
||||
// show sort columns
|
||||
bool secondary = (fColumn->AttrHash() == fParent->PoseView()->SecondarySort());
|
||||
if (secondary || (fColumn->AttrHash() == fParent->PoseView()->PrimarySort())) {
|
||||
BPoint pt1(loc);
|
||||
BPoint pt2(view->PenLocation());
|
||||
pt1.x--;
|
||||
pt2.x--;
|
||||
pt1.y++;
|
||||
pt2.y++;
|
||||
if (secondary)
|
||||
view->StrokeLine(pt1, pt2, B_MIXED_COLORS);
|
||||
else
|
||||
view->StrokeLine(pt1, pt2);
|
||||
|
||||
BPoint center(loc.x - 6, roundf((bounds.top + bounds.bottom) / 2.0));
|
||||
BPoint triangle[3];
|
||||
if (fParent->PoseView()->ReverseSort()) {
|
||||
triangle[0] = center + BPoint(-3.5, 1.5);
|
||||
triangle[1] = center + BPoint(3.5, 1.5);
|
||||
triangle[2] = center + BPoint(0.0, -2.0);
|
||||
} else {
|
||||
triangle[0] = center + BPoint(-3.5, -1.5);
|
||||
triangle[1] = center + BPoint(3.5, -1.5);
|
||||
triangle[2] = center + BPoint(0.0, 2.0);
|
||||
}
|
||||
|
||||
uint32 flags = view->Flags();
|
||||
view->SetFlags(flags | B_SUBPIXEL_PRECISE);
|
||||
|
||||
if (secondary) {
|
||||
view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), 1.3));
|
||||
view->FillTriangle(triangle[0], triangle[1], triangle[2]);
|
||||
} else {
|
||||
view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), 1.6));
|
||||
view->FillTriangle(triangle[0], triangle[1], triangle[2]);
|
||||
}
|
||||
|
||||
view->SetFlags(flags);
|
||||
}
|
||||
|
||||
BRect rect(bounds);
|
||||
if (be_control_look != NULL) {
|
||||
view->SetHighColor(sLightShadowColor);
|
||||
view->StrokeLine(bounds.RightTop(), bounds.RightBottom());
|
||||
} else {
|
||||
BRect rect(bounds);
|
||||
|
||||
view->SetHighColor(sShadowColor);
|
||||
view->StrokeRect(rect);
|
||||
view->SetHighColor(sShadowColor);
|
||||
view->StrokeRect(rect);
|
||||
|
||||
view->BeginLineArray(4);
|
||||
// draw lighter gray and white inset lines
|
||||
rect.InsetBy(1, 1);
|
||||
view->AddLine(rect.LeftBottom(), rect.RightBottom(),
|
||||
pressed ? sLightShadowColor : sLightShadowColor);
|
||||
view->AddLine(rect.LeftTop(), rect.RightTop(),
|
||||
pressed ? sDarkShadowColor : sShineColor);
|
||||
view->BeginLineArray(4);
|
||||
// draw lighter gray and white inset lines
|
||||
rect.InsetBy(1, 1);
|
||||
view->AddLine(rect.LeftBottom(), rect.RightBottom(),
|
||||
pressed ? sLightShadowColor : sLightShadowColor);
|
||||
view->AddLine(rect.LeftTop(), rect.RightTop(),
|
||||
pressed ? sDarkShadowColor : sShineColor);
|
||||
|
||||
view->AddLine(rect.LeftTop(), rect.LeftBottom(),
|
||||
pressed ? sDarkShadowColor : sShineColor);
|
||||
view->AddLine(rect.RightTop(), rect.RightBottom(),
|
||||
pressed ? sLightShadowColor : sLightShadowColor);
|
||||
|
||||
view->AddLine(rect.LeftTop(), rect.LeftBottom(),
|
||||
pressed ? sDarkShadowColor : sShineColor);
|
||||
view->AddLine(rect.RightTop(), rect.RightBottom(),
|
||||
pressed ? sLightShadowColor : sLightShadowColor);
|
||||
|
||||
view->EndLineArray();
|
||||
view->EndLineArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,7 +51,7 @@ class OffscreenBitmap;
|
||||
|
||||
const int32 kTitleViewHeight = 16;
|
||||
const int32 kEdgeSize = 6;
|
||||
const int32 kTitleColumnLeftExtraMargin = 10;
|
||||
const int32 kTitleColumnLeftExtraMargin = 11;
|
||||
const int32 kTitleColumnRightExtraMargin = 5;
|
||||
const int32 kTitleColumnExtraMargin = kTitleColumnLeftExtraMargin
|
||||
+ kTitleColumnRightExtraMargin;
|
||||
|
Loading…
Reference in New Issue
Block a user