Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: ui/views/controls/button/label_button.cc

Issue 14631022: Add support for blue buttons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More feedback Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..8a17ef53ba9bd97c2632c267c7ada6488a6b065f 100644
--- a/ui/views/controls/button/label_button.cc
+++ b/ui/views/controls/button/label_button.cc
@@ -26,6 +26,12 @@ const int kSpacing = 5;
// The length of the hover fade animation.
const int kHoverAnimationDurationMs = 170;
+// Blue button style default font color.
+const SkColor kBlueButtonTextColor = SK_ColorWHITE;
+
+// Blue button style shadow color.
+const SkColor kBlueButtonShadowColor = SkColorSetRGB(0x53, 0x8C, 0xEA);
+
} // namespace
namespace views {
@@ -151,6 +157,9 @@ void LabelButton::SetStyle(ButtonStyle style) {
ui::NativeTheme::kColorId_WindowBackground);
label_->SetShadowColors(color, color);
label_->SetShadowOffset(0, 1);
+ } else if (style == STYLE_BLUE_BUTTON) {
+ label_->SetShadowColors(kBlueButtonShadowColor, kBlueButtonShadowColor);
+ label_->SetShadowOffset(0, 1);
}
// Invalidate the layout to pickup the new insets from the border.
InvalidateLayout();
@@ -213,6 +222,12 @@ void LabelButton::ResetColorsFromNativeTheme() {
constant_text_color |= (style() == STYLE_NATIVE_TEXTBUTTON &&
theme == ui::NativeThemeWin::instance());
#endif
+ if (style() == STYLE_BLUE_BUTTON) {
+ colors[STATE_NORMAL] = kBlueButtonTextColor;
+ colors[STATE_DISABLED] = kBlueButtonTextColor;
+ constant_text_color = true;
+ }
+
if (constant_text_color)
colors[STATE_HOVERED] = colors[STATE_PRESSED] = colors[STATE_NORMAL];
@@ -227,7 +242,7 @@ 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()];
msw 2013/05/18 20:07:24 nit: restore this const
benwells 2013/05/24 07:44:22 Done.
+ SkColor color = button_state_colors_[state()];
if (state() != STATE_DISABLED && label_->enabled_color() != color)
label_->SetEnabledColor(color);
label_->SetEnabled(state() != STATE_DISABLED);

Powered by Google App Engine
This is Rietveld 408576698