While I'm at it update Tracker preferences ListView.

* Use be_control_look->DefaultLabelSpacing() instead of hard-coding 4px.
* Use pre-generated system colors.
* Indicate a pane is revertable by making the font bold instead of
  blue. This makes the revertable setting orthogonal with the
  selected setting (can be both bold and selected color).
This commit is contained in:
John Scipione
2012-11-24 11:37:51 -05:00
parent 63881c3a88
commit e1fb666f81
+13 -10
View File
@@ -35,6 +35,7 @@ All rights reserved.
#include <Catalog.h> #include <Catalog.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <InterfaceDefs.h>
#include <LayoutBuilder.h> #include <LayoutBuilder.h>
#include <Locale.h> #include <Locale.h>
#include <ScrollView.h> #include <ScrollView.h>
@@ -311,10 +312,6 @@ SettingsItem::SettingsItem(const char* label, SettingsView* view)
void void
SettingsItem::DrawItem(BView* owner, BRect rect, bool drawEverything) SettingsItem::DrawItem(BView* owner, BRect rect, bool drawEverything)
{ {
const rgb_color kModifiedColor = {0, 0, 255, 0};
const rgb_color kBlack = {0, 0, 0, 0};
const rgb_color kSelectedColor = {140, 140, 140, 0};
if (fSettingsView) { if (fSettingsView) {
bool isRevertable = fSettingsView->IsRevertable(); bool isRevertable = fSettingsView->IsRevertable();
bool isSelected = IsSelected(); bool isSelected = IsSelected();
@@ -322,7 +319,7 @@ SettingsItem::DrawItem(BView* owner, BRect rect, bool drawEverything)
if (isSelected || drawEverything) { if (isSelected || drawEverything) {
rgb_color color; rgb_color color;
if (isSelected) if (isSelected)
color = kSelectedColor; color = ui_color(B_LIST_SELECTED_BACKGROUND_COLOR);
else else
color = owner->ViewColor(); color = owner->ViewColor();
@@ -332,17 +329,23 @@ SettingsItem::DrawItem(BView* owner, BRect rect, bool drawEverything)
} }
if (isRevertable) if (isRevertable)
owner->SetHighColor(kModifiedColor); owner->SetFont(be_bold_font);
else else
owner->SetHighColor(kBlack); owner->SetFont(be_plain_font);
if (isSelected)
owner->SetHighColor(ui_color(B_LIST_SELECTED_ITEM_TEXT_COLOR));
else
owner->SetHighColor(ui_color(B_LIST_ITEM_TEXT_COLOR));
font_height fheight; font_height fheight;
owner->GetFontHeight(&fheight); owner->GetFontHeight(&fheight);
owner->DrawString(Text(), BPoint(rect.left + 4, rect.top owner->DrawString(Text(),
+ fheight.ascent + 2 + floorf(fheight.leading / 2))); BPoint(rect.left + be_control_look->DefaultLabelSpacing(),
rect.top + fheight.ascent + 2 + floorf(fheight.leading / 2)));
owner->SetHighColor(kBlack); owner->SetHighColor(ui_color(B_LIST_ITEM_TEXT_COLOR));
owner->SetLowColor(owner->ViewColor()); owner->SetLowColor(owner->ViewColor());
} }
} }