OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
6 #define CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 6 #define CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 // Called whenever the autocomplete text field gets focused. | 96 // Called whenever the autocomplete text field gets focused. |
97 virtual void OnSetFocus(bool control_down) = 0; | 97 virtual void OnSetFocus(bool control_down) = 0; |
98 | 98 |
99 // Called whenever the autocomplete text field is losing focus. | 99 // Called whenever the autocomplete text field is losing focus. |
100 virtual void OnKillFocus() = 0; | 100 virtual void OnKillFocus() = 0; |
101 | 101 |
102 // Called before the text field handles a mouse down event. | 102 // Called before the text field handles a mouse down event. |
103 virtual void OnMouseDown(NSInteger button_number) = 0; | 103 virtual void OnMouseDown(NSInteger button_number) = 0; |
104 | 104 |
| 105 // Returns true if mouse down should select all. |
| 106 virtual bool ShouldSelectAllOnMouseDown() = 0; |
| 107 |
105 protected: | 108 protected: |
106 virtual ~AutocompleteTextFieldObserver() {} | 109 virtual ~AutocompleteTextFieldObserver() {} |
107 }; | 110 }; |
108 | 111 |
109 @interface AutocompleteTextField : StyledTextField<NSTextViewDelegate, | 112 @interface AutocompleteTextField : StyledTextField<NSTextViewDelegate, |
110 URLDropTarget> { | 113 URLDropTarget> { |
111 @private | 114 @private |
112 // Undo manager for this text field. We use a specific instance rather than | 115 // Undo manager for this text field. We use a specific instance rather than |
113 // the standard undo manager in order to let us clear the undo stack at will. | 116 // the standard undo manager in order to let us clear the undo stack at will. |
114 base::scoped_nsobject<NSUndoManager> undoManager_; | 117 base::scoped_nsobject<NSUndoManager> undoManager_; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // Draw gray text suggestion in |controlView|. | 169 // Draw gray text suggestion in |controlView|. |
167 void DrawGrayTextAutocompletion(NSAttributedString* mainText, | 170 void DrawGrayTextAutocompletion(NSAttributedString* mainText, |
168 NSString* suggestText, | 171 NSString* suggestText, |
169 NSColor* suggestColor, | 172 NSColor* suggestColor, |
170 NSView* controlView, | 173 NSView* controlView, |
171 NSRect frame); | 174 NSRect frame); |
172 | 175 |
173 } // namespace autocomplete_text_field | 176 } // namespace autocomplete_text_field |
174 | 177 |
175 #endif // CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 178 #endif // CHROME_BROWSER_UI_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
OLD | NEW |