| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 // Inset the button focus rect from the actual border; roughly match Windows. | 110 // Inset the button focus rect from the actual border; roughly match Windows. |
| 111 if (!ui::MaterialDesignController::IsModeMaterial()) { | 111 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 112 SetFocusPainter(Painter::CreateDashedFocusPainterWithInsets(gfx::Insets( | 112 SetFocusPainter(Painter::CreateDashedFocusPainterWithInsets(gfx::Insets( |
| 113 kFocusRectInset, kFocusRectInset, kFocusRectInset, kFocusRectInset))); | 113 kFocusRectInset, kFocusRectInset, kFocusRectInset, kFocusRectInset))); |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 LabelButton::~LabelButton() {} | 117 LabelButton::~LabelButton() {} |
| 118 | 118 |
| 119 const gfx::ImageSkia& LabelButton::GetImage(ButtonState for_state) { | 119 gfx::ImageSkia LabelButton::GetImage(ButtonState for_state) const { |
| 120 if (for_state != STATE_NORMAL && button_state_images_[for_state].isNull()) | 120 if (for_state != STATE_NORMAL && button_state_images_[for_state].isNull()) |
| 121 return button_state_images_[STATE_NORMAL]; | 121 return button_state_images_[STATE_NORMAL]; |
| 122 return button_state_images_[for_state]; | 122 return button_state_images_[for_state]; |
| 123 } | 123 } |
| 124 | 124 |
| 125 void LabelButton::SetImage(ButtonState for_state, const gfx::ImageSkia& image) { | 125 void LabelButton::SetImage(ButtonState for_state, const gfx::ImageSkia& image) { |
| 126 button_state_images_[for_state] = image; | 126 button_state_images_[for_state] = image; |
| 127 UpdateImage(); | 127 UpdateImage(); |
| 128 } | 128 } |
| 129 | 129 |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 void LabelButton::ResetLabelEnabledColor() { | 571 void LabelButton::ResetLabelEnabledColor() { |
| 572 const SkColor color = | 572 const SkColor color = |
| 573 explicitly_set_colors_[state()] | 573 explicitly_set_colors_[state()] |
| 574 ? button_state_colors_[state()] | 574 ? button_state_colors_[state()] |
| 575 : PlatformStyle::TextColorForButton(button_state_colors_, *this); | 575 : PlatformStyle::TextColorForButton(button_state_colors_, *this); |
| 576 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 576 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
| 577 label_->SetEnabledColor(color); | 577 label_->SetEnabledColor(color); |
| 578 } | 578 } |
| 579 | 579 |
| 580 } // namespace views | 580 } // namespace views |
| OLD | NEW |