implement static method

NSTokenFieldCellDelegate implement({
  1. NSArray tokenFieldCell_completionsForSubstring_indexOfToken_indexOfSelectedItem_(
    1. NSTokenFieldCell,
    2. NSString,
    3. DartNSInteger,
    4. Pointer<NSInteger>,
    )?,
  2. NSArray tokenFieldCell_shouldAddObjects_atIndex_(
    1. NSTokenFieldCell,
    2. NSArray,
    3. DartNSUInteger
    )?,
  3. NSString? tokenFieldCell_displayStringForRepresentedObject_(
    1. NSTokenFieldCell,
    2. ObjCObjectBase
    )?,
  4. NSString? tokenFieldCell_editingStringForRepresentedObject_(
    1. NSTokenFieldCell,
    2. ObjCObjectBase
    )?,
  5. ObjCObjectBase? tokenFieldCell_representedObjectForEditingString_(
    1. NSTokenFieldCell,
    2. NSString
    )?,
  6. bool tokenFieldCell_writeRepresentedObjects_toPasteboard_(
    1. NSTokenFieldCell,
    2. NSArray,
    3. NSPasteboard
    )?,
  7. NSArray? tokenFieldCell_readFromPasteboard_(
    1. NSTokenFieldCell,
    2. NSPasteboard
    )?,
  8. NSMenu? tokenFieldCell_menuForRepresentedObject_(
    1. NSTokenFieldCell,
    2. ObjCObjectBase
    )?,
  9. bool tokenFieldCell_hasMenuForRepresentedObject_(
    1. NSTokenFieldCell,
    2. ObjCObjectBase
    )?,
  10. NSTokenStyle tokenFieldCell_styleForRepresentedObject_(
    1. NSTokenFieldCell,
    2. ObjCObjectBase
    )?,
  11. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSTokenFieldCellDelegate 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 NSTokenFieldCellDelegate implement({
  objc.NSArray Function(
    NSTokenFieldCell,
    objc.NSString,
    DartNSInteger,
    ffi.Pointer<NSInteger>,
  )?
  tokenFieldCell_completionsForSubstring_indexOfToken_indexOfSelectedItem_,
  objc.NSArray Function(NSTokenFieldCell, objc.NSArray, DartNSUInteger)?
  tokenFieldCell_shouldAddObjects_atIndex_,
  objc.NSString? Function(NSTokenFieldCell, objc.ObjCObjectBase)?
  tokenFieldCell_displayStringForRepresentedObject_,
  objc.NSString? Function(NSTokenFieldCell, objc.ObjCObjectBase)?
  tokenFieldCell_editingStringForRepresentedObject_,
  objc.ObjCObjectBase? Function(NSTokenFieldCell, objc.NSString)?
  tokenFieldCell_representedObjectForEditingString_,
  bool Function(NSTokenFieldCell, objc.NSArray, NSPasteboard)?
  tokenFieldCell_writeRepresentedObjects_toPasteboard_,
  objc.NSArray? Function(NSTokenFieldCell, NSPasteboard)?
  tokenFieldCell_readFromPasteboard_,
  NSMenu? Function(NSTokenFieldCell, objc.ObjCObjectBase)?
  tokenFieldCell_menuForRepresentedObject_,
  bool Function(NSTokenFieldCell, objc.ObjCObjectBase)?
  tokenFieldCell_hasMenuForRepresentedObject_,
  NSTokenStyle Function(NSTokenFieldCell, objc.ObjCObjectBase)?
  tokenFieldCell_styleForRepresentedObject_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(
    debugName: 'NSTokenFieldCellDelegate',
  );
  NSTokenFieldCellDelegate
      .tokenFieldCell_completionsForSubstring_indexOfToken_indexOfSelectedItem_
      .implement(
        builder,
        tokenFieldCell_completionsForSubstring_indexOfToken_indexOfSelectedItem_,
      );
  NSTokenFieldCellDelegate.tokenFieldCell_shouldAddObjects_atIndex_.implement(
    builder,
    tokenFieldCell_shouldAddObjects_atIndex_,
  );
  NSTokenFieldCellDelegate.tokenFieldCell_displayStringForRepresentedObject_
      .implement(builder, tokenFieldCell_displayStringForRepresentedObject_);
  NSTokenFieldCellDelegate.tokenFieldCell_editingStringForRepresentedObject_
      .implement(builder, tokenFieldCell_editingStringForRepresentedObject_);
  NSTokenFieldCellDelegate.tokenFieldCell_representedObjectForEditingString_
      .implement(builder, tokenFieldCell_representedObjectForEditingString_);
  NSTokenFieldCellDelegate
      .tokenFieldCell_writeRepresentedObjects_toPasteboard_
      .implement(
        builder,
        tokenFieldCell_writeRepresentedObjects_toPasteboard_,
      );
  NSTokenFieldCellDelegate.tokenFieldCell_readFromPasteboard_.implement(
    builder,
    tokenFieldCell_readFromPasteboard_,
  );
  NSTokenFieldCellDelegate.tokenFieldCell_menuForRepresentedObject_.implement(
    builder,
    tokenFieldCell_menuForRepresentedObject_,
  );
  NSTokenFieldCellDelegate.tokenFieldCell_hasMenuForRepresentedObject_
      .implement(builder, tokenFieldCell_hasMenuForRepresentedObject_);
  NSTokenFieldCellDelegate.tokenFieldCell_styleForRepresentedObject_
      .implement(builder, tokenFieldCell_styleForRepresentedObject_);
  builder.addProtocol($protocol);
  return NSTokenFieldCellDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}