Index: ui/views/controls/button/label_button.cc |
diff --git a/ui/views/controls/button/label_button.cc b/ui/views/controls/button/label_button.cc |
index 89ae8c351142345a5dce0cca5adea8244b4b3b7f..cb97d1fae645e477fab6f562e8acdf9b9a9b3736 100644 |
--- a/ui/views/controls/button/label_button.cc |
+++ b/ui/views/controls/button/label_button.cc |
@@ -26,6 +26,10 @@ const int kSpacing = 5; |
// The length of the hover fade animation. |
const int kHoverAnimationDurationMs = 170; |
+// Blue button style default font colors. |
+const SkColor kBlueButtonEnabledColor = SK_ColorWHITE; |
+const SkColor kBlueButtonDisabledColor = SK_ColorWHITE; |
msw
2013/05/13 18:27:20
nit: consider using a single constant for the matc
benwells
2013/05/16 11:01:13
Done.
|
+ |
} // namespace |
namespace views { |
@@ -151,6 +155,11 @@ void LabelButton::SetStyle(ButtonStyle style) { |
ui::NativeTheme::kColorId_WindowBackground); |
label_->SetShadowColors(color, color); |
label_->SetShadowOffset(0, 1); |
+ } else if (style == STYLE_BLUE_BUTTON) { |
msw
2013/05/13 18:27:20
Please implement the blue buttons' 1px #538CEA dro
|
+ if (label_->enabled() && !explicitly_set_colors_[state()]) |
msw
2013/05/13 18:27:20
Ignore the current enabled/disabled state, both sh
benwells
2013/05/14 11:30:44
Yes I was thinking client code should be able to s
msw
2013/05/14 16:20:02
Maybe we can get API flexibility and code simplici
benwells
2013/05/16 11:01:13
OK, I've moved the logic into ResetColorsFromNativ
|
+ label_->SetEnabledColor(kBlueButtonEnabledColor); |
msw
2013/05/13 18:27:20
Call SetTextColor here to mark these as explicitly
msw
2013/05/14 16:20:02
Ignore this!
|
+ if (!explicitly_set_colors_[STATE_DISABLED]) |
+ label_->SetDisabledColor(kBlueButtonDisabledColor); |
} |
// Invalidate the layout to pickup the new insets from the border. |
InvalidateLayout(); |
@@ -199,6 +208,9 @@ const char* LabelButton::GetClassName() const { |
} |
void LabelButton::ResetColorsFromNativeTheme() { |
+ if (style() == STYLE_BLUE_BUTTON) |
msw
2013/05/13 18:27:20
This isn't needed if you just call SetTextColor ab
|
+ return; |
+ |
const ui::NativeTheme* theme = GetNativeTheme(); |
SkColor colors[STATE_COUNT] = { |
theme->GetSystemColor(ui::NativeTheme::kColorId_TextButtonEnabledColor), |
@@ -227,7 +239,9 @@ void LabelButton::ResetColorsFromNativeTheme() { |
void LabelButton::StateChanged() { |
const gfx::Size previous_image_size(image_->GetPreferredSize()); |
image_->SetImage(GetImage(state())); |
- const SkColor color = button_state_colors_[state()]; |
+ SkColor color = button_state_colors_[state()]; |
+ if (style() == STYLE_BLUE_BUTTON && ! explicitly_set_colors_[state()]) |
msw
2013/05/13 18:27:20
You shouldn't need to modify StateChanged at all.
benwells
2013/05/16 11:01:13
Done.
|
+ color = kBlueButtonEnabledColor; |
if (state() != STATE_DISABLED && label_->enabled_color() != color) |
label_->SetEnabledColor(color); |
label_->SetEnabled(state() != STATE_DISABLED); |