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

Unified Diff: chrome/browser/cocoa/tab_view.mm

Issue 113857: Adds mouseover images to the close tab button on Mac.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/tab_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/tab_view.mm
===================================================================
--- chrome/browser/cocoa/tab_view.mm (revision 16861)
+++ chrome/browser/cocoa/tab_view.mm (working copy)
@@ -17,8 +17,23 @@
return self;
}
+- (void)awakeFromNib {
+ // Set up the tracking rect for the close button mouseover. Add it
+ // to the |closeButton_| view, but we'll handle the message ourself.
+ // The mouseover is always enabled, because the close button works
+ // regardless of key/main/active status.
+ trackingArea_.reset(
+ [[NSTrackingArea alloc] initWithRect:[closeButton_ bounds]
+ options:NSTrackingMouseEnteredAndExited |
+ NSTrackingActiveAlways
+ owner:self
pink (ping after 24hrs) 2009/05/27 13:07:59 are you sure this doesn't set up an ownership cycl
rohitrao (ping after 24h) 2009/05/27 23:58:50 I added logging in dealloc and verified that deall
+ userInfo:nil]);
+ [closeButton_ addTrackingArea:trackingArea_.get()];
+}
+
- (void)dealloc {
// [self gtm_unregisterForThemeNotifications];
+ [closeButton_ removeTrackingArea:trackingArea_.get()];
[super dealloc];
}
@@ -29,6 +44,18 @@
return YES;
}
+- (void)mouseEntered:(NSEvent *)theEvent {
+ // We only set up one tracking area, so we know any mouseEntered:
+ // messages are for close button mouseovers.
+ [closeButton_ setImage:[NSImage imageNamed:@"close_bar_h"]];
+}
+
+- (void)mouseExited:(NSEvent *)theEvent {
+ // We only set up one tracking area, so we know any mouseExited:
+ // messages are for close button mouseovers.
+ [closeButton_ setImage:[NSImage imageNamed:@"close_bar"]];
+}
+
// Determines which view a click in our frame actually hit. It's either this
// view or our child close button.
- (NSView *)hitTest:(NSPoint)aPoint {
« no previous file with comments | « chrome/browser/cocoa/tab_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698