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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // All callers currently pass STYLE_BUTTON, and should only call this once, to | 211 // All callers currently pass STYLE_BUTTON, and should only call this once, to |
212 // change from the default style. | 212 // change from the default style. |
213 DCHECK_EQ(style, STYLE_BUTTON); | 213 DCHECK_EQ(style, STYLE_BUTTON); |
214 DCHECK_EQ(style_, STYLE_TEXTBUTTON); | 214 DCHECK_EQ(style_, STYLE_TEXTBUTTON); |
215 DCHECK(!GetWidget()) << "Can't change button style after adding to a Widget."; | 215 DCHECK(!GetWidget()) << "Can't change button style after adding to a Widget."; |
216 | 216 |
217 style_ = style; | 217 style_ = style; |
218 | 218 |
219 SetFocusPainter(nullptr); | 219 SetFocusPainter(nullptr); |
220 SetHorizontalAlignment(gfx::ALIGN_CENTER); | 220 SetHorizontalAlignment(gfx::ALIGN_CENTER); |
221 SetFocusBehavior(FocusBehavior::ALWAYS); | 221 Button::ConfigureDefaultFocus(this); |
222 SetMinSize(gfx::Size(PlatformStyle::kMinLabelButtonWidth, | 222 SetMinSize(gfx::Size(PlatformStyle::kMinLabelButtonWidth, |
223 PlatformStyle::kMinLabelButtonHeight)); | 223 PlatformStyle::kMinLabelButtonHeight)); |
224 | 224 |
225 // Themed borders will be set once the button is added to a Widget, since that | 225 // Themed borders will be set once the button is added to a Widget, since that |
226 // provides the value of GetNativeTheme(). | 226 // provides the value of GetNativeTheme(). |
227 } | 227 } |
228 | 228 |
229 void LabelButton::SetImageLabelSpacing(int spacing) { | 229 void LabelButton::SetImageLabelSpacing(int spacing) { |
230 if (spacing == image_label_spacing_) | 230 if (spacing == image_label_spacing_) |
231 return; | 231 return; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 void LabelButton::ResetLabelEnabledColor() { | 562 void LabelButton::ResetLabelEnabledColor() { |
563 const SkColor color = | 563 const SkColor color = |
564 explicitly_set_colors_[state()] | 564 explicitly_set_colors_[state()] |
565 ? button_state_colors_[state()] | 565 ? button_state_colors_[state()] |
566 : PlatformStyle::TextColorForButton(button_state_colors_, *this); | 566 : PlatformStyle::TextColorForButton(button_state_colors_, *this); |
567 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 567 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
568 label_->SetEnabledColor(color); | 568 label_->SetEnabledColor(color); |
569 } | 569 } |
570 | 570 |
571 } // namespace views | 571 } // namespace views |
OLD | NEW |