implement static method

NSTokenFieldDelegate implement({
  1. NSArray? tokenField_completionsForSubstring_indexOfToken_indexOfSelectedItem_(
    1. NSTokenField,
    2. NSString,
    3. DartNSInteger,
    4. Pointer<NSInteger>,
    )?,
  2. NSArray tokenField_shouldAddObjects_atIndex_(
    1. NSTokenField,
    2. NSArray,
    3. DartNSUInteger
    )?,
  3. NSString? tokenField_displayStringForRepresentedObject_(
    1. NSTokenField,
    2. ObjCObjectBase
    )?,
  4. NSString? tokenField_editingStringForRepresentedObject_(
    1. NSTokenField,
    2. ObjCObjectBase
    )?,
  5. ObjCObjectBase? tokenField_representedObjectForEditingString_(
    1. NSTokenField,
    2. NSString
    )?,
  6. bool tokenField_writeRepresentedObjects_toPasteboard_(
    1. NSTokenField,
    2. NSArray,
    3. NSPasteboard
    )?,
  7. NSArray? tokenField_readFromPasteboard_(
    1. NSTokenField,
    2. NSPasteboard
    )?,
  8. NSMenu? tokenField_menuForRepresentedObject_(
    1. NSTokenField,
    2. ObjCObjectBase
    )?,
  9. bool tokenField_hasMenuForRepresentedObject_(
    1. NSTokenField,
    2. ObjCObjectBase
    )?,
  10. NSTokenStyle tokenField_styleForRepresentedObject_(
    1. NSTokenField,
    2. ObjCObjectBase
    )?,
  11. NSArray? textField_textView_candidatesForSelectedRange_(
    1. NSTextField,
    2. NSTextView,
    3. NSRange
    )?,
  12. NSArray textField_textView_candidates_forSelectedRange_(
    1. NSTextField,
    2. NSTextView,
    3. NSArray,
    4. NSRange,
    )?,
  13. bool textField_textView_shouldSelectCandidateAtIndex_(
    1. NSTextField,
    2. NSTextView,
    3. DartNSUInteger
    )?,
  14. void controlTextDidBeginEditing_(
    1. NSNotification
    )?,
  15. void controlTextDidEndEditing_(
    1. NSNotification
    )?,
  16. void controlTextDidChange_(
    1. NSNotification
    )?,
  17. bool control_textShouldBeginEditing_(
    1. NSControl,
    2. NSText
    )?,
  18. bool control_textShouldEndEditing_(
    1. NSControl,
    2. NSText
    )?,
  19. bool control_didFailToFormatString_errorDescription_(
    1. NSControl,
    2. NSString,
    3. NSString?
    )?,
  20. void control_didFailToValidatePartialString_errorDescription_(
    1. NSControl,
    2. NSString,
    3. NSString?
    )?,
  21. bool control_isValidObject_(
    1. NSControl,
    2. ObjCObjectBase?
    )?,
  22. bool control_textView_doCommandBySelector_(
    1. NSControl,
    2. NSTextView,
    3. Pointer<ObjCSelector>
    )?,
  23. NSArray control_textView_completions_forPartialWordRange_indexOfSelectedItem_(
    1. NSControl,
    2. NSTextView,
    3. NSArray,
    4. NSRange,
    5. Pointer<NSInteger>,
    )?,
  24. bool $keepIsolateAlive = true,
})
override

Builds an object that implements the NSTokenFieldDelegate protocol. To implement multiple protocols, use addToBuilder or objc.ObjCProtocolBuilder directly.

If $keepIsolateAlive is true, this protocol will keep this isolate alive until it is garbage collected by both Dart and ObjC.

Implementation

static NSTokenFieldDelegate implement({
  objc.NSArray? Function(
    NSTokenField,
    objc.NSString,
    DartNSInteger,
    ffi.Pointer<NSInteger>,
  )?
  tokenField_completionsForSubstring_indexOfToken_indexOfSelectedItem_,
  objc.NSArray Function(NSTokenField, objc.NSArray, DartNSUInteger)?
  tokenField_shouldAddObjects_atIndex_,
  objc.NSString? Function(NSTokenField, objc.ObjCObjectBase)?
  tokenField_displayStringForRepresentedObject_,
  objc.NSString? Function(NSTokenField, objc.ObjCObjectBase)?
  tokenField_editingStringForRepresentedObject_,
  objc.ObjCObjectBase? Function(NSTokenField, objc.NSString)?
  tokenField_representedObjectForEditingString_,
  bool Function(NSTokenField, objc.NSArray, NSPasteboard)?
  tokenField_writeRepresentedObjects_toPasteboard_,
  objc.NSArray? Function(NSTokenField, NSPasteboard)?
  tokenField_readFromPasteboard_,
  NSMenu? Function(NSTokenField, objc.ObjCObjectBase)?
  tokenField_menuForRepresentedObject_,
  bool Function(NSTokenField, objc.ObjCObjectBase)?
  tokenField_hasMenuForRepresentedObject_,
  NSTokenStyle Function(NSTokenField, objc.ObjCObjectBase)?
  tokenField_styleForRepresentedObject_,
  objc.NSArray? Function(NSTextField, NSTextView, NSRange)?
  textField_textView_candidatesForSelectedRange_,
  objc.NSArray Function(NSTextField, NSTextView, objc.NSArray, NSRange)?
  textField_textView_candidates_forSelectedRange_,
  bool Function(NSTextField, NSTextView, DartNSUInteger)?
  textField_textView_shouldSelectCandidateAtIndex_,
  void Function(objc.NSNotification)? controlTextDidBeginEditing_,
  void Function(objc.NSNotification)? controlTextDidEndEditing_,
  void Function(objc.NSNotification)? controlTextDidChange_,
  bool Function(NSControl, NSText)? control_textShouldBeginEditing_,
  bool Function(NSControl, NSText)? control_textShouldEndEditing_,
  bool Function(NSControl, objc.NSString, objc.NSString?)?
  control_didFailToFormatString_errorDescription_,
  void Function(NSControl, objc.NSString, objc.NSString?)?
  control_didFailToValidatePartialString_errorDescription_,
  bool Function(NSControl, objc.ObjCObjectBase?)? control_isValidObject_,
  bool Function(NSControl, NSTextView, ffi.Pointer<objc.ObjCSelector>)?
  control_textView_doCommandBySelector_,
  objc.NSArray Function(
    NSControl,
    NSTextView,
    objc.NSArray,
    NSRange,
    ffi.Pointer<NSInteger>,
  )?
  control_textView_completions_forPartialWordRange_indexOfSelectedItem_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSTokenFieldDelegate');
  NSTokenFieldDelegate
      .tokenField_completionsForSubstring_indexOfToken_indexOfSelectedItem_
      .implement(
        builder,
        tokenField_completionsForSubstring_indexOfToken_indexOfSelectedItem_,
      );
  NSTokenFieldDelegate.tokenField_shouldAddObjects_atIndex_.implement(
    builder,
    tokenField_shouldAddObjects_atIndex_,
  );
  NSTokenFieldDelegate.tokenField_displayStringForRepresentedObject_
      .implement(builder, tokenField_displayStringForRepresentedObject_);
  NSTokenFieldDelegate.tokenField_editingStringForRepresentedObject_
      .implement(builder, tokenField_editingStringForRepresentedObject_);
  NSTokenFieldDelegate.tokenField_representedObjectForEditingString_
      .implement(builder, tokenField_representedObjectForEditingString_);
  NSTokenFieldDelegate.tokenField_writeRepresentedObjects_toPasteboard_
      .implement(builder, tokenField_writeRepresentedObjects_toPasteboard_);
  NSTokenFieldDelegate.tokenField_readFromPasteboard_.implement(
    builder,
    tokenField_readFromPasteboard_,
  );
  NSTokenFieldDelegate.tokenField_menuForRepresentedObject_.implement(
    builder,
    tokenField_menuForRepresentedObject_,
  );
  NSTokenFieldDelegate.tokenField_hasMenuForRepresentedObject_.implement(
    builder,
    tokenField_hasMenuForRepresentedObject_,
  );
  NSTokenFieldDelegate.tokenField_styleForRepresentedObject_.implement(
    builder,
    tokenField_styleForRepresentedObject_,
  );
  NSTokenFieldDelegate.textField_textView_candidatesForSelectedRange_
      .implement(builder, textField_textView_candidatesForSelectedRange_);
  NSTokenFieldDelegate.textField_textView_candidates_forSelectedRange_
      .implement(builder, textField_textView_candidates_forSelectedRange_);
  NSTokenFieldDelegate.textField_textView_shouldSelectCandidateAtIndex_
      .implement(builder, textField_textView_shouldSelectCandidateAtIndex_);
  NSTokenFieldDelegate.controlTextDidBeginEditing_.implement(
    builder,
    controlTextDidBeginEditing_,
  );
  NSTokenFieldDelegate.controlTextDidEndEditing_.implement(
    builder,
    controlTextDidEndEditing_,
  );
  NSTokenFieldDelegate.controlTextDidChange_.implement(
    builder,
    controlTextDidChange_,
  );
  NSTokenFieldDelegate.control_textShouldBeginEditing_.implement(
    builder,
    control_textShouldBeginEditing_,
  );
  NSTokenFieldDelegate.control_textShouldEndEditing_.implement(
    builder,
    control_textShouldEndEditing_,
  );
  NSTokenFieldDelegate.control_didFailToFormatString_errorDescription_
      .implement(builder, control_didFailToFormatString_errorDescription_);
  NSTokenFieldDelegate
      .control_didFailToValidatePartialString_errorDescription_
      .implement(
        builder,
        control_didFailToValidatePartialString_errorDescription_,
      );
  NSTokenFieldDelegate.control_isValidObject_.implement(
    builder,
    control_isValidObject_,
  );
  NSTokenFieldDelegate.control_textView_doCommandBySelector_.implement(
    builder,
    control_textView_doCommandBySelector_,
  );
  NSTokenFieldDelegate
      .control_textView_completions_forPartialWordRange_indexOfSelectedItem_
      .implement(
        builder,
        control_textView_completions_forPartialWordRange_indexOfSelectedItem_,
      );
  builder.addProtocol($protocol);
  return NSTokenFieldDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}