| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 AddChildView(image_); | 121 AddChildView(image_); |
| 122 image_->set_interactive(false); | 122 image_->set_interactive(false); |
| 123 | 123 |
| 124 AddChildView(label_); | 124 AddChildView(label_); |
| 125 label_->SetFontList(cached_normal_font_list_); | 125 label_->SetFontList(cached_normal_font_list_); |
| 126 label_->SetAutoColorReadabilityEnabled(false); | 126 label_->SetAutoColorReadabilityEnabled(false); |
| 127 label_->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD); | 127 label_->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD); |
| 128 | 128 |
| 129 // Inset the button focus rect from the actual border; roughly match Windows. | 129 // Inset the button focus rect from the actual border; roughly match Windows. |
| 130 if (!ui::MaterialDesignController::IsModeMaterial()) { | 130 SetFocusPainter(Painter::CreateDashedFocusPainterWithInsets(gfx::Insets( |
| 131 SetFocusPainter(Painter::CreateDashedFocusPainterWithInsets(gfx::Insets( | 131 kFocusRectInset, kFocusRectInset, kFocusRectInset, kFocusRectInset))); |
| 132 kFocusRectInset, kFocusRectInset, kFocusRectInset, kFocusRectInset))); | |
| 133 } | |
| 134 } | 132 } |
| 135 | 133 |
| 136 LabelButton::~LabelButton() {} | 134 LabelButton::~LabelButton() {} |
| 137 | 135 |
| 138 gfx::ImageSkia LabelButton::GetImage(ButtonState for_state) const { | 136 gfx::ImageSkia LabelButton::GetImage(ButtonState for_state) const { |
| 139 if (for_state != STATE_NORMAL && button_state_images_[for_state].isNull()) | 137 if (for_state != STATE_NORMAL && button_state_images_[for_state].isNull()) |
| 140 return button_state_images_[STATE_NORMAL]; | 138 return button_state_images_[STATE_NORMAL]; |
| 141 return button_state_images_[for_state]; | 139 return button_state_images_[for_state]; |
| 142 } | 140 } |
| 143 | 141 |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 void LabelButton::ResetLabelEnabledColor() { | 587 void LabelButton::ResetLabelEnabledColor() { |
| 590 const SkColor color = | 588 const SkColor color = |
| 591 explicitly_set_colors_[state()] | 589 explicitly_set_colors_[state()] |
| 592 ? button_state_colors_[state()] | 590 ? button_state_colors_[state()] |
| 593 : PlatformStyle::TextColorForButton(button_state_colors_, *this); | 591 : PlatformStyle::TextColorForButton(button_state_colors_, *this); |
| 594 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 592 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
| 595 label_->SetEnabledColor(color); | 593 label_->SetEnabledColor(color); |
| 596 } | 594 } |
| 597 | 595 |
| 598 } // namespace views | 596 } // namespace views |
| OLD | NEW |