Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: ui/views/controls/button/label_button.cc

Issue 2680643002: Add old_state parameter to CustomButton::StateChanged (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | ui/views/controls/button/md_text_button.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.h ('k') | ui/views/controls/button/md_text_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698