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_STYLED_TEXT_FIELD_CELL_H_ |
| 6 #define CHROME_BROWSER_COCOA_STYLED_TEXT_FIELD_CELL_H_ |
| 7 |
5 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
6 | 9 |
7 // StyledTextFieldCell customizes the look of the standard Cocoa text field. | 10 // StyledTextFieldCell customizes the look of the standard Cocoa text field. |
8 // The border and focus ring are modified, as is the font baseline. Subclasses | 11 // The border and focus ring are modified, as is the font baseline. Subclasses |
9 // can override |drawInteriorWithFrame:inView:| to provide custom drawing for | 12 // can override |drawInteriorWithFrame:inView:| to provide custom drawing for |
10 // decorations, but they must make sure to call the superclass' implementation | 13 // decorations, but they must make sure to call the superclass' implementation |
11 // with a modified frame after performing any custom drawing. | 14 // with a modified frame after performing any custom drawing. |
12 | 15 |
13 @interface StyledTextFieldCell : NSTextFieldCell { | 16 @interface StyledTextFieldCell : NSTextFieldCell { |
14 } | 17 } |
15 | 18 |
16 // Baseline adjust for the text in this cell. Defaults to 0. Subclasses should | 19 @end |
17 // override as needed. | |
18 - (CGFloat)baselineAdjust; | |
19 | 20 |
20 // Radius of the corners of the field. Defaults to square corners (0.0). | 21 // Methods intended to be overridden by subclasses, not part of the public API |
21 - (CGFloat)cornerRadius; | 22 // and should not be called outside of subclasses. |
| 23 @interface StyledTextFieldCell (ProtectedMethods) |
22 | 24 |
23 // Return the portion of the cell to show the text cursor over. The default | 25 // Return the portion of the cell to show the text cursor over. The default |
24 // implementation returns the full |cellFrame|. Subclasses should override this | 26 // implementation returns the full |cellFrame|. Subclasses should override this |
25 // method if they add any decorations. | 27 // method if they add any decorations. |
26 - (NSRect)textCursorFrameForFrame:(NSRect)cellFrame; | 28 - (NSRect)textCursorFrameForFrame:(NSRect)cellFrame; |
27 | 29 |
28 // Return the portion of the cell to use for text display. This corresponds to | 30 // Return the portion of the cell to use for text display. This corresponds to |
29 // the frame with our added decorations sliced off. The default implementation | 31 // the frame with our added decorations sliced off. The default implementation |
30 // returns the full |cellFrame|, as by default there are no decorations. | 32 // returns the full |cellFrame|, as by default there are no decorations. |
31 // Subclasses should override this method if they add any decorations. | 33 // Subclasses should override this method if they add any decorations. |
32 - (NSRect)textFrameForFrame:(NSRect)cellFrame; | 34 - (NSRect)textFrameForFrame:(NSRect)cellFrame; |
33 | 35 |
| 36 // Baseline adjust for the text in this cell. Defaults to 0. Subclasses should |
| 37 // override as needed. |
| 38 - (CGFloat)baselineAdjust; |
| 39 |
| 40 // Radius of the corners of the field. Defaults to square corners (0.0). |
| 41 - (CGFloat)cornerRadius; |
| 42 |
| 43 // Returns YES if a light themed bezel should be drawn under the text field. |
| 44 // Default implementation returns NO. |
| 45 - (BOOL)shouldDrawBezel; |
| 46 |
34 @end | 47 @end |
| 48 |
| 49 #endif // CHROME_BROWSER_COCOA_STYLED_TEXT_FIELD_CELL_H_ |
OLD | NEW |