Skip to main content

NSTokenFieldDelegate

Trait NSTokenFieldDelegate 

Source
pub unsafe trait NSTokenFieldDelegate: NSTextFieldDelegate + MainThreadOnly {
    // Provided methods
    unsafe fn tokenField_completionsForSubstring_indexOfToken_indexOfSelectedItem(
        &self,
        token_field: &NSTokenField,
        substring: &NSString,
        token_index: NSInteger,
        selected_index: *mut NSInteger,
    ) -> Option<Retained<NSArray>>
       where Self: Sized + Message { ... }
    unsafe fn tokenField_shouldAddObjects_atIndex(
        &self,
        token_field: &NSTokenField,
        tokens: &NSArray,
        index: NSUInteger,
    ) -> Retained<NSArray>
       where Self: Sized + Message { ... }
    unsafe fn tokenField_displayStringForRepresentedObject(
        &self,
        token_field: &NSTokenField,
        represented_object: &AnyObject,
    ) -> Option<Retained<NSString>>
       where Self: Sized + Message { ... }
    unsafe fn tokenField_editingStringForRepresentedObject(
        &self,
        token_field: &NSTokenField,
        represented_object: &AnyObject,
    ) -> Option<Retained<NSString>>
       where Self: Sized + Message { ... }
    fn tokenField_representedObjectForEditingString(
        &self,
        token_field: &NSTokenField,
        editing_string: &NSString,
    ) -> Option<Retained<AnyObject>>
       where Self: Sized + Message { ... }
    unsafe fn tokenField_writeRepresentedObjects_toPasteboard(
        &self,
        token_field: &NSTokenField,
        objects: &NSArray,
        pboard: &NSPasteboard,
    ) -> bool
       where Self: Sized + Message { ... }
    fn tokenField_readFromPasteboard(
        &self,
        token_field: &NSTokenField,
        pboard: &NSPasteboard,
    ) -> Option<Retained<NSArray>>
       where Self: Sized + Message { ... }
    unsafe fn tokenField_menuForRepresentedObject(
        &self,
        token_field: &NSTokenField,
        represented_object: &AnyObject,
    ) -> Option<Retained<NSMenu>>
       where Self: Sized + Message { ... }
    unsafe fn tokenField_hasMenuForRepresentedObject(
        &self,
        token_field: &NSTokenField,
        represented_object: &AnyObject,
    ) -> bool
       where Self: Sized + Message { ... }
    unsafe fn tokenField_styleForRepresentedObject(
        &self,
        token_field: &NSTokenField,
        represented_object: &AnyObject,
    ) -> NSTokenStyle
       where Self: Sized + Message { ... }
}
Available on crate features NSControl and NSTextField and NSTokenField only.
Expand description

Provided Methods§

Source

unsafe fn tokenField_completionsForSubstring_indexOfToken_indexOfSelectedItem( &self, token_field: &NSTokenField, substring: &NSString, token_index: NSInteger, selected_index: *mut NSInteger, ) -> Option<Retained<NSArray>>
where Self: Sized + Message,

Available on crate features NSResponder and NSView only.

Allows the delegate to provide an array of appropriate completions for the contents of the receiver

Parameter tokenField: The token field where editing is occurring

Parameter substring: The partial string that is being completed

Parameter tokenIndex: The index of the token being completed

Parameter selectedIndex: Optionally, you can return by reference an index into the returned array that specifies which of the completions should be initially selected. If none are to be selected, return by reference -1.

Returns: An array of strings (NSString) that are possible completions, or nil to provide no completions

If the delegate does not implement this method, no completions are provided

§Safety

selected_index must be a valid pointer or null.

Source

unsafe fn tokenField_shouldAddObjects_atIndex( &self, token_field: &NSTokenField, tokens: &NSArray, index: NSUInteger, ) -> Retained<NSArray>
where Self: Sized + Message,

Available on crate features NSResponder and NSView only.
§Safety

tokens generic should be of the correct type.

Source

unsafe fn tokenField_displayStringForRepresentedObject( &self, token_field: &NSTokenField, represented_object: &AnyObject, ) -> Option<Retained<NSString>>
where Self: Sized + Message,

Available on crate features NSResponder and NSView only.
§Safety

represented_object should be of the correct type.

Source

unsafe fn tokenField_editingStringForRepresentedObject( &self, token_field: &NSTokenField, represented_object: &AnyObject, ) -> Option<Retained<NSString>>
where Self: Sized + Message,

Available on crate features NSResponder and NSView only.
§Safety

represented_object should be of the correct type.

Source

fn tokenField_representedObjectForEditingString( &self, token_field: &NSTokenField, editing_string: &NSString, ) -> Option<Retained<AnyObject>>
where Self: Sized + Message,

Available on crate features NSResponder and NSView only.
Source

unsafe fn tokenField_writeRepresentedObjects_toPasteboard( &self, token_field: &NSTokenField, objects: &NSArray, pboard: &NSPasteboard, ) -> bool
where Self: Sized + Message,

Available on crate features NSPasteboard and NSResponder and NSView only.
§Safety

objects generic should be of the correct type.

Source

fn tokenField_readFromPasteboard( &self, token_field: &NSTokenField, pboard: &NSPasteboard, ) -> Option<Retained<NSArray>>
where Self: Sized + Message,

Available on crate features NSPasteboard and NSResponder and NSView only.
Source

unsafe fn tokenField_menuForRepresentedObject( &self, token_field: &NSTokenField, represented_object: &AnyObject, ) -> Option<Retained<NSMenu>>
where Self: Sized + Message,

Available on crate features NSMenu and NSResponder and NSView only.
§Safety

represented_object should be of the correct type.

Source

unsafe fn tokenField_hasMenuForRepresentedObject( &self, token_field: &NSTokenField, represented_object: &AnyObject, ) -> bool
where Self: Sized + Message,

Available on crate features NSResponder and NSView only.
§Safety

represented_object should be of the correct type.

Source

unsafe fn tokenField_styleForRepresentedObject( &self, token_field: &NSTokenField, represented_object: &AnyObject, ) -> NSTokenStyle
where Self: Sized + Message,

Available on crate features NSResponder and NSTokenFieldCell and NSView only.
§Safety

represented_object should be of the correct type.

Trait Implementations§

Source§

impl<T> ImplementedBy<T> for dyn NSTokenFieldDelegate

Source§

impl ProtocolType for dyn NSTokenFieldDelegate

Source§

const NAME: &'static str = "NSTokenFieldDelegate"

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

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> NSTokenFieldDelegate for ProtocolObject<T>

Implementors§