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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_STYLED_TEXT_FIELD_CELL_H_
6 #define CHROME_BROWSER_UI_COCOA_STYLED_TEXT_FIELD_CELL_H_
8 #import <Cocoa/Cocoa.h>
10 #import "chrome/browser/ui/cocoa/rect_path_utils.h"
12 // StyledTextFieldCell customizes the look of the standard Cocoa text field.
13 // The border and focus ring are modified, as is the drawing rect. Subclasses
14 // can override |drawInteriorWithFrame:inView:| to provide custom drawing for
15 // decorations, but they must make sure to call the superclass' implementation
16 // with a modified frame after performing any custom drawing.
18 @interface StyledTextFieldCell
: NSTextFieldCell
{
23 // Methods intended to be overridden by subclasses, not part of the public API
24 // and should not be called outside of subclasses.
25 @interface
StyledTextFieldCell (ProtectedMethods
)
27 // Return the portion of the cell to show the text cursor over. The default
28 // implementation returns the full |cellFrame|. Subclasses should override this
29 // method if they add any decorations.
30 - (NSRect
)textCursorFrameForFrame
:(NSRect
)cellFrame
;
32 // Return the portion of the cell to use for text display. This corresponds to
33 // the frame with our added decorations sliced off. The default implementation
34 // returns the full |cellFrame|, as by default there are no decorations.
35 // Subclasses should override this method if they add any decorations.
36 - (NSRect
)textFrameForFrame
:(NSRect
)cellFrame
;
38 // Offset from the top of the cell frame to the text frame. Defaults to 0.
40 - (CGFloat
)topTextFrameOffset
;
42 // Offset from the bottom of the cell frame to the text frame. Defaults to 0.
44 - (CGFloat
)bottomTextFrameOffset
;
46 // Radius of the corners of the field. Defaults to square corners (0.0).
47 - (CGFloat
)cornerRadius
;
49 // Which corners of the field to round. Defaults to RoundedAll.
50 - (rect_path_utils::RoundedCornerFlags
)roundedFlags
;
52 // Returns YES if a light themed bezel should be drawn under the text field.
53 // Default implementation returns NO.
54 - (BOOL
)shouldDrawBezel
;
58 #endif // CHROME_BROWSER_UI_COCOA_STYLED_TEXT_FIELD_CELL_H_