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/combobox/combobox.h" | 5 #include "ui/views/controls/combobox/combobox.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 // slightly less than half full and come out a little lighter. | 826 // slightly less than half full and come out a little lighter. |
827 const SkScalar kEpsilon = 0.0001f; | 827 const SkScalar kEpsilon = 0.0001f; |
828 path.moveTo(x - kEpsilon, y); | 828 path.moveTo(x - kEpsilon, y); |
829 path.rLineTo(height, height); | 829 path.rLineTo(height, height); |
830 path.rLineTo(2 * kEpsilon, 0); | 830 path.rLineTo(2 * kEpsilon, 0); |
831 path.rLineTo(height, -height); | 831 path.rLineTo(height, -height); |
832 path.close(); | 832 path.close(); |
833 SkPaint paint; | 833 SkPaint paint; |
834 SkColor arrow_color = GetNativeTheme()->GetSystemColor( | 834 SkColor arrow_color = GetNativeTheme()->GetSystemColor( |
835 ui::NativeTheme::kColorId_ButtonEnabledColor); | 835 ui::NativeTheme::kColorId_ButtonEnabledColor); |
836 // TODO(estade): share this disabled alpha value with other places that use | |
837 // it. | |
838 if (!enabled()) | 836 if (!enabled()) |
839 arrow_color = SkColorSetA(arrow_color, 0x61); | 837 arrow_color = SkColorSetA(arrow_color, gfx::kDisabledControlAlpha); |
840 paint.setColor(arrow_color); | 838 paint.setColor(arrow_color); |
841 paint.setAntiAlias(true); | 839 paint.setAntiAlias(true); |
842 canvas->DrawPath(path, paint); | 840 canvas->DrawPath(path, paint); |
843 } else { | 841 } else { |
844 canvas->DrawImageInt(arrow_image_, arrow_bounds.x(), arrow_bounds.y()); | 842 canvas->DrawImageInt(arrow_image_, arrow_bounds.x(), arrow_bounds.y()); |
845 } | 843 } |
846 } | 844 } |
847 | 845 |
848 void Combobox::PaintButtons(gfx::Canvas* canvas) { | 846 void Combobox::PaintButtons(gfx::Canvas* canvas) { |
849 DCHECK(style_ == STYLE_ACTION); | 847 DCHECK(style_ == STYLE_ACTION); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 } | 987 } |
990 | 988 |
991 int Combobox::GetArrowContainerWidth() const { | 989 int Combobox::GetArrowContainerWidth() const { |
992 int padding = style_ == STYLE_NORMAL | 990 int padding = style_ == STYLE_NORMAL |
993 ? PlatformStyle::kComboboxNormalArrowPadding * 2 | 991 ? PlatformStyle::kComboboxNormalArrowPadding * 2 |
994 : kActionLeftPadding + kActionRightPadding; | 992 : kActionLeftPadding + kActionRightPadding; |
995 return ArrowSize().width() + padding; | 993 return ArrowSize().width() + padding; |
996 } | 994 } |
997 | 995 |
998 } // namespace views | 996 } // namespace views |
OLD | NEW |