| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // All callers currently pass STYLE_BUTTON, and should only call this once, to | 189 // All callers currently pass STYLE_BUTTON, and should only call this once, to |
| 190 // change from the default style. | 190 // change from the default style. |
| 191 DCHECK_EQ(style, STYLE_BUTTON); | 191 DCHECK_EQ(style, STYLE_BUTTON); |
| 192 DCHECK_EQ(style_, STYLE_TEXTBUTTON); | 192 DCHECK_EQ(style_, STYLE_TEXTBUTTON); |
| 193 DCHECK(!GetWidget()) << "Can't change button style after adding to a Widget."; | 193 DCHECK(!GetWidget()) << "Can't change button style after adding to a Widget."; |
| 194 | 194 |
| 195 style_ = style; | 195 style_ = style; |
| 196 | 196 |
| 197 SetFocusPainter(nullptr); | 197 SetFocusPainter(nullptr); |
| 198 SetHorizontalAlignment(gfx::ALIGN_CENTER); | 198 SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 199 SetFocusable(true); | 199 PlatformStyle::SetControlStyleFocus(this); |
| 200 SetMinSize(gfx::Size(70, 33)); | 200 SetMinSize(gfx::Size(70, 33)); |
| 201 | 201 |
| 202 // Themed borders will be set once the button is added to a Widget, since that | 202 // Themed borders will be set once the button is added to a Widget, since that |
| 203 // provides the value of GetNativeTheme(). | 203 // provides the value of GetNativeTheme(). |
| 204 } | 204 } |
| 205 | 205 |
| 206 void LabelButton::SetImageLabelSpacing(int spacing) { | 206 void LabelButton::SetImageLabelSpacing(int spacing) { |
| 207 if (spacing == image_label_spacing_) | 207 if (spacing == image_label_spacing_) |
| 208 return; | 208 return; |
| 209 image_label_spacing_ = spacing; | 209 image_label_spacing_ = spacing; |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 GetExtraParams(params); | 505 GetExtraParams(params); |
| 506 return ui::NativeTheme::kHovered; | 506 return ui::NativeTheme::kHovered; |
| 507 } | 507 } |
| 508 | 508 |
| 509 void LabelButton::ResetCachedPreferredSize() { | 509 void LabelButton::ResetCachedPreferredSize() { |
| 510 cached_preferred_size_valid_ = false; | 510 cached_preferred_size_valid_ = false; |
| 511 cached_preferred_size_ = gfx::Size(); | 511 cached_preferred_size_ = gfx::Size(); |
| 512 } | 512 } |
| 513 | 513 |
| 514 } // namespace views | 514 } // namespace views |
| OLD | NEW |