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

Side by Side Diff: chrome/browser/ui/cocoa/gradient_button_cell.mm

Issue 6889025: Mac. Ensure no more than one visibly selected item in each bookmark folder menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/cocoa/gradient_button_cell.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/ui/cocoa/gradient_button_cell.h" 5 #include "chrome/browser/ui/cocoa/gradient_button_cell.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/memory/scoped_nsobject.h" 8 #import "base/memory/scoped_nsobject.h"
9 #import "chrome/browser/themes/theme_service.h" 9 #import "chrome/browser/themes/theme_service.h"
10 #import "chrome/browser/ui/cocoa/image_utils.h" 10 #import "chrome/browser/ui/cocoa/image_utils.h"
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 clipPath:&boundingPath]; 716 clipPath:&boundingPath];
717 return boundingPath; 717 return boundingPath;
718 } 718 }
719 719
720 - (void)resetCursorRect:(NSRect)cellFrame inView:(NSView*)controlView { 720 - (void)resetCursorRect:(NSRect)cellFrame inView:(NSView*)controlView {
721 [super resetCursorRect:cellFrame inView:controlView]; 721 [super resetCursorRect:cellFrame inView:controlView];
722 if (trackingArea_) 722 if (trackingArea_)
723 [self updateTrackingAreas]; 723 [self updateTrackingAreas];
724 } 724 }
725 725
726 - (void)updateTrackingAreas { 726 - (BOOL)isMouseReallyInside {
727 BOOL mouseInView = NO; 727 BOOL mouseInView = NO;
728 NSView* controlView = [self controlView]; 728 NSView* controlView = [self controlView];
729 NSWindow* window = [controlView window]; 729 NSWindow* window = [controlView window];
730 NSRect bounds = [controlView bounds]; 730 NSRect bounds = [controlView bounds];
731 if (window) { 731 if (window) {
732 NSPoint mousePoint = [window mouseLocationOutsideOfEventStream]; 732 NSPoint mousePoint = [window mouseLocationOutsideOfEventStream];
733 mousePoint = [controlView convertPointFromBase:mousePoint]; 733 mousePoint = [controlView convertPointFromBase:mousePoint];
734 mouseInView = [controlView mouse:mousePoint inRect:bounds]; 734 mouseInView = [controlView mouse:mousePoint inRect:bounds];
735 } 735 }
736 return mouseInView;
737 }
738
739 - (void)updateTrackingAreas {
740 NSView* controlView = [self controlView];
741 BOOL mouseInView = [self isMouseReallyInside];
736 742
737 if (trackingArea_.get()) 743 if (trackingArea_.get())
738 [controlView removeTrackingArea:trackingArea_]; 744 [controlView removeTrackingArea:trackingArea_];
739 745
740 NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | 746 NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited |
741 NSTrackingActiveInActiveApp; 747 NSTrackingActiveInActiveApp;
742 if (mouseInView) 748 if (mouseInView)
743 options |= NSTrackingAssumeInside; 749 options |= NSTrackingAssumeInside;
744 750
745 trackingArea_.reset([[NSTrackingArea alloc] 751 trackingArea_.reset([[NSTrackingArea alloc]
746 initWithRect:bounds 752 initWithRect:[controlView bounds]
747 options:options 753 options:options
748 owner:self 754 owner:self
749 userInfo:nil]); 755 userInfo:nil]);
750 if (isMouseInside_ != mouseInView) { 756 if (isMouseInside_ != mouseInView) {
751 isMouseInside_ = mouseInView; 757 [self setMouseInside:mouseInView animate:NO];
752 [controlView setNeedsDisplay:YES]; 758 [controlView setNeedsDisplay:YES];
753 } 759 }
754 } 760 }
755 761
756 @end 762 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/gradient_button_cell.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698