| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/cocoa/find_bar_view.h" | 5 #import "chrome/browser/cocoa/find_bar_view.h" |
| 6 | 6 |
| 7 #import "chrome/browser/cocoa/themed_window.h" | 7 #import "chrome/browser/cocoa/themed_window.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 CGFloat kCurveSize = 8; | 10 CGFloat kCurveSize = 8; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 NSPoint phase = [[self window] themePatternPhase]; | 58 NSPoint phase = [[self window] themePatternPhase]; |
| 59 | 59 |
| 60 [context setPatternPhase:phase]; | 60 [context setPatternPhase:phase]; |
| 61 [super drawBackground]; | 61 [super drawBackground]; |
| 62 [context restoreGraphicsState]; | 62 [context restoreGraphicsState]; |
| 63 | 63 |
| 64 [[self strokeColor] set]; | 64 [[self strokeColor] set]; |
| 65 [path stroke]; | 65 [path stroke]; |
| 66 } | 66 } |
| 67 | 67 |
| 68 - (BOOL)drawsAsKey { |
| 69 return [[[self window] parentWindow] isKeyWindow]; |
| 70 } |
| 71 |
| 68 // The findbar is mostly opaque, but has an 8px transparent border on the left | 72 // The findbar is mostly opaque, but has an 8px transparent border on the left |
| 69 // and right sides (see |kCurveSize|). This is an artifact of the way it is | 73 // and right sides (see |kCurveSize|). This is an artifact of the way it is |
| 70 // drawn. We override hitTest to return nil for points in this transparent | 74 // drawn. We override hitTest to return nil for points in this transparent |
| 71 // area. | 75 // area. |
| 72 - (NSView*)hitTest:(NSPoint)point { | 76 - (NSView*)hitTest:(NSPoint)point { |
| 73 NSView* hitView = [super hitTest:point]; | 77 NSView* hitView = [super hitTest:point]; |
| 74 if (hitView == self) { | 78 if (hitView == self) { |
| 75 // |rect| is approximately equivalent to the opaque area of the findbar. | 79 // |rect| is approximately equivalent to the opaque area of the findbar. |
| 76 NSRect rect = NSInsetRect([self bounds], kCurveSize, 0); | 80 NSRect rect = NSInsetRect([self bounds], kCurveSize, 0); |
| 77 if (!NSMouseInRect(point, rect, [self isFlipped])) | 81 if (!NSMouseInRect(point, rect, [self isFlipped])) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 105 | 109 |
| 106 - (void)mouseDragged:(NSEvent *)theEvent { | 110 - (void)mouseDragged:(NSEvent *)theEvent { |
| 107 } | 111 } |
| 108 | 112 |
| 109 - (void)rightMouseDragged:(NSEvent *)theEvent { | 113 - (void)rightMouseDragged:(NSEvent *)theEvent { |
| 110 } | 114 } |
| 111 | 115 |
| 112 - (void)otherMouseDragged:(NSEvent *)theEvent { | 116 - (void)otherMouseDragged:(NSEvent *)theEvent { |
| 113 } | 117 } |
| 114 @end | 118 @end |
| OLD | NEW |