| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // All callers currently pass STYLE_BUTTON, and should only call this once, to | 207 // All callers currently pass STYLE_BUTTON, and should only call this once, to |
| 208 // change from the default style. | 208 // change from the default style. |
| 209 DCHECK_EQ(style, STYLE_BUTTON); | 209 DCHECK_EQ(style, STYLE_BUTTON); |
| 210 DCHECK_EQ(style_, STYLE_TEXTBUTTON); | 210 DCHECK_EQ(style_, STYLE_TEXTBUTTON); |
| 211 DCHECK(!GetWidget()) << "Can't change button style after adding to a Widget."; | 211 DCHECK(!GetWidget()) << "Can't change button style after adding to a Widget."; |
| 212 | 212 |
| 213 style_ = style; | 213 style_ = style; |
| 214 | 214 |
| 215 SetFocusPainter(nullptr); | 215 SetFocusPainter(nullptr); |
| 216 SetHorizontalAlignment(gfx::ALIGN_CENTER); | 216 SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 217 SetFocusable(true); | 217 PlatformStyle::ConfigureFocus(PlatformStyle::CONTROL::BUTTON, this); |
| 218 |
| 218 SetMinSize(gfx::Size(70, 33)); | 219 SetMinSize(gfx::Size(70, 33)); |
| 219 | 220 |
| 220 // Themed borders will be set once the button is added to a Widget, since that | 221 // Themed borders will be set once the button is added to a Widget, since that |
| 221 // provides the value of GetNativeTheme(). | 222 // provides the value of GetNativeTheme(). |
| 222 } | 223 } |
| 223 | 224 |
| 224 void LabelButton::SetImageLabelSpacing(int spacing) { | 225 void LabelButton::SetImageLabelSpacing(int spacing) { |
| 225 if (spacing == image_label_spacing_) | 226 if (spacing == image_label_spacing_) |
| 226 return; | 227 return; |
| 227 image_label_spacing_ = spacing; | 228 image_label_spacing_ = spacing; |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 GetExtraParams(params); | 568 GetExtraParams(params); |
| 568 return ui::NativeTheme::kHovered; | 569 return ui::NativeTheme::kHovered; |
| 569 } | 570 } |
| 570 | 571 |
| 571 void LabelButton::ResetCachedPreferredSize() { | 572 void LabelButton::ResetCachedPreferredSize() { |
| 572 cached_preferred_size_valid_ = false; | 573 cached_preferred_size_valid_ = false; |
| 573 cached_preferred_size_ = gfx::Size(); | 574 cached_preferred_size_ = gfx::Size(); |
| 574 } | 575 } |
| 575 | 576 |
| 576 } // namespace views | 577 } // namespace views |
| OLD | NEW |