OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import "ui/app_list/cocoa/blue_label_button.h" | 5 #import "ui/app_list/cocoa/blue_label_button.h" |
6 | 6 |
7 #include "base/mac/foundation_util.h" | 7 #include "base/mac/foundation_util.h" |
8 #include "skia/ext/skia_utils_mac.h" | 8 #include "skia/ext/skia_utils_mac.h" |
9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
11 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 11 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
12 | 12 |
13 namespace { | |
14 | |
15 const CGFloat kCornerRadius = 2; | 13 const CGFloat kCornerRadius = 2; |
16 | 14 |
17 const CGFloat kButtonFontSizeDelta = -1; | 15 const CGFloat kButtonFontSizeDelta = -1; |
18 const CGFloat kTopBottomTextPadding = 8; | 16 const CGFloat kTopBottomTextPadding = 8; |
19 const CGFloat kLeftRightTextPadding = 16; | 17 const CGFloat kLeftRightTextPadding = 16; |
20 const SkColor kTextShadowColor = SkColorSetRGB(0x53, 0x8c, 0xea); | 18 const SkColor kTextShadowColor = SkColorSetRGB(0x53, 0x8c, 0xea); |
21 | 19 |
22 const SkColor kShadowColor = SkColorSetRGB(0xe9, 0xe9, 0xe9); | 20 const SkColor kShadowColor = SkColorSetRGB(0xe9, 0xe9, 0xe9); |
23 const SkColor kDefaultColor = SkColorSetRGB(0x5a, 0x97, 0xff); | 21 const SkColor kDefaultColor = SkColorSetRGB(0x5a, 0x97, 0xff); |
24 const SkColor kHoverColor = SkColorSetRGB(0x55, 0x8f, 0xf3); | 22 const SkColor kHoverColor = SkColorSetRGB(0x55, 0x8f, 0xf3); |
25 const SkColor kPressedColor = SkColorSetRGB(0x42, 0x79, 0xd8); | 23 const SkColor kPressedColor = SkColorSetRGB(0x42, 0x79, 0xd8); |
26 | 24 |
27 const SkColor kInnerRingColor = SkColorSetRGB(0x64, 0x9e, 0xff); | 25 const SkColor kInnerRingColor = SkColorSetRGB(0x64, 0x9e, 0xff); |
28 const SkColor kFocusInnerRingColor = SkColorSetRGB(0xad, 0xcc, 0xff); | 26 const SkColor kFocusInnerRingColor = SkColorSetRGB(0xad, 0xcc, 0xff); |
29 const SkColor kPressInnerRingColor = SkColorSetRGB(0x3f, 0x73, 0xcd); | 27 const SkColor kPressInnerRingColor = SkColorSetRGB(0x3f, 0x73, 0xcd); |
30 const SkColor kPressFocusInnerRingColor = SkColorSetRGB(0xa0, 0xb9, 0xe7); | |
31 | 28 |
32 const SkColor kOuterRingColor = SkColorSetRGB(0x2b, 0x67, 0xce); | 29 const SkColor kOuterRingColor = SkColorSetRGB(0x2b, 0x67, 0xce); |
33 const SkColor kPressOuterRingColor = SkColorSetRGB(0x23, 0x52, 0xa2); | 30 const SkColor kPressOuterRingColor = SkColorSetRGB(0x23, 0x52, 0xa2); |
34 | 31 |
35 } // namespace | |
36 | |
37 @interface BlueLabelButtonCell : NSButtonCell | 32 @interface BlueLabelButtonCell : NSButtonCell |
38 | 33 |
39 + (NSAttributedString*)generateAttributedString:(NSString*)buttonText; | 34 + (NSAttributedString*)generateAttributedString:(NSString*)buttonText; |
40 | 35 |
41 @end | 36 @end |
42 | 37 |
43 @implementation BlueLabelButton | 38 @implementation BlueLabelButton |
44 | 39 |
45 + (Class)cellClass { | 40 + (Class)cellClass { |
46 return [BlueLabelButtonCell class]; | 41 return [BlueLabelButtonCell class]; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(frame, 2, 2) | 136 [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(frame, 2, 2) |
142 xRadius:kCornerRadius | 137 xRadius:kCornerRadius |
143 yRadius:kCornerRadius] fill]; | 138 yRadius:kCornerRadius] fill]; |
144 [centerColor set]; | 139 [centerColor set]; |
145 [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(frame, 3, 3) | 140 [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect(frame, 3, 3) |
146 xRadius:kCornerRadius | 141 xRadius:kCornerRadius |
147 yRadius:kCornerRadius] fill]; | 142 yRadius:kCornerRadius] fill]; |
148 } | 143 } |
149 | 144 |
150 @end | 145 @end |
OLD | NEW |