Teammonitor: Respect system colors
Change-Id: I5cc69376ade425c46bc76f8179f93bb74428da68 Reviewed-on: https://review.haiku-os.org/c/haiku/+/3261 Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
committed by
Adrien Destugues
parent
0b07cea059
commit
4b1f514b08
@@ -66,26 +66,23 @@ TeamListItem::CacheLocalizedName()
|
|||||||
void
|
void
|
||||||
TeamListItem::DrawItem(BView* owner, BRect frame, bool complete)
|
TeamListItem::DrawItem(BView* owner, BRect frame, bool complete)
|
||||||
{
|
{
|
||||||
rgb_color kHighlight = { 140, 140, 140, 0 };
|
rgb_color kHighlight = ui_color(B_LIST_SELECTED_BACKGROUND_COLOR);
|
||||||
rgb_color kBlack = { 0, 0, 0, 0 };
|
rgb_color kHighlightText = ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR);
|
||||||
rgb_color kBlue = { 0, 0, 255, 0 };
|
rgb_color kText = ui_color(B_LIST_ITEM_TEXT_COLOR);
|
||||||
rgb_color kRed = { 255, 0, 0, 0 };
|
|
||||||
|
rgb_color kIdealRed = { 255, 0, 0, 0 };
|
||||||
|
rgb_color kIdealBlue = { 0, 0, 255, 0 };
|
||||||
|
rgb_color kRed = mix_color(kIdealRed, kText, 191);
|
||||||
|
rgb_color kBlue = mix_color(kIdealBlue, kText, 191);
|
||||||
|
rgb_color kHighlightRed = mix_color(kIdealRed, kHighlightText, 191);
|
||||||
|
rgb_color kHighlightBlue = mix_color(kIdealBlue, kHighlightText, 191);
|
||||||
|
|
||||||
BRect r(frame);
|
BRect r(frame);
|
||||||
|
|
||||||
if (IsSelected() || complete) {
|
if (IsSelected() || complete) {
|
||||||
rgb_color color;
|
owner->SetHighColor(kHighlight);
|
||||||
if (IsSelected())
|
owner->SetLowColor(kHighlight);
|
||||||
color = kHighlight;
|
|
||||||
else
|
|
||||||
color = owner->ViewColor();
|
|
||||||
|
|
||||||
owner->SetHighColor(color);
|
|
||||||
owner->SetLowColor(color);
|
|
||||||
owner->FillRect(r);
|
owner->FillRect(r);
|
||||||
owner->SetHighColor(kBlack);
|
|
||||||
} else {
|
|
||||||
owner->SetLowColor(owner->ViewColor());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
frame.left += 4;
|
frame.left += 4;
|
||||||
@@ -99,10 +96,13 @@ TeamListItem::DrawItem(BView* owner, BRect frame, bool complete)
|
|||||||
|
|
||||||
frame.left += 16;
|
frame.left += 16;
|
||||||
if (fRefusingToQuit)
|
if (fRefusingToQuit)
|
||||||
owner->SetHighColor(kRed);
|
owner->SetHighColor(IsSelected() ? kHighlightRed : kRed);
|
||||||
else
|
else {
|
||||||
owner->SetHighColor(IsSystemServer() ? kBlue : kBlack);
|
if (IsSystemServer())
|
||||||
|
owner->SetHighColor(IsSelected() ? kHighlightBlue : kBlue);
|
||||||
|
else
|
||||||
|
owner->SetHighColor(IsSelected() ? kHighlightText : kText);
|
||||||
|
}
|
||||||
BFont font = be_plain_font;
|
BFont font = be_plain_font;
|
||||||
font_height finfo;
|
font_height finfo;
|
||||||
font.GetHeight(&finfo);
|
font.GetHeight(&finfo);
|
||||||
@@ -150,19 +150,19 @@ TeamListItem::IsSystemServer()
|
|||||||
static BPath systemServersPath;
|
static BPath systemServersPath;
|
||||||
static BPath trackerPath;
|
static BPath trackerPath;
|
||||||
static BPath deskbarPath;
|
static BPath deskbarPath;
|
||||||
|
|
||||||
if (firstCall) {
|
if (firstCall) {
|
||||||
find_directory(B_SYSTEM_SERVERS_DIRECTORY, &systemServersPath);
|
find_directory(B_SYSTEM_SERVERS_DIRECTORY, &systemServersPath);
|
||||||
|
|
||||||
find_directory(B_SYSTEM_DIRECTORY, &trackerPath);
|
find_directory(B_SYSTEM_DIRECTORY, &trackerPath);
|
||||||
trackerPath.Append("Tracker");
|
trackerPath.Append("Tracker");
|
||||||
|
|
||||||
find_directory(B_SYSTEM_DIRECTORY, &deskbarPath);
|
find_directory(B_SYSTEM_DIRECTORY, &deskbarPath);
|
||||||
deskbarPath.Append("Deskbar");
|
deskbarPath.Append("Deskbar");
|
||||||
|
|
||||||
firstCall = false;
|
firstCall = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(systemServersPath.Path(), fTeamInfo.args,
|
if (strncmp(systemServersPath.Path(), fTeamInfo.args,
|
||||||
strlen(systemServersPath.Path())) == 0)
|
strlen(systemServersPath.Path())) == 0)
|
||||||
return true;
|
return true;
|
||||||
@@ -174,8 +174,8 @@ TeamListItem::IsSystemServer()
|
|||||||
if (strncmp(deskbarPath.Path(), fTeamInfo.args,
|
if (strncmp(deskbarPath.Path(), fTeamInfo.args,
|
||||||
strlen(deskbarPath.Path())) == 0)
|
strlen(deskbarPath.Path())) == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user