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