summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/cocoa/styled_text_field.h
blob: 68a65b77529a40844412e168e1f4ec24d66f15f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import <Cocoa/Cocoa.h>

@class StyledTextFieldCell;

// An implementation of NSTextField that is designed to work with
// StyledTextFieldCell.  Provides methods to redraw the field when cell
// decorations have changed and overrides |mouseDown:| to properly handle clicks
// in sections of the cell with decorations.
@interface StyledTextField : NSTextField {
}

// Repositions and redraws the field editor.  Call this method when the cell's
// text frame has changed (whenever changing cell decorations).
- (void)resetFieldEditorFrameIfNeeded;

// Returns the amount of the field's width which is not being taken up
// by the text contents.  May be negative if the contents are large
// enough to scroll.
- (CGFloat)availableDecorationWidth;

@end

@interface StyledTextField (ExposedForTesting)
- (StyledTextFieldCell*)styledTextFieldCell;
@end