#import <CPSearchField.h>
Class Methods | |
(CPString) | + defaultThemeClass |
(CPDictionary) | + themeAttributes |
Class Methods inherited from CPTextField | |
(CPTextField) | + labelWithTitle: |
(CPTextField) | + labelWithTitle:theme: |
(CPTextField) | + roundedTextFieldWithStringValue:placeholder:width: |
(CPTextField) | + roundedTextFieldWithStringValue:placeholder:width:theme: |
(CPTextField) | + textFieldWithStringValue:placeholder:width: |
(CPTextField) | + textFieldWithStringValue:placeholder:width:theme: |
Class Methods inherited from CPControl | |
(void) | + initialize |
Class Methods inherited from CPView | |
(Class) | + animatorClass |
(CAAnimation) | + defaultAnimationForKey: |
(CPMenu) | + defaultMenu |
(BOOL) | + isHighDPIDrawingEnabled |
(CPSet) | + keyPathsForValuesAffectingBounds |
(CPSet) | + keyPathsForValuesAffectingFrame |
(void) | + setHighDPIDrawingEnabled: |
The CPSearchField class defines the programmatic interface for text fields that are optimized for text-based searches. A CPSearchField object directly inherits from the CPTextField class. The search field implemented by these classes presents a standard user interface for searches, including a search button, a cancel button, and a pop-up icon menu for listing recent search strings and custom search categories.
When the user types and then pauses, the text field's action message is sent to its target. You can query the text field's string value for the current text to search for. Do not rely on the sender of the action to be an CPMenu object because the menu may change. If you need to change the menu, modify the search menu template and call the setSearchMenuTemplate: method to update.
Definition at line 2 of file CPSearchField.h.
|
implementation |
Returns the button object used to display the cancel-button image.
Definition at line 213 of file CPSearchField.j.
|
implementation |
Modifies the bounding rectangle for the cancel button.
rect | The updated bounding rectangle to use for the cancel button. The default value is the value passed into the rect parameter. Subclasses can override this method to return a new bounding rectangle for the cancel button. You might use this method to provide a custom layout for the search field control. |
Definition at line 281 of file CPSearchField.j.
|
implementation |
Definition at line 703 of file CPSearchField.j.
|
implementation |
Reimplemented from CPTextField.
Definition at line 423 of file CPSearchField.j.
|
implementation |
Reimplemented from CPTextField.
Provided by category CPSearchField(CPTrackingArea).
Definition at line 824 of file CPSearchField.j.
|
implementation |
Provides the common case items for a recent searches menu.
If there are 1 more recent searches, it displays:
Clear --------------------- Recent Searches recent search 1 recent search 2 etc.
If you wish to add items before or after the template, you can. If you put items before, a separator will automatically be placed before the default template item. If you add items after the default template, it is your responsibility to add a separator.
To add a custom item:
item = [[CPMenuItem alloc] initWithTitle:"google" action:(google:) keyEquivalent:""]; [item setTag:700]; [item setTarget:self]; [template addItem:item];
Be sure that your custom items do not use tags in the range 1000-1003 inclusive. If you wish to maintain state in custom menu items that you add, you will need to maintain the item state yourself, then in the action method of the custom items, modify the items in the search menu template and send [searchField setSearchMenuTemplate:template] to update the menu.
Definition at line 564 of file CPSearchField.j.
|
implementation |
Reimplemented from CPTextField.
Definition at line 57 of file CPSearchField.j.
|
implementation |
Encodes the data of this textfield into the provided coder.
aCoder | the coder into which the data will be written |
Reimplemented from CPTextField.
Provided by category CPSearchField(CPCoding).
Definition at line 844 of file CPSearchField.j.
|
implementation |
Tests whether a point is contained within this view, or one of its subviews.
aPoint | the point to test |
Reimplemented from CPView.
Definition at line 497 of file CPSearchField.j.
|
implementation |
Initializes the textfield with data from a coder.
aCoder | the coder from which to read the textfield data |
Reimplemented from CPTextField.
Provided by category CPSearchField(CPCoding).
Definition at line 867 of file CPSearchField.j.
|
implementation |
Initializes the receiver for usage with the specified bounding rectangle
Reimplemented from CPTextField.
Definition at line 84 of file CPSearchField.j.
|
implementation |
Returns whether the receiver is completely opaque. By default, returns NO
.
Reimplemented from CPView.
Definition at line 439 of file CPSearchField.j.
|
implementation |
Returns the maximum number of recent search strings to display in the custom search menu.
Definition at line 355 of file CPSearchField.j.
|
implementation |
Definition at line 434 of file CPSearchField.j.
|
implementation |
Definition at line 675 of file CPSearchField.j.
|
implementation |
Definition at line 670 of file CPSearchField.j.
|
implementation |
Reimplemented from CPTextField.
Definition at line 511 of file CPSearchField.j.
|
implementation |
Returns the key under which the prior list of recent search strings has been archived.
Definition at line 401 of file CPSearchField.j.
|
implementation |
Returns the list of recent search strings for the control.
CPString
objects, each of which contains a search string either displayed in the search menu or from a recent autosave archive. If there have been no recent searches and no prior searches saved under an autosave name, this array may be empty. Definition at line 378 of file CPSearchField.j.
|
implementation |
Resets the cancel button to its default attributes. This method resets the target, action, regular image, and pressed image. This method gives you a way to customize the cancel button for specific situations and then reset the button defaults without having to undo changes individually.
Definition at line 222 of file CPSearchField.j.
|
implementation |
Resets the search button to its default attributes. This method resets the target, action, regular image, and pressed image. By default, when users click the search button or press the Return key, the action defined for the receiver is sent to its designated target. This method gives you a way to customize the search button for specific situations and then reset the button defaults without having to undo changes individually.
Definition at line 177 of file CPSearchField.j.
|
implementation |
Reimplemented from CPTextField.
Definition at line 506 of file CPSearchField.j.
|
implementation |
Returns the button used to display the search-button image.
Definition at line 168 of file CPSearchField.j.
|
implementation |
Modifies the bounding rectangle for the search button.
rect | The current bounding rectangle for the search button. Subclasses can override this method to return a new bounding rectangle for the search button. You might use this method to provide a custom layout for the search field control. |
Definition at line 268 of file CPSearchField.j.
|
implementation |
Returns the menu template object used to dynamically construct the search pop-up icon menu.
Definition at line 294 of file CPSearchField.j.
|
implementation |
Modifies the bounding rectangle for the search-text field.
rect | The current bounding rectangle for the search text field. |
Definition at line 241 of file CPSearchField.j.
|
implementation |
Causes anAction
to be sent to anObject
.
anAction | the action to send |
anObject | the object to which the action will be sent |
Reimplemented from CPControl.
Definition at line 476 of file CPSearchField.j.
|
implementation |
Returns a Boolean value indicating whether the receiver sends its action immediately upon being notified of changes to the search field text or after a brief pause.
YES
if the text field sends its action immediately upon notification of any changes to the search field; otherwise, NO. Definition at line 336 of file CPSearchField.j.
|
implementation |
Returns a Boolean value indicating whether the receiver sends the search action message when the user clicks the search button (or presses return) or after each keystroke.
YES
if the action message is sent all at once when the user clicks the search button or presses return; otherwise, NO if the search string is sent after each keystroke. The default value is NO. Definition at line 318 of file CPSearchField.j.
|
implementation |
Sets the button object used to display the cancel-button image.
button | The cancel button. |
Definition at line 192 of file CPSearchField.j.
|
implementation |
Sets the maximum number of search strings that can appear in the search menu.
maxRecents | The maximum number of search strings that can appear in the menu. This value can be between 0 and 254. Specifying a value less than 0 sets the value to the default, which is 10. Specifying a value greater than 254 sets the maximum to 254. |
Definition at line 364 of file CPSearchField.j.
|
implementation |
Sets the autosave name under which the receiver automatically archives the list of recent search strings.
name | The autosave name, which is used as a key in the standard user defaults to save the recent searches. If you specify nil or an empty string for this parameter, no autosave name is set and searches are not autosaved. |
Definition at line 410 of file CPSearchField.j.
|
implementation |
Sets the list of recent search strings to list in the pop-up icon menu of the receiver.
searches | An array of CPString objects containing the search strings. You might use this method to set the recent list of searches from an archived copy. |
Definition at line 388 of file CPSearchField.j.
|
implementation |
Sets the button used to display the search-button image
button | The search button. |
Definition at line 151 of file CPSearchField.j.
|
implementation |
Sets the menu template object used to dynamically construct the receiver's pop-up icon menu.
menu | The menu template to use. The receiver looks for the tag constants described in ŇMenu tagsÓ to determine how to populate the menu with items related to recent searches. See ŇConfiguring a Search MenuÓ for a sample of how you might set up the search menu template. |
Definition at line 304 of file CPSearchField.j.
|
implementation |
Sets whether the text field sends its action message to the target immediately upon notification of any changes to the search field text or after a brief pause.
flag | YES to send the text field's action immediately upon notification of any changes to the search field; otherwise, NO if you want the text field to pause briefly before sending its action message. Pausing gives the user the opportunity to type more text into the search field before initiating the search. |
Definition at line 345 of file CPSearchField.j.
|
implementation |
Sets whether the receiver sends the search action message when the user clicks the search button (or presses return) or after each keystroke.
flag | YES to send the action message all at once when the user clicks the search button or presses return; otherwise, NO to send the search string after each keystroke. |
Definition at line 327 of file CPSearchField.j.
|
implementation |
Reimplemented from CPTextField.
Definition at line 62 of file CPSearchField.j.
|
implementation |
Definition at line 767 of file CPSearchField.j.
|
implementation |
Invoked automatically when the view’s geometry changes such that its tracking areas need to be recalculated.
You should override this method to remove out of date tracking areas, add recomputed tracking areas and then call super;
Cocoa calls this on every view, whereas they have tracking area(s) or not. Cappuccino behaves differently :
Please note that it is the owner of a tracking area who is called for updateTrackingAreas. But, if a view without any tracking area is inserted in the view hierarchy (that is, in a window), the view is called for updateTrackingAreas. This enables you to use updateTrackingArea to initially attach your tracking areas to the view.
Reimplemented from CPTextField.
Provided by category CPSearchField(CPTrackingArea).
Definition at line 787 of file CPSearchField.j.