OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/message_center/cocoa/notification_controller.h" | 5 #import "ui/message_center/cocoa/notification_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 @end | 177 @end |
178 | 178 |
179 @implementation MCNotificationView | 179 @implementation MCNotificationView |
180 - (id)initWithController:(MCNotificationController*)controller | 180 - (id)initWithController:(MCNotificationController*)controller |
181 frame:(NSRect)frame { | 181 frame:(NSRect)frame { |
182 if ((self = [super initWithFrame:frame])) | 182 if ((self = [super initWithFrame:frame])) |
183 controller_ = controller; | 183 controller_ = controller; |
184 return self; | 184 return self; |
185 } | 185 } |
186 | 186 |
187 - (void)mouseDown:(NSEvent*)event { | 187 - (void)mouseUp:(NSEvent*)event { |
188 if ([event type] != NSLeftMouseDown) { | 188 if (event.type != NSLeftMouseUp) { |
189 [super mouseDown:event]; | 189 [super mouseUp:event]; |
190 return; | 190 return; |
191 } | 191 } |
192 [controller_ notificationClicked]; | 192 if (NSPointInRect([self convertPoint:event.locationInWindow fromView:nil], |
| 193 self.bounds)) { |
| 194 [controller_ notificationClicked]; |
| 195 } |
193 } | 196 } |
194 | 197 |
195 - (NSView*)hitTest:(NSPoint)point { | 198 - (NSView*)hitTest:(NSPoint)point { |
196 // Route the mouse click events on NSTextView to the container view. | 199 // Route the mouse click events on NSTextView to the container view. |
197 NSView* hitView = [super hitTest:point]; | 200 NSView* hitView = [super hitTest:point]; |
198 if (hitView) | 201 if (hitView) |
199 return [hitView isKindOfClass:[NSTextView class]] ? self : hitView; | 202 return [hitView isKindOfClass:[NSTextView class]] ? self : hitView; |
200 return nil; | 203 return nil; |
201 } | 204 } |
202 | 205 |
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 forFont:(NSFont*)nsfont | 983 forFont:(NSFont*)nsfont |
981 maxNumberOfLines:(size_t)lines { | 984 maxNumberOfLines:(size_t)lines { |
982 size_t unused; | 985 size_t unused; |
983 return [self wrapText:text | 986 return [self wrapText:text |
984 forFont:nsfont | 987 forFont:nsfont |
985 maxNumberOfLines:lines | 988 maxNumberOfLines:lines |
986 actualLines:&unused]; | 989 actualLines:&unused]; |
987 } | 990 } |
988 | 991 |
989 @end | 992 @end |
OLD | NEW |