| 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 "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/gfx/animation/throb_animation.h" | 9 #include "ui/gfx/animation/throb_animation.h" |
| 10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 if (style_ == STYLE_BUTTON) { | 184 if (style_ == STYLE_BUTTON) { |
| 185 label_->SetFontList( | 185 label_->SetFontList( |
| 186 is_default ? cached_bold_font_list_ : cached_normal_font_list_); | 186 is_default ? cached_bold_font_list_ : cached_normal_font_list_); |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 | 189 |
| 190 void LabelButton::SetStyle(ButtonStyle style) { | 190 void LabelButton::SetStyle(ButtonStyle style) { |
| 191 style_ = style; | 191 style_ = style; |
| 192 // Inset the button focus rect from the actual border; roughly match Windows. | 192 // Inset the button focus rect from the actual border; roughly match Windows. |
| 193 if (style == STYLE_BUTTON) { | 193 if (style == STYLE_BUTTON) { |
| 194 SetFocusPainter(scoped_ptr<Painter>()); | 194 SetFocusPainter(nullptr); |
| 195 } else { | 195 } else { |
| 196 SetFocusPainter(Painter::CreateDashedFocusPainterWithInsets( | 196 SetFocusPainter(Painter::CreateDashedFocusPainterWithInsets( |
| 197 gfx::Insets(3, 3, 3, 3))); | 197 gfx::Insets(3, 3, 3, 3))); |
| 198 } | 198 } |
| 199 if (style == STYLE_BUTTON) { | 199 if (style == STYLE_BUTTON) { |
| 200 label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); | 200 label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); |
| 201 SetFocusable(true); | 201 SetFocusable(true); |
| 202 } | 202 } |
| 203 if (style == STYLE_BUTTON) | 203 if (style == STYLE_BUTTON) |
| 204 SetMinSize(gfx::Size(70, 33)); | 204 SetMinSize(gfx::Size(70, 33)); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 GetExtraParams(params); | 509 GetExtraParams(params); |
| 510 return ui::NativeTheme::kHovered; | 510 return ui::NativeTheme::kHovered; |
| 511 } | 511 } |
| 512 | 512 |
| 513 void LabelButton::ResetCachedPreferredSize() { | 513 void LabelButton::ResetCachedPreferredSize() { |
| 514 cached_preferred_size_valid_ = false; | 514 cached_preferred_size_valid_ = false; |
| 515 cached_preferred_size_= gfx::Size(); | 515 cached_preferred_size_= gfx::Size(); |
| 516 } | 516 } |
| 517 | 517 |
| 518 } // namespace views | 518 } // namespace views |
| OLD | NEW |