Icon-o-Matic: list views use system colors
* Fixes #10840. * Properties view needs more work for dark themes (There is another ticket for that).
This commit is contained in:
@@ -50,7 +50,10 @@ SimpleItem::Draw(BView *owner, BRect frame, uint32 flags)
|
|||||||
{
|
{
|
||||||
DrawBackground(owner, frame, flags);
|
DrawBackground(owner, frame, flags);
|
||||||
// label
|
// label
|
||||||
owner->SetHighColor(0, 0, 0, 255);
|
if (IsSelected())
|
||||||
|
owner->SetHighColor(ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR));
|
||||||
|
else
|
||||||
|
owner->SetHighColor(ui_color(B_LIST_ITEM_TEXT_COLOR));
|
||||||
font_height fh;
|
font_height fh;
|
||||||
owner->GetFontHeight(&fh);
|
owner->GetFontHeight(&fh);
|
||||||
const char* text = Text();
|
const char* text = Text();
|
||||||
@@ -78,12 +81,14 @@ SimpleItem::DrawBackground(BView *owner, BRect frame, uint32 flags)
|
|||||||
frame.InsetBy(1.0, 1.0);
|
frame.InsetBy(1.0, 1.0);
|
||||||
}
|
}
|
||||||
// figure out bg-color
|
// figure out bg-color
|
||||||
rgb_color color = (rgb_color){ 255, 255, 255, 255 };
|
rgb_color color = ui_color(B_LIST_BACKGROUND_COLOR);
|
||||||
|
|
||||||
|
if (IsSelected())
|
||||||
|
color = ui_color(B_LIST_SELECTED_BACKGROUND_COLOR);
|
||||||
|
|
||||||
if (flags & FLAGS_TINTED_LINE)
|
if (flags & FLAGS_TINTED_LINE)
|
||||||
color = tint_color(color, 1.06);
|
color = tint_color(color, 1.06);
|
||||||
// background
|
|
||||||
if (IsSelected())
|
|
||||||
color = tint_color(color, (B_DARKEN_1_TINT + B_DARKEN_2_TINT) / 2.0);
|
|
||||||
owner->SetLowColor(color);
|
owner->SetLowColor(color);
|
||||||
owner->FillRect(frame, B_SOLID_LOW);
|
owner->FillRect(frame, B_SOLID_LOW);
|
||||||
}
|
}
|
||||||
@@ -174,11 +179,11 @@ DragSortableListView::Draw(BRect updateRect)
|
|||||||
}
|
}
|
||||||
updateRect.top = r.bottom + 1.0;
|
updateRect.top = r.bottom + 1.0;
|
||||||
if (updateRect.IsValid()) {
|
if (updateRect.IsValid()) {
|
||||||
SetLowColor(255, 255, 255, 255);
|
SetLowColor(ui_color(B_LIST_BACKGROUND_COLOR));
|
||||||
FillRect(updateRect, B_SOLID_LOW);
|
FillRect(updateRect, B_SOLID_LOW);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SetLowColor(255, 255, 255, 255);
|
SetLowColor(ui_color(B_LIST_BACKGROUND_COLOR));
|
||||||
FillRect(updateRect, B_SOLID_LOW);
|
FillRect(updateRect, B_SOLID_LOW);
|
||||||
}
|
}
|
||||||
// drop anticipation indication
|
// drop anticipation indication
|
||||||
|
|||||||
@@ -54,11 +54,15 @@ PropertyItemView::Draw(BRect updateRect)
|
|||||||
BRect b(Bounds());
|
BRect b(Bounds());
|
||||||
|
|
||||||
// just draw background and label
|
// just draw background and label
|
||||||
rgb_color labelColor = LowColor();
|
rgb_color highColor = HighColor();
|
||||||
if (fEnabled)
|
rgb_color labelColor = highColor;
|
||||||
labelColor = tint_color(labelColor, B_DARKEN_MAX_TINT);
|
|
||||||
else
|
if (!fEnabled) {
|
||||||
labelColor = tint_color(labelColor, B_DISABLED_LABEL_TINT);
|
if (highColor.red + highColor.green + highColor.blue < 128 * 3)
|
||||||
|
labelColor = tint_color(HighColor(), B_LIGHTEN_2_TINT);
|
||||||
|
else
|
||||||
|
labelColor = tint_color(HighColor(), B_DARKEN_2_TINT);
|
||||||
|
}
|
||||||
|
|
||||||
SetHighColor(labelColor);
|
SetHighColor(labelColor);
|
||||||
BFont font;
|
BFont font;
|
||||||
@@ -76,9 +80,17 @@ PropertyItemView::Draw(BRect updateRect)
|
|||||||
+ fh.ascent / 2.0)));
|
+ fh.ascent / 2.0)));
|
||||||
|
|
||||||
// draw a "separator" line behind the label
|
// draw a "separator" line behind the label
|
||||||
SetHighColor(tint_color(LowColor(), B_DARKEN_1_TINT));
|
|
||||||
|
rgb_color lowColor = LowColor();
|
||||||
|
// Dark Themes
|
||||||
|
if (lowColor.red + lowColor.green + lowColor.blue > 128 * 3)
|
||||||
|
SetHighColor(tint_color(LowColor(), B_DARKEN_1_TINT));
|
||||||
|
else
|
||||||
|
SetHighColor(tint_color(LowColor(), B_LIGHTEN_1_TINT));
|
||||||
|
|
||||||
StrokeLine(BPoint(b.left + fLabelWidth - 1.0, b.top),
|
StrokeLine(BPoint(b.left + fLabelWidth - 1.0, b.top),
|
||||||
BPoint(b.left + fLabelWidth - 1.0, b.bottom), B_SOLID_HIGH);
|
BPoint(b.left + fLabelWidth - 1.0, b.bottom), B_SOLID_HIGH);
|
||||||
|
SetHighColor(highColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,10 +257,14 @@ PropertyItemView::UpdateObject()
|
|||||||
void
|
void
|
||||||
PropertyItemView::_UpdateLowColor()
|
PropertyItemView::_UpdateLowColor()
|
||||||
{
|
{
|
||||||
rgb_color lowColor = fParent ? fParent->LowColor() : kWhite;
|
rgb_color lowColor = fParent ? fParent->LowColor()
|
||||||
if (fSelected)
|
: ui_color(B_LIST_BACKGROUND_COLOR);
|
||||||
lowColor = tint_color(lowColor, B_DARKEN_2_TINT);
|
if (fSelected) {
|
||||||
|
lowColor = ui_color(B_LIST_SELECTED_BACKGROUND_COLOR);
|
||||||
|
SetHighColor(ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR));
|
||||||
|
} else {
|
||||||
|
SetHighColor(ui_color(B_LIST_ITEM_TEXT_COLOR));
|
||||||
|
}
|
||||||
if (lowColor != LowColor()) {
|
if (lowColor != LowColor()) {
|
||||||
SetLowColor(lowColor);
|
SetLowColor(lowColor);
|
||||||
Invalidate();
|
Invalidate();
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ PropertyListView::PropertyListView()
|
|||||||
fMouseWheelFilter(new MouseWheelFilter(this)),
|
fMouseWheelFilter(new MouseWheelFilter(this)),
|
||||||
fTabFilter(new TabFilter(this))
|
fTabFilter(new TabFilter(this))
|
||||||
{
|
{
|
||||||
SetLowColor(255, 255, 255, 255);
|
SetLowColor(ui_color(B_LIST_BACKGROUND_COLOR));
|
||||||
SetHighColor(0, 0, 0, 255);
|
SetHighColor(ui_color(B_LIST_ITEM_TEXT_COLOR));
|
||||||
SetViewColor(B_TRANSPARENT_32_BIT);
|
SetViewColor(B_TRANSPARENT_32_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,13 @@ IconObjectListView::Draw(BRect updateRect)
|
|||||||
const char* message3 = B_TRANSLATE_CONTEXT(
|
const char* message3 = B_TRANSLATE_CONTEXT(
|
||||||
"edit it's properties here.", "Empty property list - 3rd line");
|
"edit it's properties here.", "Empty property list - 3rd line");
|
||||||
|
|
||||||
SetHighColor(tint_color(LowColor(), B_DARKEN_2_TINT));
|
// Dark Themes
|
||||||
|
rgb_color lowColor = LowColor();
|
||||||
|
if (lowColor.red + lowColor.green + lowColor.blue > 128 * 3)
|
||||||
|
SetHighColor(tint_color(LowColor(), B_DARKEN_2_TINT));
|
||||||
|
else
|
||||||
|
SetHighColor(tint_color(LowColor(), B_LIGHTEN_2_TINT));
|
||||||
|
|
||||||
font_height fh;
|
font_height fh;
|
||||||
GetFontHeight(&fh);
|
GetFontHeight(&fh);
|
||||||
BRect b(Bounds());
|
BRect b(Bounds());
|
||||||
|
|||||||
@@ -74,7 +74,10 @@ public:
|
|||||||
SimpleItem::DrawBackground(owner, itemFrame, flags);
|
SimpleItem::DrawBackground(owner, itemFrame, flags);
|
||||||
|
|
||||||
// text
|
// text
|
||||||
owner->SetHighColor(0, 0, 0, 255);
|
if (IsSelected())
|
||||||
|
owner->SetHighColor(ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR));
|
||||||
|
else
|
||||||
|
owner->SetHighColor(ui_color(B_LIST_ITEM_TEXT_COLOR));
|
||||||
font_height fh;
|
font_height fh;
|
||||||
owner->GetFontHeight(&fh);
|
owner->GetFontHeight(&fh);
|
||||||
BString truncatedString(Text());
|
BString truncatedString(Text());
|
||||||
@@ -93,19 +96,29 @@ public:
|
|||||||
|
|
||||||
// mark
|
// mark
|
||||||
BRect markRect = itemFrame;
|
BRect markRect = itemFrame;
|
||||||
|
float MarkRectFillTint = B_DARKEN_1_TINT;
|
||||||
|
float MarkRectBorderTint = 1.04;
|
||||||
|
float MarkTint = B_DARKEN_4_TINT;
|
||||||
|
// Dark Themes
|
||||||
|
rgb_color lowColor = owner->LowColor();
|
||||||
|
if (lowColor.red + lowColor.green + lowColor.blue < 128 * 3) {
|
||||||
|
MarkRectFillTint = B_LIGHTEN_2_TINT;
|
||||||
|
MarkRectBorderTint = 0.85;
|
||||||
|
MarkTint = 0.1;
|
||||||
|
}
|
||||||
markRect.left += kBorderOffset;
|
markRect.left += kBorderOffset;
|
||||||
markRect.right = markRect.left + kMarkWidth;
|
markRect.right = markRect.left + kMarkWidth;
|
||||||
markRect.top = (markRect.top + markRect.bottom - kMarkWidth) / 2.0;
|
markRect.top = (markRect.top + markRect.bottom - kMarkWidth) / 2.0;
|
||||||
markRect.bottom = markRect.top + kMarkWidth;
|
markRect.bottom = markRect.top + kMarkWidth;
|
||||||
owner->SetHighColor(tint_color(owner->LowColor(), B_DARKEN_1_TINT));
|
owner->SetHighColor(tint_color(owner->LowColor(), MarkRectFillTint));
|
||||||
owner->StrokeRect(markRect);
|
owner->StrokeRect(markRect);
|
||||||
markRect.InsetBy(1, 1);
|
markRect.InsetBy(1, 1);
|
||||||
owner->SetHighColor(tint_color(owner->LowColor(), 1.04));
|
owner->SetHighColor(tint_color(owner->LowColor(), MarkRectBorderTint));
|
||||||
owner->FillRect(markRect);
|
owner->FillRect(markRect);
|
||||||
if (fMarked) {
|
if (fMarked) {
|
||||||
markRect.InsetBy(2, 2);
|
markRect.InsetBy(2, 2);
|
||||||
owner->SetHighColor(tint_color(owner->LowColor(),
|
owner->SetHighColor(tint_color(owner->LowColor(),
|
||||||
B_DARKEN_4_TINT));
|
MarkTint));
|
||||||
owner->SetPenSize(2);
|
owner->SetPenSize(2);
|
||||||
owner->StrokeLine(markRect.LeftTop(), markRect.RightBottom());
|
owner->StrokeLine(markRect.LeftTop(), markRect.RightBottom());
|
||||||
owner->StrokeLine(markRect.LeftBottom(), markRect.RightTop());
|
owner->StrokeLine(markRect.LeftBottom(), markRect.RightTop());
|
||||||
|
|||||||
@@ -77,7 +77,10 @@ public:
|
|||||||
SimpleItem::DrawBackground(owner, itemFrame, flags);
|
SimpleItem::DrawBackground(owner, itemFrame, flags);
|
||||||
|
|
||||||
// text
|
// text
|
||||||
owner->SetHighColor(0, 0, 0, 255);
|
if (IsSelected())
|
||||||
|
owner->SetHighColor(ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR));
|
||||||
|
else
|
||||||
|
owner->SetHighColor(ui_color(B_LIST_ITEM_TEXT_COLOR));
|
||||||
font_height fh;
|
font_height fh;
|
||||||
owner->GetFontHeight(&fh);
|
owner->GetFontHeight(&fh);
|
||||||
BString truncatedString(Text());
|
BString truncatedString(Text());
|
||||||
@@ -96,19 +99,29 @@ public:
|
|||||||
|
|
||||||
// mark
|
// mark
|
||||||
BRect markRect = itemFrame;
|
BRect markRect = itemFrame;
|
||||||
|
float MarkRectFillTint = B_DARKEN_1_TINT;
|
||||||
|
float MarkRectBorderTint = 1.04;
|
||||||
|
float MarkTint = B_DARKEN_4_TINT;
|
||||||
|
// Dark Themes
|
||||||
|
rgb_color lowColor = owner->LowColor();
|
||||||
|
if (lowColor.red + lowColor.green + lowColor.blue < 128 * 3) {
|
||||||
|
MarkRectFillTint = B_LIGHTEN_2_TINT;
|
||||||
|
MarkRectBorderTint = 0.85;
|
||||||
|
MarkTint = 0.1;
|
||||||
|
}
|
||||||
markRect.left += kBorderOffset;
|
markRect.left += kBorderOffset;
|
||||||
markRect.right = markRect.left + kMarkWidth;
|
markRect.right = markRect.left + kMarkWidth;
|
||||||
markRect.top = (markRect.top + markRect.bottom - kMarkWidth) / 2.0;
|
markRect.top = (markRect.top + markRect.bottom - kMarkWidth) / 2.0;
|
||||||
markRect.bottom = markRect.top + kMarkWidth;
|
markRect.bottom = markRect.top + kMarkWidth;
|
||||||
owner->SetHighColor(tint_color(owner->LowColor(), B_DARKEN_1_TINT));
|
owner->SetHighColor(tint_color(owner->LowColor(), MarkRectFillTint));
|
||||||
owner->StrokeRect(markRect);
|
owner->StrokeRect(markRect);
|
||||||
markRect.InsetBy(1, 1);
|
markRect.InsetBy(1, 1);
|
||||||
owner->SetHighColor(tint_color(owner->LowColor(), 1.04));
|
owner->SetHighColor(tint_color(owner->LowColor(), MarkRectBorderTint));
|
||||||
owner->FillRect(markRect);
|
owner->FillRect(markRect);
|
||||||
if (fMarked) {
|
if (fMarked) {
|
||||||
markRect.InsetBy(2, 2);
|
markRect.InsetBy(2, 2);
|
||||||
owner->SetHighColor(tint_color(owner->LowColor(),
|
owner->SetHighColor(tint_color(owner->LowColor(),
|
||||||
B_DARKEN_4_TINT));
|
MarkTint));
|
||||||
owner->SetPenSize(2);
|
owner->SetPenSize(2);
|
||||||
owner->StrokeLine(markRect.LeftTop(), markRect.RightBottom());
|
owner->StrokeLine(markRect.LeftTop(), markRect.RightBottom());
|
||||||
owner->StrokeLine(markRect.LeftBottom(), markRect.RightTop());
|
owner->StrokeLine(markRect.LeftBottom(), markRect.RightTop());
|
||||||
|
|||||||
@@ -140,7 +140,13 @@ TransformerListView::Draw(BRect updateRect)
|
|||||||
const char* message2 = B_TRANSLATE_CONTEXT("to attach transformers.",
|
const char* message2 = B_TRANSLATE_CONTEXT("to attach transformers.",
|
||||||
"Empty transformers list - 2nd line");
|
"Empty transformers list - 2nd line");
|
||||||
|
|
||||||
SetHighColor(tint_color(LowColor(), B_DARKEN_2_TINT));
|
// Dark Themes
|
||||||
|
rgb_color lowColor = LowColor();
|
||||||
|
if (lowColor.red + lowColor.green + lowColor.blue > 128 * 3)
|
||||||
|
SetHighColor(tint_color(LowColor(), B_DARKEN_2_TINT));
|
||||||
|
else
|
||||||
|
SetHighColor(tint_color(LowColor(), B_LIGHTEN_2_TINT));
|
||||||
|
|
||||||
font_height fh;
|
font_height fh;
|
||||||
GetFontHeight(&fh);
|
GetFontHeight(&fh);
|
||||||
BRect b(Bounds());
|
BRect b(Bounds());
|
||||||
|
|||||||
Reference in New Issue
Block a user