| 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 const { | 451 const { |
| 452 return UseFloodFillInkDrop() | 452 return UseFloodFillInkDrop() |
| 453 ? base::MakeUnique<views::InkDropHighlight>( | 453 ? base::MakeUnique<views::InkDropHighlight>( |
| 454 size(), kInkDropSmallCornerRadius, | 454 size(), kInkDropSmallCornerRadius, |
| 455 gfx::RectF(GetLocalBounds()).CenterPoint(), | 455 gfx::RectF(GetLocalBounds()).CenterPoint(), |
| 456 GetInkDropBaseColor()) | 456 GetInkDropBaseColor()) |
| 457 : CreateDefaultInkDropHighlight( | 457 : CreateDefaultInkDropHighlight( |
| 458 gfx::RectF(image()->GetMirroredBounds()).CenterPoint()); | 458 gfx::RectF(image()->GetMirroredBounds()).CenterPoint()); |
| 459 } | 459 } |
| 460 | 460 |
| 461 void LabelButton::StateChanged() { | 461 void LabelButton::StateChanged(ButtonState old_state) { |
| 462 const gfx::Size previous_image_size(image_->GetPreferredSize()); | 462 const gfx::Size previous_image_size(image_->GetPreferredSize()); |
| 463 UpdateImage(); | 463 UpdateImage(); |
| 464 ResetLabelEnabledColor(); | 464 ResetLabelEnabledColor(); |
| 465 label_->SetEnabled(state() != STATE_DISABLED); | 465 label_->SetEnabled(state() != STATE_DISABLED); |
| 466 if (image_->GetPreferredSize() != previous_image_size) | 466 if (image_->GetPreferredSize() != previous_image_size) |
| 467 Layout(); | 467 Layout(); |
| 468 } | 468 } |
| 469 | 469 |
| 470 void LabelButton::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { | 470 void LabelButton::GetExtraParams(ui::NativeTheme::ExtraParams* params) const { |
| 471 params->button.checked = false; | 471 params->button.checked = false; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 : PlatformStyle::TextColorForButton(button_state_colors_, *this); | 604 : PlatformStyle::TextColorForButton(button_state_colors_, *this); |
| 605 if (state() != STATE_DISABLED && label_->enabled_color() != color) | 605 if (state() != STATE_DISABLED && label_->enabled_color() != color) |
| 606 label_->SetEnabledColor(color); | 606 label_->SetEnabledColor(color); |
| 607 } | 607 } |
| 608 | 608 |
| 609 bool LabelButton::UseFloodFillInkDrop() const { | 609 bool LabelButton::UseFloodFillInkDrop() const { |
| 610 return !GetText().empty(); | 610 return !GetText().empty(); |
| 611 } | 611 } |
| 612 | 612 |
| 613 } // namespace views | 613 } // namespace views |
| OLD | NEW |