| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #import "chrome/browser/ui/cocoa/styled_text_field_cell.h" | 10 #import "chrome/browser/ui/cocoa/styled_text_field_cell.h" |
| 11 | 11 |
| 12 @class AutocompleteTextField; | 12 @class AutocompleteTextField; |
| 13 class LocationBarDecoration; | 13 class LocationBarDecoration; |
| 14 | 14 |
| 15 // AutocompleteTextFieldCell extends StyledTextFieldCell to provide support for | 15 // AutocompleteTextFieldCell extends StyledTextFieldCell to provide support for |
| 16 // certain decorations to be applied to the field. These are the search hint | 16 // certain decorations to be applied to the field. These are the search hint |
| 17 // ("Type to search" on the right-hand side), the keyword hint ("Press [Tab] to | 17 // ("Type to search" on the right-hand side), the keyword hint ("Press [Tab] to |
| 18 // search Engine" on the right-hand side), and keyword mode ("Search Engine:" in | 18 // search Engine" on the right-hand side), and keyword mode ("Search Engine:" in |
| 19 // a button-like token on the left-hand side). | 19 // a button-like token on the left-hand side). |
| 20 @interface AutocompleteTextFieldCell : StyledTextFieldCell { | 20 @interface AutocompleteTextFieldCell : StyledTextFieldCell { |
| 21 @private | 21 @private |
| 22 // Decorations which live to the left and right of the text, ordered | 22 // Decorations which live before and after the text, ordered |
| 23 // from outside in. Decorations are owned by |LocationBarViewMac|. | 23 // from outside in. Decorations are owned by |LocationBarViewMac|. |
| 24 std::vector<LocationBarDecoration*> leftDecorations_; | 24 std::vector<LocationBarDecoration*> leadingDecorations_; |
| 25 std::vector<LocationBarDecoration*> rightDecorations_; | 25 std::vector<LocationBarDecoration*> trailingDecorations_; |
| 26 | 26 |
| 27 // Decorations with tracking areas attached to the AutocompleteTextField. | 27 // Decorations with tracking areas attached to the AutocompleteTextField. |
| 28 std::vector<LocationBarDecoration*> mouseTrackingDecorations_; | 28 std::vector<LocationBarDecoration*> mouseTrackingDecorations_; |
| 29 | 29 |
| 30 // If YES then the text field will not draw a focus ring or show the insertion | 30 // If YES then the text field will not draw a focus ring or show the insertion |
| 31 // pointer. | 31 // pointer. |
| 32 BOOL hideFocusState_; | 32 BOOL hideFocusState_; |
| 33 | 33 |
| 34 // YES if this field is shown in a popup window. | 34 // YES if this field is shown in a popup window. |
| 35 BOOL isPopupMode_; | 35 BOOL isPopupMode_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 46 | 46 |
| 47 // Line height used for text in this cell. | 47 // Line height used for text in this cell. |
| 48 - (CGFloat)lineHeight; | 48 - (CGFloat)lineHeight; |
| 49 | 49 |
| 50 // Remove all of the tracking areas. | 50 // Remove all of the tracking areas. |
| 51 - (void)clearTrackingArea; | 51 - (void)clearTrackingArea; |
| 52 | 52 |
| 53 // Clear |leftDecorations_| and |rightDecorations_|. | 53 // Clear |leftDecorations_| and |rightDecorations_|. |
| 54 - (void)clearDecorations; | 54 - (void)clearDecorations; |
| 55 | 55 |
| 56 // Add a new left-side decoration to the right of the existing | 56 // Add a new leading decoration after the existing |
| 57 // left-side decorations. | 57 // leading decorations. |
| 58 - (void)addLeftDecoration:(LocationBarDecoration*)decoration; | 58 - (void)addLeadingDecoration:(LocationBarDecoration*)decoration; |
| 59 | 59 |
| 60 // Add a new right-side decoration to the left of the existing | 60 // Add a new trailing decoration before the existing |
| 61 // right-side decorations. | 61 // trailing decorations. |
| 62 - (void)addRightDecoration:(LocationBarDecoration*)decoration; | 62 - (void)addTrailingDecoration:(LocationBarDecoration*)decoration; |
| 63 | 63 |
| 64 // The width available after accounting for decorations. | 64 // The width available after accounting for decorations. |
| 65 - (CGFloat)availableWidthInFrame:(const NSRect)frame; | 65 - (CGFloat)availableWidthInFrame:(const NSRect)frame; |
| 66 | 66 |
| 67 // Return the frame for |aDecoration| if the cell is in |cellFrame|. | 67 // Return the frame for |aDecoration| if the cell is in |cellFrame|. |
| 68 // Returns |NSZeroRect| for decorations which are not currently visible. | 68 // Returns |NSZeroRect| for decorations which are not currently visible. |
| 69 - (NSRect)frameForDecoration:(const LocationBarDecoration*)aDecoration | 69 - (NSRect)frameForDecoration:(const LocationBarDecoration*)aDecoration |
| 70 inFrame:(NSRect)cellFrame; | 70 inFrame:(NSRect)cellFrame; |
| 71 | 71 |
| 72 // Returns the frame representing the background of |decoration|. Also sets | 72 // Returns the frame representing the background of |decoration|. Also sets |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 ofView:(AutocompleteTextField*)controlView; | 135 ofView:(AutocompleteTextField*)controlView; |
| 136 @end | 136 @end |
| 137 | 137 |
| 138 // Methods which are either only for testing, or only public for testing. | 138 // Methods which are either only for testing, or only public for testing. |
| 139 @interface AutocompleteTextFieldCell (TestingAPI) | 139 @interface AutocompleteTextFieldCell (TestingAPI) |
| 140 | 140 |
| 141 // Returns |mouseTrackingDecorations_|. | 141 // Returns |mouseTrackingDecorations_|. |
| 142 - (const std::vector<LocationBarDecoration*>&)mouseTrackingDecorations; | 142 - (const std::vector<LocationBarDecoration*>&)mouseTrackingDecorations; |
| 143 | 143 |
| 144 @end | 144 @end |
| OLD | NEW |