![]() |
API 0.9.5
|
#import <CPTextField.h>
This control displays editable text in a Cappuccino application.
Definition at line 2 of file CPTextField.h.
- (BOOL) acceptsFirstResponder |
Returns YES
if the receiver is able to become the first responder. NO
otherwise.
Reimplemented from CPResponder.
Definition at line 460 of file CPTextField.j.
- (BOOL) becomeFirstResponder |
Notifies the receiver that it will become the first responder. The receiver can reject first responder if it returns NO
. The default implementation always returns YES
.
YES
if the receiver accepts first responder status. Reimplemented from CPResponder.
Reimplemented in CPTokenField.
Definition at line 466 of file CPTextField.j.
- (CGRect) bezelRectForBounds: | (CGRect) | bounds |
Definition at line 1317 of file CPTextField.j.
- (CPTextFieldBezelStyle) bezelStyle |
Returns the textfield's bezel style.
Definition at line 385 of file CPTextField.j.
- (CGRect) contentRectForBounds: | (CGRect) | bounds |
Reimplemented in CPSearchField.
Definition at line 1302 of file CPTextField.j.
- (void) copy: | (id) | sender |
Definition at line 1094 of file CPTextField.j.
Reimplemented from CPView.
Definition at line 1343 of file CPTextField.j.
- (void) cut: | (id) | sender |
Definition at line 1111 of file CPTextField.j.
+ (CPString) defaultThemeClass |
Reimplemented from CPView.
Reimplemented in CPSearchField, and CPTokenField.
Definition at line 152 of file CPTextField.j.
- (id) delegate |
Definition at line 1297 of file CPTextField.j.
- (void) deleteBackward: | (id) | sender |
Definition at line 1226 of file CPTextField.j.
- (void) doCommandBySelector: | (SEL) | aSelector |
Invoke the action specified by aSelector on the current responder.
This is implemented by CPResponder and by default it passes any unrecognized actions on to the next responder but text fields apparently aren't supposed to do that according to this documentation by Apple:
Reimplemented from CPResponder.
Definition at line 770 of file CPTextField.j.
- (BOOL) drawsBackground |
Returns YES
if the textfield draws a background.
Definition at line 431 of file CPTextField.j.
- (void) encodeWithCoder: | (CPCoder) | aCoder |
Encodes the data of this textfield into the provided coder.
aCoder | the coder into which the data will be written |
Reimplemented from CPControl.
Reimplemented in CPSearchField, and CPTokenField.
Definition at line 1479 of file CPTextField.j.
- (id) initWithCoder: | (CPCoder) | aCoder |
Initializes the textfield with data from a coder.
aCoder | the coder from which to read the textfield data |
Reimplemented from CPControl.
Reimplemented in CPSearchField, and CPTokenField.
Definition at line 1453 of file CPTextField.j.
- (id) initWithFrame: | (CGRect) | aFrame |
Initializes the receiver for usage with the specified bounding rectangle
Reimplemented from CPControl.
Reimplemented in CPSearchField.
Definition at line 254 of file CPTextField.j.
- (void) insertNewline: | (id) | aSender |
Insert a line break at the caret position or selection.
aSender | the object requesting this |
Reimplemented from CPResponder.
Definition at line 776 of file CPTextField.j.
- (void) insertNewlineIgnoringFieldEditor: | (id) | sender |
Definition at line 809 of file CPTextField.j.
- (void) insertTabIgnoringFieldEditor: | (id) | sender |
Definition at line 814 of file CPTextField.j.
- (BOOL) isBezeled |
Returns YES
if the textfield draws a bezeled border.
Definition at line 363 of file CPTextField.j.
- (BOOL) isBordered |
Returns YES
if the textfield has a border.
Definition at line 408 of file CPTextField.j.
- (BOOL) isEditable |
Returns YES
if the textfield is currently editable by the user.
Definition at line 295 of file CPTextField.j.
- (BOOL) isSecure |
Returns YES
if the field's text is secure (password entry).
Reimplemented in CPSecureTextField.
Definition at line 342 of file CPTextField.j.
- (BOOL) isSelectable |
Returns YES
if the field's text is selectable by the user.
Definition at line 325 of file CPTextField.j.
- (void) keyDown: | (CPEvent) | anEvent |
Notifies the receiver that the user has pressed a key.
anEvent | information about the key press |
Reimplemented from CPResponder.
Definition at line 748 of file CPTextField.j.
- (void) keyUp: | (CPEvent) | anEvent |
Notifies the receiver that the user has released a key.
anEvent | information about the key press |
Reimplemented from CPResponder.
Definition at line 724 of file CPTextField.j.
+ (CPTextField) labelWithTitle: | (CPString) | aTitle |
Definition at line 137 of file CPTextField.j.
+ (CPTextField) labelWithTitle: | (CPString) | aTitle | |
theme: | (CPTheme) | aTheme | |
Definition at line 142 of file CPTextField.j.
- (void) layoutSubviews |
Reimplemented from CPView.
Reimplemented in CPTokenField.
Definition at line 1366 of file CPTextField.j.
- (void) mouseDown: | (CPEvent) | anEvent |
Notifies the receiver that the user has clicked the mouse down in its area.
anEvent | contains information about the click |
Reimplemented from CPControl.
Reimplemented in CPSearchField, and CPTokenField.
Definition at line 674 of file CPTextField.j.
- (void) mouseDragged: | (CPEvent) | anEvent |
Notifies the receiver that the user has initiated a drag over it. A drag is a mouse movement while the left button is down.
anEvent | contains information about the drag |
Reimplemented from CPResponder.
Definition at line 716 of file CPTextField.j.
- (void) mouseUp: | (CPEvent) | anEvent |
Notifies the receiver that the user has released the left mouse button.
anEvent | contains information about the release |
Reimplemented from CPResponder.
Reimplemented in CPTokenField.
Definition at line 698 of file CPTextField.j.
- (BOOL) needsPanelToBecomeKey |
Text fields require panels to become key window, so this returns YES
.
Reimplemented from CPView.
Definition at line 669 of file CPTextField.j.
- (id) objectValue |
Returns the string in the text field.
Reimplemented from CPControl.
Reimplemented in CPTokenField.
Definition at line 876 of file CPTextField.j.
- (void) paste: | (id) | sender |
Definition at line 1122 of file CPTextField.j.
- (CPString) placeholderString |
Returns the receiver's placeholder string
Definition at line 996 of file CPTextField.j.
- (CGRect) rectForEphemeralSubviewNamed: | (CPString) | aName |
Reimplemented from CPView.
Definition at line 1332 of file CPTextField.j.
- (BOOL) resignFirstResponder |
Notifies the receiver that it has been asked to give up first responder status.
YES
if the receiver is willing to give up first responder status. Reimplemented from CPResponder.
Reimplemented in CPSearchField, and CPTokenField.
Definition at line 565 of file CPTextField.j.
+ (CPTextField) roundedTextFieldWithStringValue: | (CPString) | aStringValue | |
placeholder: | (CPString) | aPlaceholder | |
width: | (float) | aWidth | |
Definition at line 115 of file CPTextField.j.
+ (CPTextField) roundedTextFieldWithStringValue: | (CPString) | aStringValue | |
placeholder: | (CPString) | aPlaceholder | |
width: | (float) | aWidth | |
theme: | (CPTheme) | aTheme | |
Definition at line 120 of file CPTextField.j.
- (void) selectAll: | (id) | sender |
Definition at line 1221 of file CPTextField.j.
- (CPRange) selectedRange |
Definition at line 1144 of file CPTextField.j.
- (void) selectText: | (id) | sender |
Make the receiver the first responder and select all the text in the field.
Definition at line 1072 of file CPTextField.j.
- (void) setBezeled: | (BOOL) | shouldBeBezeled |
Sets whether the textfield will have a bezeled border.
shouldBeBezeled | YES means the textfield will draw a bezeled border |
Definition at line 352 of file CPTextField.j.
- (void) setBezelStyle: | (CPTextFieldBezelStyle) | aBezelStyle |
Sets the textfield's bezel style.
aBezelStyle | the constant for the desired bezel style |
Definition at line 372 of file CPTextField.j.
- (void) setBordered: | (BOOL) | shouldBeBordered |
Sets whether the textfield will have a border drawn.
shouldBeBordered | YES makes the textfield draw a border |
Definition at line 397 of file CPTextField.j.
- (void) setDelegate: | (id) | aDelegate |
Definition at line 1244 of file CPTextField.j.
- (void) setDrawsBackground: | (BOOL) | shouldDrawBackground |
Sets whether the textfield will have a background drawn.
shouldDrawBackground | YES makes the textfield draw a background |
Definition at line 417 of file CPTextField.j.
- (void) setEditable: | (BOOL) | shouldBeEditable |
Sets whether or not the receiver text field can be edited. If NO, any ongoing edit is ended.
Definition at line 277 of file CPTextField.j.
- (void) setEnabled: | (BOOL) | shouldBeEnabled |
Sets whether the field reacts to events. If NO, any ongoing edit is ended.
Reimplemented from CPControl.
Definition at line 304 of file CPTextField.j.
- (void) setObjectValue: | (id) | anObject |
Sets the receiver's object value.
Reimplemented from CPControl.
Reimplemented in CPTokenField.
Definition at line 930 of file CPTextField.j.
- (void) setPlaceholderString: | (CPString) | aStringValue |
Sets a placeholder string for the receiver. The placeholder is displayed until editing begins, and after editing ends, if the text field has an empty string value
Definition at line 978 of file CPTextField.j.
- (void) setSecure: | (BOOL) | aFlag |
Sets whether the field's text is secure.
aFlag | YES makes the text secure |
Definition at line 334 of file CPTextField.j.
- (void) setSelectable: | (BOOL) | aFlag |
Sets whether the field's text is selectable by the user.
aFlag | YES makes the text selectable |
Definition at line 317 of file CPTextField.j.
- (void) setSelectedRange: | (CPRange) | aRange |
Definition at line 1182 of file CPTextField.j.
- (void) setTextFieldBackgroundColor: | (CPColor) | aColor |
Sets the background color, which is shown for non-bezeled text fields with drawsBackground set to YES
aColor | The background color |
Definition at line 440 of file CPTextField.j.
- (void) sizeToFit |
For non-bezeled text fields (typically a label), sizeToFit has two behaviors, depending on the line break mode of the receiver.
For non-bezeled receivers with a non-wrapping line break mode, sizeToFit will change the frame of the receiver to perfectly fit the current text in stringValue in the current font, respecting the current theme value for content-inset. For receivers with a wrapping line break mode, sizeToFit will wrap the text within the current width (respecting the current content-inset), so it will ONLY change the HEIGHT.
For bezeled text fields (typically editable fields), sizeToFit will ONLY change the HEIGHT of the text field. It will not change the width of the text field. sizeToFit will attempt to change the height to fit a single line of text, respecting the current theme values for min-size, max-size and content-inset.
The logic behind this decision is that most of the time you do not know what content will be placed in a bezeled text field, so you want to just choose a fixed width and leave it at that size. However, since you don't know how tall it needs to be if you change the font, sizeToFit will still be useful for making the textfield an appropriate height.
Definition at line 1021 of file CPTextField.j.
Definition at line 1407 of file CPTextField.j.
- (void) textDidBlur: | (CPNotification) | note |
Definition at line 845 of file CPTextField.j.
- (void) textDidChange: | (CPNotification) | note |
Reimplemented from CPControl.
Definition at line 863 of file CPTextField.j.
- (void) textDidFocus: | (CPNotification) | note |
Definition at line 854 of file CPTextField.j.
- (CPColor) textFieldBackgroundColor |
Returns the background color.
Definition at line 454 of file CPTextField.j.
+ (CPTextField) textFieldWithStringValue: | (CPString) | aStringValue | |
placeholder: | (CPString) | aPlaceholder | |
width: | (float) | aWidth | |
Definition at line 94 of file CPTextField.j.
+ (CPTextField) textFieldWithStringValue: | (CPString) | aStringValue | |
placeholder: | (CPString) | aPlaceholder | |
width: | (float) | aWidth | |
theme: | (CPTheme) | aTheme | |
Definition at line 99 of file CPTextField.j.
+ (id) themeAttributes |
Reimplemented from CPControl.
Definition at line 165 of file CPTextField.j.