15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2009 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#import <Cocoa/Cocoa.h>
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@class StyledTextFieldCell;
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// An implementation of NSTextField that is designed to work with
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// StyledTextFieldCell.  Provides methods to redraw the field when cell
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// decorations have changed and overrides |mouseDown:| to properly handle clicks
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// in sections of the cell with decorations.
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@interface StyledTextField : NSTextField {
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Repositions and redraws the field editor.  Call this method when the cell's
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// text frame has changed (whenever changing cell decorations).
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (void)resetFieldEditorFrameIfNeeded;
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Returns the amount of the field's width which is not being taken up
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// by the text contents.  May be negative if the contents are large
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// enough to scroll.
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (CGFloat)availableDecorationWidth;
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@end
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@interface StyledTextField (ExposedForTesting)
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (StyledTextFieldCell*)styledTextFieldCell;
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@end
30