Skip to content

Commit

Permalink
BCalendarView: Use system color.
Browse files Browse the repository at this point in the history
* This widget is used in Time and Deskbar.
* Partialy fixes #10840.
  • Loading branch information
janus2 committed May 2, 2015
1 parent 91a14c7 commit 99e015b
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/kits/shared/CalendarView.cpp
Expand Up @@ -157,6 +157,8 @@ BCalendarView::AttachedToWindow()

if (!Messenger().IsValid())
SetTarget(Window(), NULL);

SetViewColor(ui_color(B_LIST_BACKGROUND_COLOR));
}


Expand Down Expand Up @@ -1013,13 +1015,19 @@ BCalendarView::_DrawItem(BView* owner, BRect frame, const char* text,
rgb_color lColor = LowColor();
rgb_color highColor = HighColor();

rgb_color lowColor = { 255, 255, 255, 255 };
rgb_color textColor = ui_color(B_LIST_ITEM_TEXT_COLOR);
float tintDisabled = B_LIGHTEN_2_TINT;

if (textColor.red + textColor.green + textColor.blue > 125 * 3)
tintDisabled = B_DARKEN_2_TINT;

if (isSelected) {
SetHighColor(tint_color(lowColor, B_DARKEN_2_TINT));
SetLowColor(HighColor());
SetHighColor(ui_color(B_LIST_SELECTED_BACKGROUND_COLOR));
textColor = ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR);
} else
SetHighColor(lowColor);
SetHighColor(ui_color(B_LIST_BACKGROUND_COLOR));

SetLowColor(HighColor());

FillRect(frame.InsetByCopy(1.0, 1.0));

Expand All @@ -1028,10 +1036,9 @@ BCalendarView::_DrawItem(BView* owner, BRect frame, const char* text,
StrokeRect(frame.InsetByCopy(1.0, 1.0));
}

rgb_color black = { 0, 0, 0, 255 };
SetHighColor(black);
SetHighColor(textColor);
if (!isEnabled)
SetHighColor(tint_color(black, B_LIGHTEN_2_TINT));
SetHighColor(tint_color(textColor, tintDisabled));

float offsetH = frame.Width() / 2.0;
float offsetV = frame.Height() / 2.0 + FontHeight(owner) / 2.0 - 2.0;
Expand Down

0 comments on commit 99e015b

Please sign in to comment.