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/app_list_pager_view.h" | 5 #import "ui/app_list/cocoa/app_list_pager_view.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 "ui/app_list/app_list_constants.h" | 9 #include "ui/app_list/app_list_constants.h" |
10 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 10 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 [[NSBezierPath bezierPathWithRoundedRect:clipRect | 140 [[NSBezierPath bezierPathWithRoundedRect:clipRect |
141 xRadius:kButtonCornerRadius | 141 xRadius:kButtonCornerRadius |
142 yRadius:kButtonCornerRadius] addClip]; | 142 yRadius:kButtonCornerRadius] addClip]; |
143 | 143 |
144 AppListPagerView* pagerControl = | 144 AppListPagerView* pagerControl = |
145 base::mac::ObjCCastStrict<AppListPagerView>(controlView); | 145 base::mac::ObjCCastStrict<AppListPagerView>(controlView); |
146 SkColor backgroundColor = [pagerControl hoveredSegment] == segment ? | 146 SkColor backgroundColor = [pagerControl hoveredSegment] == segment ? |
147 app_list::kPagerHoverColor : | 147 app_list::kPagerHoverColor : |
148 app_list::kPagerNormalColor; | 148 app_list::kPagerNormalColor; |
149 | 149 |
150 [gfx::SkColorToSRGBNSColor(backgroundColor) set]; | 150 [skia::SkColorToSRGBNSColor(backgroundColor) set]; |
151 NSRectFill(frame); | 151 NSRectFill(frame); |
152 | 152 |
153 if (![[self target] conformsToProtocol:@protocol(AppListPagerDelegate)]) | 153 if (![[self target] conformsToProtocol:@protocol(AppListPagerDelegate)]) |
154 return; | 154 return; |
155 | 155 |
156 CGFloat selectedRatio = [[self target] visiblePortionOfPage:segment]; | 156 CGFloat selectedRatio = [[self target] visiblePortionOfPage:segment]; |
157 if (selectedRatio == 0.0) | 157 if (selectedRatio == 0.0) |
158 return; | 158 return; |
159 | 159 |
160 [gfx::SkColorToSRGBNSColor(app_list::kPagerSelectedColor) set]; | 160 [skia::SkColorToSRGBNSColor(app_list::kPagerSelectedColor) set]; |
161 if (selectedRatio < 0) | 161 if (selectedRatio < 0) |
162 frame.origin.x += frame.size.width + frame.size.width * selectedRatio; | 162 frame.origin.x += frame.size.width + frame.size.width * selectedRatio; |
163 frame.size.width *= fabs(selectedRatio); | 163 frame.size.width *= fabs(selectedRatio); |
164 NSRectFill(frame); | 164 NSRectFill(frame); |
165 } | 165 } |
166 | 166 |
167 @end | 167 @end |
OLD | NEW |