Trait NSTextFieldDelegate

Source
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§

Source

unsafe fn textField_textView_candidatesForSelectedRange( &self, text_field: &NSTextField, text_view: &NSTextView, selected_range: NSRange, ) -> Option<Retained<NSArray>>
where Self: Sized + Message,

Available on crate features 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.
Source

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,

Available on crate features 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.
Source

unsafe fn textField_textView_shouldSelectCandidateAtIndex( &self, text_field: &NSTextField, text_view: &NSTextView, index: NSUInteger, ) -> bool
where Self: Sized + Message,

Available on crate features 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 allows textView to insert the candidate into the text storage if it’s NSString, NSAttributedString, or NSTextCheckingResult.

Trait Implementations§

Source§

impl ProtocolType for dyn NSTextFieldDelegate

Source§

const NAME: &'static str = "NSTextFieldDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn NSTextFieldDelegate

Implementations on Foreign Types§

Source§

impl<T> NSTextFieldDelegate for ProtocolObject<T>

Implementors§