Update ListItem's to use menu item colors.
* Selected bg uses B_MENU_SELECTED_BACKGROUND_COLOR * Selected text uses B_MENU_SELECTED_ITEM_TEXT_COLOR * Unselected text uses B_MENU_ITEM_TEXT_COLOR Update BStringItem, but also the custom Listitem code in the Appearance and Locale preflets.
This commit is contained in:
@@ -77,7 +77,7 @@ BStringItem::DrawItem(BView *owner, BRect frame, bool complete)
|
|||||||
|
|
||||||
if (IsSelected() || complete) {
|
if (IsSelected() || complete) {
|
||||||
if (IsSelected()) {
|
if (IsSelected()) {
|
||||||
owner->SetHighColor(tint_color(lowColor, B_DARKEN_2_TINT));
|
owner->SetHighColor(ui_color(B_MENU_SELECTED_BACKGROUND_COLOR));
|
||||||
owner->SetLowColor(owner->HighColor());
|
owner->SetLowColor(owner->HighColor());
|
||||||
} else
|
} else
|
||||||
owner->SetHighColor(lowColor);
|
owner->SetHighColor(lowColor);
|
||||||
@@ -87,12 +87,18 @@ BStringItem::DrawItem(BView *owner, BRect frame, bool complete)
|
|||||||
|
|
||||||
owner->MovePenTo(frame.left, frame.top + fBaselineOffset);
|
owner->MovePenTo(frame.left, frame.top + fBaselineOffset);
|
||||||
|
|
||||||
rgb_color black = {0, 0, 0, 255};
|
if (!IsEnabled()) {
|
||||||
|
rgb_color textColor = ui_color(B_MENU_ITEM_TEXT_COLOR);
|
||||||
if (!IsEnabled())
|
if (textColor.red + textColor.green + textColor.blue > 128 * 3)
|
||||||
owner->SetHighColor(tint_color(black, B_LIGHTEN_2_TINT));
|
owner->SetHighColor(tint_color(textColor, B_DARKEN_2_TINT));
|
||||||
else
|
else
|
||||||
owner->SetHighColor(black);
|
owner->SetHighColor(tint_color(textColor, B_LIGHTEN_2_TINT));
|
||||||
|
} else {
|
||||||
|
if (IsSelected())
|
||||||
|
owner->SetHighColor(ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR));
|
||||||
|
else
|
||||||
|
owner->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
|
||||||
|
}
|
||||||
|
|
||||||
owner->DrawString(fText);
|
owner->DrawString(fText);
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ ColorWhichItem::DrawItem(BView *owner, BRect frame, bool complete)
|
|||||||
|
|
||||||
if (IsSelected() || complete) {
|
if (IsSelected() || complete) {
|
||||||
if (IsSelected()) {
|
if (IsSelected()) {
|
||||||
owner->SetHighColor(tint_color(lowColor, B_DARKEN_2_TINT));
|
owner->SetHighColor(ui_color(B_MENU_SELECTED_BACKGROUND_COLOR));
|
||||||
owner->SetLowColor(owner->HighColor());
|
owner->SetLowColor(owner->HighColor());
|
||||||
} else
|
} else
|
||||||
owner->SetHighColor(lowColor);
|
owner->SetHighColor(lowColor);
|
||||||
@@ -53,14 +53,18 @@ ColorWhichItem::DrawItem(BView *owner, BRect frame, bool complete)
|
|||||||
owner->MovePenTo(frame.left + colorRect.Width() + 8, frame.top
|
owner->MovePenTo(frame.left + colorRect.Width() + 8, frame.top
|
||||||
+ BaselineOffset());
|
+ BaselineOffset());
|
||||||
|
|
||||||
// TODO: Don't hardcode black here, calculate based on background
|
if (!IsEnabled()) {
|
||||||
// color or use B_CONTROL_TEXT_COLOR constant.
|
rgb_color textColor = ui_color(B_MENU_ITEM_TEXT_COLOR);
|
||||||
rgb_color black = (rgb_color){ 0, 0, 0, 255 };
|
if (textColor.red + textColor.green + textColor.blue > 128 * 3)
|
||||||
|
owner->SetHighColor(tint_color(textColor, B_DARKEN_2_TINT));
|
||||||
if (!IsEnabled())
|
else
|
||||||
owner->SetHighColor(tint_color(black, B_LIGHTEN_2_TINT));
|
owner->SetHighColor(tint_color(textColor, B_LIGHTEN_2_TINT));
|
||||||
else
|
} else {
|
||||||
owner->SetHighColor(black);
|
if (IsSelected())
|
||||||
|
owner->SetHighColor(ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR));
|
||||||
|
else
|
||||||
|
owner->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
|
||||||
|
}
|
||||||
|
|
||||||
owner->DrawString(Text());
|
owner->DrawString(Text());
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ LanguageListItem::DrawItemWithTextOffset(BView* owner, BRect frame,
|
|||||||
color = ui_color(B_MENU_SELECTED_BACKGROUND_COLOR);
|
color = ui_color(B_MENU_SELECTED_BACKGROUND_COLOR);
|
||||||
else
|
else
|
||||||
color = owner->ViewColor();
|
color = owner->ViewColor();
|
||||||
|
|
||||||
owner->SetHighColor(color);
|
owner->SetHighColor(color);
|
||||||
owner->SetLowColor(color);
|
owner->SetLowColor(color);
|
||||||
owner->FillRect(frame);
|
owner->FillRect(frame);
|
||||||
@@ -77,11 +78,19 @@ LanguageListItem::DrawItemWithTextOffset(BView* owner, BRect frame,
|
|||||||
owner->SetLowColor(owner->ViewColor());
|
owner->SetLowColor(owner->ViewColor());
|
||||||
|
|
||||||
BString text = Text();
|
BString text = Text();
|
||||||
if (IsEnabled())
|
if (!IsEnabled()) {
|
||||||
owner->SetHighColor(ui_color(B_CONTROL_TEXT_COLOR));
|
rgb_color textColor = ui_color(B_MENU_ITEM_TEXT_COLOR);
|
||||||
else {
|
if (textColor.red + textColor.green + textColor.blue > 128 * 3)
|
||||||
owner->SetHighColor(tint_color(owner->LowColor(), B_DARKEN_3_TINT));
|
owner->SetHighColor(tint_color(textColor, B_DARKEN_2_TINT));
|
||||||
|
else
|
||||||
|
owner->SetHighColor(tint_color(textColor, B_LIGHTEN_2_TINT));
|
||||||
|
|
||||||
text << " [" << B_TRANSLATE("already chosen") << "]";
|
text << " [" << B_TRANSLATE("already chosen") << "]";
|
||||||
|
} else {
|
||||||
|
if (IsSelected())
|
||||||
|
owner->SetHighColor(ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR));
|
||||||
|
else
|
||||||
|
owner->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
|
||||||
}
|
}
|
||||||
|
|
||||||
owner->MovePenTo(frame.left + kLeftInset + textOffset,
|
owner->MovePenTo(frame.left + kLeftInset + textOffset,
|
||||||
@@ -359,7 +368,7 @@ LanguageListView::InitiateDrag(BPoint point, int32 dragIndex,
|
|||||||
item->DrawItem(view, itemBounds);
|
item->DrawItem(view, itemBounds);
|
||||||
itemBounds.top = itemBounds.bottom + 1.0;
|
itemBounds.top = itemBounds.bottom + 1.0;
|
||||||
}
|
}
|
||||||
// make a black frame arround the edge
|
// make a black frame around the edge
|
||||||
view->SetHighColor(0, 0, 0, 255);
|
view->SetHighColor(0, 0, 0, 255);
|
||||||
view->StrokeRect(view->Bounds());
|
view->StrokeRect(view->Bounds());
|
||||||
view->Sync();
|
view->Sync();
|
||||||
|
|||||||
Reference in New Issue
Block a user