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