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

Side by Side Diff: ui/app_list/cocoa/apps_search_results_controller.mm

Issue 1023983002: Fix background colour for Cocoa app list on hover (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actually just fix it Created 5 years, 9 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/app_list/app_list_constants.cc ('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 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/apps_search_results_controller.h" 5 #import "ui/app_list/cocoa/apps_search_results_controller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/mac/mac_util.h" 8 #include "base/mac/mac_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 11 matching lines...) Expand all
22 const CGFloat kIconDimension = 32; 22 const CGFloat kIconDimension = 32;
23 const CGFloat kIconPadding = 14; 23 const CGFloat kIconPadding = 14;
24 const CGFloat kIconViewWidth = kIconDimension + 2 * kIconPadding; 24 const CGFloat kIconViewWidth = kIconDimension + 2 * kIconPadding;
25 const CGFloat kTextTrailPadding = kIconPadding; 25 const CGFloat kTextTrailPadding = kIconPadding;
26 26
27 // Map background styles to represent selection and hover in the results list. 27 // Map background styles to represent selection and hover in the results list.
28 const NSBackgroundStyle kBackgroundNormal = NSBackgroundStyleLight; 28 const NSBackgroundStyle kBackgroundNormal = NSBackgroundStyleLight;
29 const NSBackgroundStyle kBackgroundSelected = NSBackgroundStyleDark; 29 const NSBackgroundStyle kBackgroundSelected = NSBackgroundStyleDark;
30 const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised; 30 const NSBackgroundStyle kBackgroundHovered = NSBackgroundStyleRaised;
31 31
32 // The mouse hover colour (3% black over kContentsBackgroundColor).
33 const SkColor kHighlightedRowColor = SkColorSetRGB(0xEE, 0xEE, 0xEE);
34 // The keyboard select colour (6% black over kContentsBackgroundColor).
35 const SkColor kSelectedRowColor = SkColorSetRGB(0xE6, 0xE6, 0xE6);
36
32 } // namespace 37 } // namespace
33 38
34 @interface AppsSearchResultsController () 39 @interface AppsSearchResultsController ()
35 40
36 - (void)loadAndSetViewWithResultsFrameSize:(NSSize)size; 41 - (void)loadAndSetViewWithResultsFrameSize:(NSSize)size;
37 - (void)mouseDown:(NSEvent*)theEvent; 42 - (void)mouseDown:(NSEvent*)theEvent;
38 - (void)tableViewClicked:(id)sender; 43 - (void)tableViewClicked:(id)sender;
39 - (app_list::AppListModel::SearchResults*)searchResults; 44 - (app_list::AppListModel::SearchResults*)searchResults;
40 - (void)activateSelection; 45 - (void)activateSelection;
41 - (BOOL)moveSelectionByDelta:(NSInteger)delta; 46 - (BOOL)moveSelectionByDelta:(NSInteger)delta;
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 } 419 }
415 420
416 @end 421 @end
417 422
418 @implementation AppsSearchResultsCell 423 @implementation AppsSearchResultsCell
419 424
420 - (void)drawWithFrame:(NSRect)cellFrame 425 - (void)drawWithFrame:(NSRect)cellFrame
421 inView:(NSView*)controlView { 426 inView:(NSView*)controlView {
422 if ([self backgroundStyle] != kBackgroundNormal) { 427 if ([self backgroundStyle] != kBackgroundNormal) {
423 if ([self backgroundStyle] == kBackgroundSelected) 428 if ([self backgroundStyle] == kBackgroundSelected)
424 [gfx::SkColorToSRGBNSColor(app_list::kSelectedColor) set]; 429 [gfx::SkColorToSRGBNSColor(kSelectedRowColor) set];
425 else 430 else
426 [gfx::SkColorToSRGBNSColor(app_list::kHighlightedColor) set]; 431 [gfx::SkColorToSRGBNSColor(kHighlightedRowColor) set];
427 432
428 // Extend up by one pixel to draw over cell border. 433 // Extend up by one pixel to draw over cell border.
429 NSRect backgroundRect = cellFrame; 434 NSRect backgroundRect = cellFrame;
430 backgroundRect.origin.y -= 1; 435 backgroundRect.origin.y -= 1;
431 backgroundRect.size.height += 1; 436 backgroundRect.size.height += 1;
432 NSRectFill(backgroundRect); 437 NSRectFill(backgroundRect);
433 } 438 }
434 439
435 NSAttributedString* titleText = [self attributedStringValue]; 440 NSAttributedString* titleText = [self attributedStringValue];
436 NSRect titleRect = cellFrame; 441 NSRect titleRect = cellFrame;
(...skipping 18 matching lines...) Expand all
455 std::min(iconSize.height, kIconDimension)); 460 std::min(iconSize.height, kIconDimension));
456 [resultIcon drawInRect:iconRect 461 [resultIcon drawInRect:iconRect
457 fromRect:NSZeroRect 462 fromRect:NSZeroRect
458 operation:NSCompositeSourceOver 463 operation:NSCompositeSourceOver
459 fraction:1.0 464 fraction:1.0
460 respectFlipped:YES 465 respectFlipped:YES
461 hints:nil]; 466 hints:nil];
462 } 467 }
463 468
464 @end 469 @end
OLDNEW
« no previous file with comments | « ui/app_list/app_list_constants.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698