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 #ifndef CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 5 #ifndef CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
6 #define CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 6 #define CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 // TODO(shess): This class will add decorations to support keyword | 10 @class AutocompleteTextFieldCell; |
11 // search and hints. Adding as a stub so that I can clean up naming | 11 |
12 // around this code all at once before layering other changes over in | 12 // AutocompleteTextField intercepts UI actions for forwarding to |
13 // parallel. | 13 // AutocompleteEditViewMac (*), and provides a custom look. It works |
| 14 // together with AutocompleteTextFieldEditor (mostly for intercepting |
| 15 // user actions) and AutocompleteTextFieldCell (mostly for custom |
| 16 // drawing). |
| 17 // |
| 18 // For historical reasons, chrome/browser/autocomplete is the core |
| 19 // implementation of the Omnibox. Chrome code seems to vary between |
| 20 // autocomplete and Omnibox in describing this. |
| 21 // |
| 22 // (*) AutocompleteEditViewMac is a view in the MVC sense for the |
| 23 // Chrome internals, though it's really more of a mish-mash of model, |
| 24 // view, and controller. |
| 25 |
| 26 // AutocompleteTextFieldDelegateMethods are meant to be similar to |
| 27 // NSControl delegate methods, adding additional intercepts relevant |
| 28 // to the Omnibox implementation. |
14 | 29 |
15 @protocol AutocompleteTextFieldDelegateMethods | 30 @protocol AutocompleteTextFieldDelegateMethods |
16 | 31 |
17 // Delegate -textShouldPaste: implementation to the field being | 32 // Delegate -textShouldPaste: implementation to the field being |
18 // edited. See AutocompleteTextFieldEditor implementation. | 33 // edited. See AutocompleteTextFieldEditor implementation. |
19 - (BOOL)control:(NSControl*)control textShouldPaste:(NSText*)fieldEditor; | 34 - (BOOL)control:(NSControl*)control textShouldPaste:(NSText*)fieldEditor; |
20 | 35 |
21 // Let the delegate track -flagsChanged: events. | 36 // Let the delegate track -flagsChanged: events. |
22 - (void)control:(NSControl*)control flagsChanged:(NSEvent*)theEvent; | 37 - (void)control:(NSControl*)control flagsChanged:(NSEvent*)theEvent; |
23 | 38 |
24 @end | 39 @end |
25 | 40 |
26 @interface AutocompleteTextField : NSTextField { | 41 @interface AutocompleteTextField : NSTextField { |
27 } | 42 } |
28 | 43 |
29 - (BOOL)textShouldPaste:(NSText*)fieldEditor; | 44 - (BOOL)textShouldPaste:(NSText*)fieldEditor; |
30 | 45 |
| 46 // Convenience method to return the cell, casted appropriately. |
| 47 - (AutocompleteTextFieldCell*)autocompleteTextFieldCell; |
| 48 |
| 49 // If the keyword, keyword hint, or search hint changed, then the |
| 50 // field needs to be relaidout. This accomplishes that in a manner |
| 51 // which doesn't disrupt the field delegate. |
| 52 - (void)resetFieldEditorFrameIfNeeded; |
| 53 |
31 @end | 54 @end |
32 | 55 |
33 #endif // CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ | 56 #endif // CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ |
OLD | NEW |