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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #import "chrome/browser/ui/cocoa/themed_window.h" | 8 #import "chrome/browser/ui/cocoa/themed_window.h" |
9 #import "chrome/browser/ui/cocoa/url_drop_target.h" | 9 #import "chrome/browser/ui/cocoa/url_drop_target.h" |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 // Indicates if the field editor's interpretKeyEvents: method is being called. | 32 // Indicates if the field editor's interpretKeyEvents: method is being called. |
33 // If it's YES, then we should postpone the call to the observer's | 33 // If it's YES, then we should postpone the call to the observer's |
34 // OnDidChange() method after the field editor's interpretKeyEvents: method | 34 // OnDidChange() method after the field editor's interpretKeyEvents: method |
35 // is finished, rather than calling it in textDidChange: method. Because the | 35 // is finished, rather than calling it in textDidChange: method. Because the |
36 // input method may update the marked text after inserting some text, but we | 36 // input method may update the marked text after inserting some text, but we |
37 // need the observer be aware of the marked text as well. | 37 // need the observer be aware of the marked text as well. |
38 BOOL interpretingKeyEvents_; | 38 BOOL interpretingKeyEvents_; |
39 | 39 |
40 // Indicates if the text has been changed by key events. | 40 // Indicates if the text has been changed by key events. |
41 BOOL textChangedByKeyEvents_; | 41 BOOL textChangedByKeyEvents_; |
| 42 |
| 43 // The selected range as far as NSTextView is concerned. |
| 44 // See |actualSelectedRange|. |
| 45 NSRange visualSelectedRange_; |
42 } | 46 } |
43 | 47 |
44 // The delegate is always an AutocompleteTextField*. Override the superclass | 48 // The delegate is always an AutocompleteTextField*. Override the superclass |
45 // implementations to allow for proper typing. | 49 // implementations to allow for proper typing. |
46 - (AutocompleteTextField*)delegate; | 50 - (AutocompleteTextField*)delegate; |
47 - (void)setDelegate:(AutocompleteTextField*)delegate; | 51 - (void)setDelegate:(AutocompleteTextField*)delegate; |
48 | 52 |
49 // Sets attributed string programatically through the field editor's text | 53 // Sets attributed string programatically through the field editor's text |
50 // storage object. | 54 // storage object. |
51 - (void)setAttributedString:(NSAttributedString*)aString; | 55 - (void)setAttributedString:(NSAttributedString*)aString; |
52 | 56 |
| 57 // Stores requested selection range, before it's adjusted to grapheme |
| 58 // boundaries. This range is what text editing commands |
| 59 // will operate on, vs. |visualSelectionRange_|, which reflects the |
| 60 // range that looks highlighted. |
| 61 @property(nonatomic, readonly) NSRange actualSelectedRange; |
| 62 |
53 @end | 63 @end |
54 | 64 |
55 @interface AutocompleteTextFieldEditor(PrivateTestMethods) | 65 @interface AutocompleteTextFieldEditor(PrivateTestMethods) |
56 - (AutocompleteTextFieldObserver*)observer; | 66 - (AutocompleteTextFieldObserver*)observer; |
57 - (void)pasteAndGo:sender; | 67 - (void)pasteAndGo:sender; |
58 @end | 68 @end |
OLD | NEW |