OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/views/controls/button/label_button.h" | 5 #include "ui/views/controls/button/label_button.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 return label_->text(); | 92 return label_->text(); |
93 } | 93 } |
94 | 94 |
95 void LabelButton::SetText(const base::string16& text) { | 95 void LabelButton::SetText(const base::string16& text) { |
96 SetTextInternal(text); | 96 SetTextInternal(text); |
97 } | 97 } |
98 | 98 |
99 void LabelButton::SetTextColor(ButtonState for_state, SkColor color) { | 99 void LabelButton::SetTextColor(ButtonState for_state, SkColor color) { |
100 button_state_colors_[for_state] = color; | 100 button_state_colors_[for_state] = color; |
101 if (for_state == STATE_DISABLED) | 101 if (for_state == STATE_DISABLED) |
102 label_->SetDisabledColor(color); | 102 label_->SetDisabledColorForLabelButton(color); |
103 else if (for_state == state()) | 103 else if (for_state == state()) |
104 label_->SetEnabledColor(color); | 104 label_->SetEnabledColor(color); |
105 explicitly_set_colors_[for_state] = true; | 105 explicitly_set_colors_[for_state] = true; |
106 } | 106 } |
107 | 107 |
108 void LabelButton::SetEnabledTextColors(SkColor color) { | 108 void LabelButton::SetEnabledTextColors(SkColor color) { |
109 ButtonState states[] = {STATE_NORMAL, STATE_HOVERED, STATE_PRESSED}; | 109 ButtonState states[] = {STATE_NORMAL, STATE_HOVERED, STATE_PRESSED}; |
110 for (auto state : states) | 110 for (auto state : states) |
111 SetTextColor(state, color); | 111 SetTextColor(state, color); |
112 } | 112 } |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 void LabelButton::ResetLabelEnabledColor() { | 544 void LabelButton::ResetLabelEnabledColor() { |
545 const SkColor color = | 545 const SkColor color = |
546 explicitly_set_colors_[state()] | 546 explicitly_set_colors_[state()] |
547 ? button_state_colors_[state()] | 547 ? button_state_colors_[state()] |
548 : PlatformStyle::TextColorForButton(button_state_colors_, *this); | 548 : PlatformStyle::TextColorForButton(button_state_colors_, *this); |
549 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 549 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
550 label_->SetEnabledColor(color); | 550 label_->SetEnabledColor(color); |
551 } | 551 } |
552 | 552 |
553 } // namespace views | 553 } // namespace views |
OLD | NEW |