Interface Kit: Remove more non-BControlLook code.
This commit is contained in:
parent
3b9755d72f
commit
bfbb965580
@ -349,8 +349,7 @@ _BMCMenuBar_::_Init()
|
||||
bottom--;
|
||||
#endif
|
||||
|
||||
if (be_control_look != NULL)
|
||||
left = right = be_control_look->DefaultLabelSpacing();
|
||||
left = right = be_control_look->DefaultLabelSpacing();
|
||||
|
||||
SetItemMargins(left, top,
|
||||
right + fShowPopUpMarker ? kPopUpIndicatorWidth : 0, bottom);
|
||||
|
@ -679,13 +679,8 @@ BBox::_DrawPlain(BRect labelBox)
|
||||
|
||||
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;
|
||||
}
|
||||
lightTint = B_LIGHTEN_1_TINT;
|
||||
shadowTint = B_DARKEN_1_TINT;
|
||||
|
||||
if (rect.Height() == 0.0 || rect.Width() == 0.0) {
|
||||
// used as separator
|
||||
@ -718,65 +713,18 @@ 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);
|
||||
|
||||
rgb_color base = ViewColor();
|
||||
if (rect.Height() == 1.0) {
|
||||
// used as horizontal separator
|
||||
BeginLineArray(2);
|
||||
AddLine(BPoint(rect.left, rect.top),
|
||||
BPoint(rect.right, rect.top), shadow);
|
||||
AddLine(BPoint(rect.left, rect.bottom),
|
||||
BPoint(rect.right, rect.bottom), light);
|
||||
EndLineArray();
|
||||
be_control_look->DrawGroupFrame(this, rect, rect, base,
|
||||
BControlLook::B_TOP_BORDER);
|
||||
} else if (rect.Width() == 1.0) {
|
||||
// used as vertical separator
|
||||
BeginLineArray(2);
|
||||
AddLine(BPoint(rect.left, rect.top),
|
||||
BPoint(rect.left, rect.bottom), shadow);
|
||||
AddLine(BPoint(rect.right, rect.top),
|
||||
BPoint(rect.right, rect.bottom), light);
|
||||
EndLineArray();
|
||||
be_control_look->DrawGroupFrame(this, rect, rect, base,
|
||||
BControlLook::B_LEFT_BORDER);
|
||||
} else {
|
||||
// used as box
|
||||
BeginLineArray(8);
|
||||
AddLine(BPoint(rect.left, rect.bottom - 1.0),
|
||||
BPoint(rect.left, rect.top), shadow);
|
||||
AddLine(BPoint(rect.left + 1.0, rect.top),
|
||||
BPoint(rect.right - 1.0, rect.top), shadow);
|
||||
AddLine(BPoint(rect.left, rect.bottom),
|
||||
BPoint(rect.right, rect.bottom), light);
|
||||
AddLine(BPoint(rect.right, rect.bottom - 1.0),
|
||||
BPoint(rect.right, rect.top), light);
|
||||
|
||||
rect.InsetBy(1.0, 1.0);
|
||||
|
||||
AddLine(BPoint(rect.left, rect.bottom - 1.0),
|
||||
BPoint(rect.left, rect.top), light);
|
||||
AddLine(BPoint(rect.left + 1.0, rect.top),
|
||||
BPoint(rect.right - 1.0, rect.top), light);
|
||||
AddLine(BPoint(rect.left, rect.bottom),
|
||||
BPoint(rect.right, rect.bottom), shadow);
|
||||
AddLine(BPoint(rect.right, rect.bottom - 1.0),
|
||||
BPoint(rect.right, rect.top), shadow);
|
||||
EndLineArray();
|
||||
be_control_look->DrawGroupFrame(this, rect, rect, base);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -430,40 +430,9 @@ BColorControl::_DrawColorArea(BView* target, BRect updateRect)
|
||||
rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||
rgb_color darken1 = tint_color(base, B_DARKEN_1_TINT);
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
uint32 flags = be_control_look->Flags(this);
|
||||
be_control_look->DrawTextControlBorder(target, rect, updateRect,
|
||||
base, flags);
|
||||
} else {
|
||||
// first bevel
|
||||
rgb_color lighten1 = tint_color(base, B_LIGHTEN_1_TINT);
|
||||
rgb_color lightenmax = tint_color(base, B_LIGHTEN_MAX_TINT);
|
||||
target->SetHighColor(enabled ? darken1 : base);
|
||||
|
||||
target->StrokeLine(rect.LeftBottom(), rect.LeftTop());
|
||||
target->StrokeLine(rect.LeftTop(), rect.RightTop());
|
||||
target->SetHighColor(enabled ? lightenmax : lighten1);
|
||||
|
||||
target->StrokeLine(BPoint(rect.left + 1.0f, rect.bottom),
|
||||
rect.RightBottom());
|
||||
target->StrokeLine(rect.RightBottom(),
|
||||
BPoint(rect.right, rect.top + 1.0f));
|
||||
|
||||
rect.InsetBy(1.0f, 1.0f);
|
||||
|
||||
// second bevel
|
||||
rgb_color darken2 = tint_color(base, B_DARKEN_2_TINT);
|
||||
rgb_color darken4 = tint_color(base, B_DARKEN_4_TINT);
|
||||
target->SetHighColor(enabled ? darken4 : darken2);
|
||||
|
||||
target->StrokeLine(rect.LeftBottom(), rect.LeftTop());
|
||||
target->StrokeLine(rect.LeftTop(), rect.RightTop());
|
||||
target->SetHighColor(base);
|
||||
target->StrokeLine(BPoint(rect.left + 1.0f, rect.bottom),
|
||||
rect.RightBottom());
|
||||
target->StrokeLine(rect.RightBottom(),
|
||||
BPoint(rect.right, rect.top + 1.0f));
|
||||
}
|
||||
uint32 flags = be_control_look->Flags(this);
|
||||
be_control_look->DrawTextControlBorder(target, rect, updateRect,
|
||||
base, flags);
|
||||
|
||||
if (fPaletteMode) {
|
||||
int colBegin = max_c(0, -1 + int(updateRect.left) / int(fCellSize));
|
||||
|
@ -1407,38 +1407,29 @@ BMenu::AddDynamicItem(add_state state)
|
||||
void
|
||||
BMenu::DrawBackground(BRect updateRect)
|
||||
{
|
||||
if (be_control_look != NULL) {
|
||||
rgb_color base = ui_color(B_MENU_BACKGROUND_COLOR);
|
||||
uint32 flags = 0;
|
||||
if (!IsEnabled())
|
||||
flags |= BControlLook::B_DISABLED;
|
||||
rgb_color base = ui_color(B_MENU_BACKGROUND_COLOR);
|
||||
uint32 flags = 0;
|
||||
if (!IsEnabled())
|
||||
flags |= BControlLook::B_DISABLED;
|
||||
|
||||
if (IsFocus())
|
||||
flags |= BControlLook::B_FOCUSED;
|
||||
if (IsFocus())
|
||||
flags |= BControlLook::B_FOCUSED;
|
||||
|
||||
BRect rect = Bounds();
|
||||
uint32 borders = BControlLook::B_LEFT_BORDER
|
||||
| BControlLook::B_RIGHT_BORDER;
|
||||
if (Window() != NULL && Parent() != NULL) {
|
||||
if (Parent()->Frame().top == Window()->Bounds().top)
|
||||
borders |= BControlLook::B_TOP_BORDER;
|
||||
BRect rect = Bounds();
|
||||
uint32 borders = BControlLook::B_LEFT_BORDER
|
||||
| BControlLook::B_RIGHT_BORDER;
|
||||
if (Window() != NULL && Parent() != NULL) {
|
||||
if (Parent()->Frame().top == Window()->Bounds().top)
|
||||
borders |= BControlLook::B_TOP_BORDER;
|
||||
|
||||
if (Parent()->Frame().bottom == Window()->Bounds().bottom)
|
||||
borders |= BControlLook::B_BOTTOM_BORDER;
|
||||
} else {
|
||||
borders |= BControlLook::B_TOP_BORDER
|
||||
| BControlLook::B_BOTTOM_BORDER;
|
||||
}
|
||||
be_control_look->DrawMenuBackground(this, rect, updateRect, base, 0,
|
||||
borders);
|
||||
|
||||
return;
|
||||
if (Parent()->Frame().bottom == Window()->Bounds().bottom)
|
||||
borders |= BControlLook::B_BOTTOM_BORDER;
|
||||
} else {
|
||||
borders |= BControlLook::B_TOP_BORDER
|
||||
| BControlLook::B_BOTTOM_BORDER;
|
||||
}
|
||||
|
||||
rgb_color oldColor = HighColor();
|
||||
SetHighColor(ui_color(B_MENU_BACKGROUND_COLOR));
|
||||
FillRect(Bounds() & updateRect, B_SOLID_HIGH);
|
||||
SetHighColor(oldColor);
|
||||
be_control_look->DrawMenuBackground(this, rect, updateRect, base, 0,
|
||||
borders);
|
||||
}
|
||||
|
||||
|
||||
|
@ -541,8 +541,7 @@ BScrollView::SetBorderHighlighted(bool highlight)
|
||||
fVerticalScrollBar->SetBorderHighlighted(highlight);
|
||||
|
||||
BRect bounds = Bounds();
|
||||
if (be_control_look != NULL)
|
||||
bounds.InsetBy(1, 1);
|
||||
bounds.InsetBy(1, 1);
|
||||
|
||||
Invalidate(BRect(bounds.left, bounds.top, bounds.right, bounds.top));
|
||||
Invalidate(BRect(bounds.left, bounds.top + 1, bounds.left,
|
||||
@ -737,8 +736,7 @@ BScrollView::_Init(bool horizontal, bool vertical)
|
||||
fHighlighted = false;
|
||||
fBorders = BControlLook::B_ALL_BORDERS;
|
||||
|
||||
if (be_control_look != NULL)
|
||||
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
|
||||
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
|
||||
|
||||
if (horizontal) {
|
||||
fHorizontalScrollBar = new BScrollBar(BRect(0, 0, 14, 14), "_HSB_",
|
||||
|
@ -345,59 +345,8 @@ 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(backgroundColor, B_DARKEN_1_TINT));
|
||||
StrokeLine(rect.LeftBottom(), rect.LeftTop());
|
||||
StrokeLine(rect.RightTop());
|
||||
|
||||
SetHighColor(tint_color(backgroundColor, B_LIGHTEN_2_TINT));
|
||||
StrokeLine(BPoint(rect.left + 1, rect.bottom), rect.RightBottom());
|
||||
StrokeLine(BPoint(rect.right, rect.top + 1));
|
||||
|
||||
rect.InsetBy(1, 1);
|
||||
|
||||
// Second bevel
|
||||
SetHighColor(tint_color(backgroundColor, B_DARKEN_4_TINT));
|
||||
StrokeLine(rect.LeftBottom(), rect.LeftTop());
|
||||
StrokeLine(rect.RightTop());
|
||||
|
||||
SetHighColor(backgroundColor);
|
||||
StrokeLine(BPoint(rect.left + 1, rect.bottom), rect.RightBottom());
|
||||
StrokeLine(BPoint(rect.right, rect.top + 1));
|
||||
|
||||
rect = barFrame;
|
||||
rect.right = _BarPosition(barFrame);
|
||||
|
||||
// draw bar itself
|
||||
|
||||
if (rect.right >= rect.left) {
|
||||
// Bevel
|
||||
SetHighColor(tint_color(fBarColor, B_LIGHTEN_2_TINT));
|
||||
StrokeLine(rect.LeftBottom(), rect.LeftTop());
|
||||
StrokeLine(rect.RightTop());
|
||||
|
||||
SetHighColor(tint_color(fBarColor, B_DARKEN_2_TINT));
|
||||
StrokeLine(BPoint(rect.left + 1, rect.bottom), rect.RightBottom());
|
||||
StrokeLine(BPoint(rect.right, rect.top + 1));
|
||||
|
||||
// filling
|
||||
SetHighColor(fBarColor);
|
||||
FillRect(rect.InsetByCopy(1, 1));
|
||||
}
|
||||
|
||||
if (rect.right < barFrame.right) {
|
||||
// empty space
|
||||
rect.left = rect.right + 1;
|
||||
rect.right = barFrame.right;
|
||||
SetHighColor(tint_color(backgroundColor, B_LIGHTEN_MAX_TINT));
|
||||
FillRect(rect);
|
||||
}
|
||||
be_control_look->DrawStatusBar(this, rect, updateRect,
|
||||
backgroundColor, fBarColor, _BarPosition(barFrame));
|
||||
}
|
||||
|
||||
|
||||
@ -595,8 +544,7 @@ BStatusBar::SetTo(float value, const char* text, const char* trailingText)
|
||||
}
|
||||
|
||||
// TODO: Ask the BControlLook in the first place about dirty rect.
|
||||
if (be_control_look != NULL)
|
||||
update.InsetBy(-1, -1);
|
||||
update.InsetBy(-1, -1);
|
||||
|
||||
Invalidate(update);
|
||||
}
|
||||
|
@ -176,24 +176,22 @@ _BTextInput_::AlignTextRect()
|
||||
float hInset = 2;
|
||||
float textFontWidth = TextRect().right;
|
||||
|
||||
if (be_control_look != NULL) {
|
||||
switch (Alignment()) {
|
||||
case B_ALIGN_LEFT:
|
||||
hInset = be_control_look->DefaultLabelSpacing();
|
||||
break;
|
||||
switch (Alignment()) {
|
||||
case B_ALIGN_LEFT:
|
||||
hInset = be_control_look->DefaultLabelSpacing();
|
||||
break;
|
||||
|
||||
case B_ALIGN_RIGHT:
|
||||
hInset = textRect.right - textFontWidth;
|
||||
hInset -= be_control_look->DefaultLabelSpacing();
|
||||
break;
|
||||
case B_ALIGN_RIGHT:
|
||||
hInset = textRect.right - textFontWidth;
|
||||
hInset -= be_control_look->DefaultLabelSpacing();
|
||||
break;
|
||||
|
||||
case B_ALIGN_CENTER:
|
||||
hInset = (textRect.right - textFontWidth) / 2.0;
|
||||
break;
|
||||
case B_ALIGN_CENTER:
|
||||
hInset = (textRect.right - textFontWidth) / 2.0;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
textRect.InsetBy(hInset, vInset);
|
||||
|
Loading…
Reference in New Issue
Block a user