CPSearchField Class Reference
[AppKit]

List of all members.

Public Member Functions

(CPButton- cancelButton [implementation]
(CPRect) - cancelButtonRectForBounds: [implementation]
(CPRect) - contentRectForBounds: [implementation]
(void) - controlTextDidChange: [implementation]
(void) - encodeWithCoder: [implementation]
(id) - initWithCoder: [implementation]
(id) - initWithFrame: [implementation]
(BOOL) - isOpaque [implementation]
(int) - maximumRecents [implementation]
(CPMenu- menu [implementation]
(CPString- recentsAutosaveName [implementation]
(CPArray- recentSearches [implementation]
(void) - resetCancelButton [implementation]
(void) - resetSearchButton [implementation]
(CPButton- searchButton [implementation]
(CPRect) - searchButtonRectForBounds: [implementation]
(CPMenu- searchMenuTemplate [implementation]
(CPRect) - searchTextRectForBounds: [implementation]
(void) - sendAction:to: [implementation]
(BOOL) - sendsSearchStringImmediately [implementation]
(BOOL) - sendsWholeSearchString [implementation]
(void) - setCancelButton: [implementation]
(void) - setMaximumRecents: [implementation]
(void) - setRecentsAutosaveName: [implementation]
(void) - setRecentSearches: [implementation]
(void) - setSearchButton: [implementation]
(void) - setSearchMenuTemplate: [implementation]
(void) - setSendsSearchStringImmediately: [implementation]
(void) - setSendsWholeSearchString: [implementation]
(BOOL) - trackMouse: [implementation]

Static Public Member Functions

(void) + initialize [implementation]

Detailed Description

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 44 of file CPSearchField.j.


Member Function Documentation

- (CPButton) cancelButton   [implementation]

Returns the button object used to display the cancel-button image.

Returns:
The cancel button.

Definition at line 175 of file CPSearchField.j.

- (CPRect) cancelButtonRectForBounds: (CPRect)  rect   [implementation]

Modifies the bounding rectangle for the cancel button.

Parameters:
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 237 of file CPSearchField.j.

- (CPRect) contentRectForBounds: (CPRect)  bounds   [implementation]

Definition at line 376 of file CPSearchField.j.

- (void) controlTextDidChange: (CPNotification aNotification   [implementation]

Definition at line 402 of file CPSearchField.j.

- (void) encodeWithCoder: (CPCoder coder   [implementation]

Definition at line 677 of file CPSearchField.j.

+ (void) initialize   [implementation]

Definition at line 60 of file CPSearchField.j.

- (id) initWithCoder: (CPCoder coder   [implementation]

Definition at line 693 of file CPSearchField.j.

- (id) initWithFrame: (CGRect)  frame   [implementation]

Definition at line 72 of file CPSearchField.j.

- (BOOL) isOpaque   [implementation]

Definition at line 392 of file CPSearchField.j.

- (int) maximumRecents   [implementation]

Returns the maximum number of recent search strings to display in the custom search menu.

Returns:
The maximum number of search strings that can appear in the menu. This value is between 0 and 254.

Definition at line 308 of file CPSearchField.j.

- (CPMenu) menu   [implementation]

Definition at line 387 of file CPSearchField.j.

- (CPString) recentsAutosaveName   [implementation]

Returns the key under which the prior list of recent search strings has been archived.

Returns:
The autosave name, which is used as a key in the standard user defaults to save the recent searches. The default value is nil, which causes searches not to be autosaved.

Definition at line 354 of file CPSearchField.j.

- (CPArray) recentSearches   [implementation]

Returns the list of recent search strings for the control.

Returns:
An array of 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 331 of file CPSearchField.j.

- (void) resetCancelButton   [implementation]

Resets the cancel button to its default attributes. This method resets the target, action, regular image, and pressed image. By default, when users click the cancel button, the delete: action message is sent up the responder chain. 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 184 of file CPSearchField.j.

- (void) resetSearchButton   [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 134 of file CPSearchField.j.

- (CPButton) searchButton   [implementation]

Returns the button used to display the search-button image.

Returns:
The search button.

Definition at line 125 of file CPSearchField.j.

- (CPRect) searchButtonRectForBounds: (CPRect)  rect   [implementation]

Modifies the bounding rectangle for the search button.

Parameters:
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 227 of file CPSearchField.j.

- (CPMenu) searchMenuTemplate   [implementation]

Returns the menu template object used to dynamically construct the search pop-up icon menu.

Returns:
The current menu template.

Definition at line 247 of file CPSearchField.j.

- (CPRect) searchTextRectForBounds: (CPRect)  rect   [implementation]

Modifies the bounding rectangle for the search-text field.

Parameters:
rect The current bounding rectangle for the search text field.
Returns:
The updated bounding rectangle to use for the search text field. The default value is the value passed into the rect parameter. Subclasses can override this method to return a new bounding rectangle for the text-field object. You might use this method to provide a custom layout for the search field control.

Definition at line 203 of file CPSearchField.j.

- (void) sendAction: (SEL)  anAction
to: (id)  anObject 
[implementation]

Definition at line 429 of file CPSearchField.j.

- (BOOL) sendsSearchStringImmediately   [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.

Returns:
YES if the text field sends its action immediately upon notification of any changes to the search field; otherwise, NO.

Definition at line 289 of file CPSearchField.j.

- (BOOL) sendsWholeSearchString   [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.

Returns:
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 271 of file CPSearchField.j.

- (void) setCancelButton: (CPButton button   [implementation]

Sets the button object used to display the cancel-button image.

Parameters:
button The cancel button.

Definition at line 166 of file CPSearchField.j.

- (void) setMaximumRecents: (int)  max   [implementation]

Sets the maximum number of search strings that can appear in the search menu.

Parameters:
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 317 of file CPSearchField.j.

- (void) setRecentsAutosaveName: (CPString name   [implementation]

Sets the autosave name under which the receiver automatically archives the list of recent search strings.

Parameters:
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 363 of file CPSearchField.j.

- (void) setRecentSearches: (CPArray searches   [implementation]

Sets the list of recent search strings to list in the pop-up icon menu of the receiver.

Parameters:
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 341 of file CPSearchField.j.

- (void) setSearchButton: (CPButton button   [implementation]

Sets the button used to display the search-button image

Parameters:
button The search button.

Definition at line 116 of file CPSearchField.j.

- (void) setSearchMenuTemplate: (CPMenu menu   [implementation]

Sets the menu template object used to dynamically construct the receiver's pop-up icon menu.

Parameters:
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 257 of file CPSearchField.j.

- (void) setSendsSearchStringImmediately: (BOOL)  flag   [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.

Parameters:
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 298 of file CPSearchField.j.

- (void) setSendsWholeSearchString: (BOOL)  flag   [implementation]

Sets whether the receiver sends the search action message when the user clicks the search button (or presses return) or after each keystroke.

Parameters:
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 280 of file CPSearchField.j.

- (BOOL) trackMouse: (CPEvent event   [implementation]

Definition at line 450 of file CPSearchField.j.


The documentation for this class was generated from the following file:

Generated on Fri Apr 9 11:04:22 2010 for Cappuccino API by  doxygen 1.6.1