OLD | NEW |
---|---|
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/hyperlink_text_view.h" | 5 #import "chrome/browser/ui/cocoa/hyperlink_text_view.h" |
6 | 6 |
7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/memory/scoped_nsobject.h" |
8 | 8 |
9 // The baseline shift for text in the NSTextView. | 9 // The baseline shift for text in the NSTextView. |
10 const float kTextBaselineShift = -1.0; | 10 const float kTextBaselineShift = -1.0; |
(...skipping 25 matching lines...) Expand all Loading... | |
36 - (BOOL)shouldDrawInsertionPoint { | 36 - (BOOL)shouldDrawInsertionPoint { |
37 return NO; | 37 return NO; |
38 } | 38 } |
39 | 39 |
40 - (NSRange)selectionRangeForProposedRange:(NSRange)proposedSelRange | 40 - (NSRange)selectionRangeForProposedRange:(NSRange)proposedSelRange |
41 granularity:(NSSelectionGranularity)granularity { | 41 granularity:(NSSelectionGranularity)granularity { |
42 // Do not allow selections. | 42 // Do not allow selections. |
43 return NSMakeRange(0, 0); | 43 return NSMakeRange(0, 0); |
44 } | 44 } |
45 | 45 |
46 - (BOOL)acceptsFirstMouse:(NSEvent*)event { | |
47 return YES; | |
Scott Hess - ex-Googler
2011/10/10 23:19:50
Needs to be conditional.
jeremya
2011/10/11 05:28:48
Done.
| |
48 } | |
49 | |
46 // Convince NSTextView to not show an I-Beam cursor when the cursor is over the | 50 // Convince NSTextView to not show an I-Beam cursor when the cursor is over the |
47 // text view but not over actual text. | 51 // text view but not over actual text. |
48 // | 52 // |
49 // http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg10791.html | 53 // http://www.mail-archive.com/cocoa-dev@lists.apple.com/msg10791.html |
50 // "NSTextView sets the cursor over itself dynamically, based on considerations | 54 // "NSTextView sets the cursor over itself dynamically, based on considerations |
51 // including the text under the cursor. It does so in -mouseEntered:, | 55 // including the text under the cursor. It does so in -mouseEntered:, |
52 // -mouseMoved:, and -cursorUpdate:, so those would be points to consider | 56 // -mouseMoved:, and -cursorUpdate:, so those would be points to consider |
53 // overriding." | 57 // overriding." |
54 - (void)mouseMoved:(NSEvent*)e { | 58 - (void)mouseMoved:(NSEvent*)e { |
55 [super mouseMoved:e]; | 59 [super mouseMoved:e]; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 atIndex:linkOffset]; | 126 atIndex:linkOffset]; |
123 // Ensure the TextView doesn't override the link style. | 127 // Ensure the TextView doesn't override the link style. |
124 [self setLinkTextAttributes:attributes]; | 128 [self setLinkTextAttributes:attributes]; |
125 } | 129 } |
126 | 130 |
127 // Update the text view with the new text. | 131 // Update the text view with the new text. |
128 [[self textStorage] setAttributedString:attributedMessage]; | 132 [[self textStorage] setAttributedString:attributedMessage]; |
129 } | 133 } |
130 | 134 |
131 @end | 135 @end |
OLD | NEW |