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

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

Issue 2340503002: Fix appearance of disabled VectorIconButtons. (Closed)
Patch Set: Created 4 years, 3 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/vector_icon_button.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/vector_icon_button.h" 5 #include "ui/views/controls/button/vector_icon_button.h"
6 6
7 #include "ui/base/material_design/material_design_controller.h" 7 #include "ui/base/material_design/material_design_controller.h"
8 #include "ui/gfx/color_palette.h" 8 #include "ui/gfx/color_palette.h"
9 #include "ui/gfx/color_utils.h" 9 #include "ui/gfx/color_utils.h"
10 #include "ui/gfx/paint_vector_icon.h" 10 #include "ui/gfx/paint_vector_icon.h"
(...skipping 28 matching lines...) Expand all
39 void VectorIconButton::SetIcon(gfx::VectorIconId id) { 39 void VectorIconButton::SetIcon(gfx::VectorIconId id) {
40 id_ = id; 40 id_ = id;
41 41
42 if (!border()) { 42 if (!border()) {
43 SetBorder(views::Border::CreateEmptyBorder( 43 SetBorder(views::Border::CreateEmptyBorder(
44 kButtonExtraTouchSize, kButtonExtraTouchSize, kButtonExtraTouchSize, 44 kButtonExtraTouchSize, kButtonExtraTouchSize, kButtonExtraTouchSize,
45 kButtonExtraTouchSize)); 45 kButtonExtraTouchSize));
46 } 46 }
47 } 47 }
48 48
49 void VectorIconButton::OnEnabledChanged() {
50 OnThemeChanged();
51 }
52
53 void VectorIconButton::OnThemeChanged() { 49 void VectorIconButton::OnThemeChanged() {
54 SkColor icon_color = 50 SkColor icon_color =
55 color_utils::DeriveDefaultIconColor(delegate_->GetVectorIconBaseColor()); 51 color_utils::DeriveDefaultIconColor(delegate_->GetVectorIconBaseColor());
56 gfx::ImageSkia image = gfx::CreateVectorIcon(id_, icon_color); 52 gfx::ImageSkia image = gfx::CreateVectorIcon(id_, icon_color);
57 SetImage(views::CustomButton::STATE_NORMAL, &image); 53 SetImage(views::CustomButton::STATE_NORMAL, &image);
58 image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2)); 54 image = gfx::CreateVectorIcon(id_, SkColorSetA(icon_color, 0xff / 2));
59 SetImage(views::CustomButton::STATE_DISABLED, &image); 55 SetImage(views::CustomButton::STATE_DISABLED, &image);
60 set_ink_drop_base_color(icon_color); 56 set_ink_drop_base_color(icon_color);
61 } 57 }
62 58
63 void VectorIconButton::OnNativeThemeChanged(const ui::NativeTheme* theme) { 59 void VectorIconButton::OnNativeThemeChanged(const ui::NativeTheme* theme) {
64 OnThemeChanged(); 60 OnThemeChanged();
65 } 61 }
66 62
67 } // namespace views 63 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/vector_icon_button.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698