pub unsafe trait NSTextFieldDelegate: NSControlTextEditingDelegate + MainThreadOnly {
// Provided methods
unsafe fn textField_textView_candidatesForSelectedRange(
&self,
text_field: &NSTextField,
text_view: &NSTextView,
selected_range: NSRange,
) -> Option<Retained<NSArray>>
where Self: Sized + Message { ... }
unsafe fn textField_textView_candidates_forSelectedRange(
&self,
text_field: &NSTextField,
text_view: &NSTextView,
candidates: &NSArray<NSTextCheckingResult>,
selected_range: NSRange,
) -> Retained<NSArray<NSTextCheckingResult>>
where Self: Sized + Message { ... }
unsafe fn textField_textView_shouldSelectCandidateAtIndex(
&self,
text_field: &NSTextField,
text_view: &NSTextView,
index: NSUInteger,
) -> bool
where Self: Sized + Message { ... }
}
Available on crate features
NSControl
and NSTextField
only.Expand description
Provided Methods§
Sourceunsafe fn textField_textView_candidatesForSelectedRange(
&self,
text_field: &NSTextField,
text_view: &NSTextView,
selected_range: NSRange,
) -> Option<Retained<NSArray>>
Available on crate features NSResponder
and NSText
and NSTextView
and NSView
only.
unsafe fn textField_textView_candidatesForSelectedRange( &self, text_field: &NSTextField, text_view: &NSTextView, selected_range: NSRange, ) -> Option<Retained<NSArray>>
NSResponder
and NSText
and NSTextView
and NSView
only.Provides a customized list of candidates to the text view’s candidateListTouchBarItem
. Invoked from -updateCandidates
. NSTextView
uses the candidates returned from this method and suppress its built-in candidate generation. Returning nil
from this delegate method allows NSTextView
to query candidates from NSSpellChecker
.
- Returns: An array of objects that represent the elements of a selection.
Sourceunsafe fn textField_textView_candidates_forSelectedRange(
&self,
text_field: &NSTextField,
text_view: &NSTextView,
candidates: &NSArray<NSTextCheckingResult>,
selected_range: NSRange,
) -> Retained<NSArray<NSTextCheckingResult>>
Available on crate features NSResponder
and NSText
and NSTextView
and NSView
only.
unsafe fn textField_textView_candidates_forSelectedRange( &self, text_field: &NSTextField, text_view: &NSTextView, candidates: &NSArray<NSTextCheckingResult>, selected_range: NSRange, ) -> Retained<NSArray<NSTextCheckingResult>>
NSResponder
and NSText
and NSTextView
and NSView
only.Allows customizing the candidate list queried from NSSpellChecker
.
- Returns: An array of text objects to include in a text selection.
Sourceunsafe fn textField_textView_shouldSelectCandidateAtIndex(
&self,
text_field: &NSTextField,
text_view: &NSTextView,
index: NSUInteger,
) -> bool
Available on crate features NSResponder
and NSText
and NSTextView
and NSView
only.
unsafe fn textField_textView_shouldSelectCandidateAtIndex( &self, text_field: &NSTextField, text_view: &NSTextView, index: NSUInteger, ) -> bool
NSResponder
and NSText
and NSTextView
and NSView
only.Notifies the delegate that the user selected the candidate at index in -[NSCandidateListTouchBarItem candidates]
for the text view’s candidateListTouchBarItem
. Returns a Boolean value that indicates whether to select the text object at the index.
- Parameters:
- textField: The text field that sent the message.
- textView: The text view that sent the message.
- index: The index that represents the start of the candidate text to evaluate, or
NSNotFound
if no candidate is to be selected. - Returns:
YES
if the framework selects the text.YES
allowstextView
to insert the candidate into the text storage if it’sNSString
,NSAttributedString
, orNSTextCheckingResult
.