1 // Copyright (c) 2013 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_AUTOFILL_AUTOFILL_TEXTFIELD_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_TEXTFIELD_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/mac/scoped_nsobject.h"
11 #include "chrome/browser/ui/cocoa/autofill/autofill_input_field.h"
13 // Text field used for text inputs inside Autofill.
14 // Provides a red outline when the contents are marked invalid.
15 @interface AutofillTextField
: NSTextField
<AutofillInputField
,
16 NSTextFieldDelegate
> {
18 id
<AutofillInputDelegate
> inputDelegate_
;
19 base::scoped_nsobject
<NSString
> validityMessage_
;
21 // |shouldFilterFirstClick_| ensures only the very first click after
22 // -becomeFirstResponder: is treated specially.
23 BOOL shouldFilterClick_
;
25 // YES if the field is currently handling a click that caused the field to
26 // become first responder.
27 BOOL handlingFirstClick_
;
29 // YES if the field allows input of multiple lines of text.
33 @
property(nonatomic
, assign
) BOOL isMultiline
;
35 // Can be invoked by field editor to forward mouseDown messages from the field
36 // editor to the AutofillTextField.
37 - (void)onEditorMouseDown
:(id
)sender
;
39 // Returns the frame reserved for the decoration set on the cell.
40 - (NSRect
)decorationFrame
;
44 @interface AutofillTextFieldCell
: NSTextFieldCell
<AutofillInputCell
> {
47 NSString
* defaultValue_
;
48 base::scoped_nsobject
<NSImage
> icon_
;
50 // The size of the decoration for the field. This is most commonly the
51 // |icon_|'s size, but can also be used to reserve space for a decoration that
52 // is not drawn by this cell.
53 NSSize decorationSize_
;
56 @
property(nonatomic
, retain
) NSImage
* icon
;
57 @
property(nonatomic
, assign
) NSSize decorationSize
;
59 // Returns the frame reserved for a decoration of size |decorationSize|.
60 - (NSRect
)decorationFrameForFrame
:(NSRect
)frame
;
64 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_TEXTFIELD_H_