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

Side by Side Diff: chrome/browser/ui/cocoa/app_menu/menu_tracked_button.mm

Issue 1775223002: Prepare chrome/ for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile errors. Fix null-window error. Created 4 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 | « no previous file | chrome/browser/ui/cocoa/autofill/autofill_details_container.mm » ('j') | 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 #import "chrome/browser/ui/cocoa/app_menu/menu_tracked_button.h" 5 #import "chrome/browser/ui/cocoa/app_menu/menu_tracked_button.h"
6 6
7 #include "ui/base/cocoa/cocoa_base_utils.h"
8
7 @interface MenuTrackedButton (Private) 9 @interface MenuTrackedButton (Private)
8 - (void)doHighlight:(BOOL)highlight; 10 - (void)doHighlight:(BOOL)highlight;
9 - (void)checkMouseInRect; 11 - (void)checkMouseInRect;
10 - (NSRect)insetBounds; 12 - (NSRect)insetBounds;
11 @end 13 @end
12 14
13 @implementation MenuTrackedButton 15 @implementation MenuTrackedButton
14 16
15 @synthesize tracking = tracking_; 17 @synthesize tracking = tracking_;
16 18
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 [[self cell] setHighlighted:highlight]; 79 [[self cell] setHighlighted:highlight];
78 [self setNeedsDisplay]; 80 [self setNeedsDisplay];
79 } 81 }
80 82
81 // Checks if the user's current mouse location is over this button. If it is, 83 // Checks if the user's current mouse location is over this button. If it is,
82 // the user is merely hovering here. If it is not, then disable the highlight. 84 // the user is merely hovering here. If it is not, then disable the highlight.
83 // If the menu is opened in non-sticky mode, the button does not receive enter/ 85 // If the menu is opened in non-sticky mode, the button does not receive enter/
84 // exit mouse events and thus polling is necessary. 86 // exit mouse events and thus polling is necessary.
85 - (void)checkMouseInRect { 87 - (void)checkMouseInRect {
86 NSPoint point = [NSEvent mouseLocation]; 88 NSPoint point = [NSEvent mouseLocation];
87 point = [[self window] convertScreenToBase:point]; 89 point = ui::ConvertPointFromScreenToWindow([self window], point);
88 point = [self convertPoint:point fromView:nil]; 90 point = [self convertPoint:point fromView:nil];
89 if (!NSPointInRect(point, [self insetBounds])) { 91 if (!NSPointInRect(point, [self insetBounds])) {
90 [self doHighlight:NO]; 92 [self doHighlight:NO];
91 } 93 }
92 } 94 }
93 95
94 // Returns the bounds of the receiver slightly inset to avoid highlighting both 96 // Returns the bounds of the receiver slightly inset to avoid highlighting both
95 // buttons in a pair that overlap. 97 // buttons in a pair that overlap.
96 - (NSRect)insetBounds { 98 - (NSRect)insetBounds {
97 return NSInsetRect([self bounds], 2, 1); 99 return NSInsetRect([self bounds], 2, 1);
98 } 100 }
99 101
100 @end 102 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/autofill/autofill_details_container.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698