addToBuilder static method

void addToBuilder(
  1. ObjCProtocolBuilder builder, {
  2. required NSTextRange documentRange(),
  3. required void enumerateSubstringsFromLocation_options_usingBlock_(
    1. NSTextLocation,
    2. NSStringEnumerationOptions,
    3. ObjCBlock<Void Function(NSString?, NSTextRange, NSTextRange?, Pointer<Bool>)>
    ),
  4. required NSTextRange? textRangeForSelectionGranularity_enclosingLocation_(
    1. NSTextSelectionGranularity,
    2. NSTextLocation
    ),
  5. required NSTextLocation? locationFromLocation_withOffset_(
    1. NSTextLocation,
    2. DartNSInteger
    ),
  6. required DartNSInteger offsetFromLocation_toLocation_(
    1. NSTextLocation,
    2. NSTextLocation
    ),
  7. required NSTextSelectionNavigationWritingDirection baseWritingDirectionAtLocation_(
    1. NSTextLocation
    ),
  8. required void enumerateCaretOffsetsInLineFragmentAtLocation_usingBlock_(
    1. NSTextLocation,
    2. ObjCBlock<Void Function(Double, Pointer<ObjCObject>, Bool, Pointer<Bool>)>
    ),
  9. required NSTextRange? lineFragmentRangeForPoint_inContainerAtLocation_(
    1. CGPoint,
    2. NSTextLocation
    ),
  10. void enumerateContainerBoundariesFromLocation_reverse_usingBlock_(
    1. NSTextLocation,
    2. bool,
    3. ObjCBlock<Void Function(Pointer<ObjCObject>, Pointer<Bool>)>
    )?,
  11. NSTextSelectionNavigationLayoutOrientation textLayoutOrientationAtLocation_(
    1. NSTextLocation
    )?,
  12. bool $keepIsolateAlive = true,
})

Adds the implementation of the NSTextSelectionDataSource protocol to an existing objc.ObjCProtocolBuilder.

Note: You cannot call this method after you have called builder.build.

Implementation

static void addToBuilder(
  objc.ObjCProtocolBuilder builder, {
  required NSTextRange Function() documentRange,
  required void Function(
    NSTextLocation,
    objc.NSStringEnumerationOptions,
    objc.ObjCBlock<
      ffi.Void Function(
        objc.NSString?,
        NSTextRange,
        NSTextRange?,
        ffi.Pointer<ffi.Bool>,
      )
    >,
  )
  enumerateSubstringsFromLocation_options_usingBlock_,
  required NSTextRange? Function(NSTextSelectionGranularity, NSTextLocation)
  textRangeForSelectionGranularity_enclosingLocation_,
  required NSTextLocation? Function(NSTextLocation, DartNSInteger)
  locationFromLocation_withOffset_,
  required DartNSInteger Function(NSTextLocation, NSTextLocation)
  offsetFromLocation_toLocation_,
  required NSTextSelectionNavigationWritingDirection Function(NSTextLocation)
  baseWritingDirectionAtLocation_,
  required void Function(
    NSTextLocation,
    objc.ObjCBlock<
      ffi.Void Function(
        ffi.Double,
        ffi.Pointer<objc.ObjCObject>,
        ffi.Bool,
        ffi.Pointer<ffi.Bool>,
      )
    >,
  )
  enumerateCaretOffsetsInLineFragmentAtLocation_usingBlock_,
  required NSTextRange? Function(objc.CGPoint, NSTextLocation)
  lineFragmentRangeForPoint_inContainerAtLocation_,
  void Function(
    NSTextLocation,
    bool,
    objc.ObjCBlock<
      ffi.Void Function(ffi.Pointer<objc.ObjCObject>, ffi.Pointer<ffi.Bool>)
    >,
  )?
  enumerateContainerBoundariesFromLocation_reverse_usingBlock_,
  NSTextSelectionNavigationLayoutOrientation Function(NSTextLocation)?
  textLayoutOrientationAtLocation_,
  bool $keepIsolateAlive = true,
}) {
  NSTextSelectionDataSource.documentRange.implement(builder, documentRange);
  NSTextSelectionDataSource
      .enumerateSubstringsFromLocation_options_usingBlock_
      .implement(
        builder,
        enumerateSubstringsFromLocation_options_usingBlock_,
      );
  NSTextSelectionDataSource
      .textRangeForSelectionGranularity_enclosingLocation_
      .implement(
        builder,
        textRangeForSelectionGranularity_enclosingLocation_,
      );
  NSTextSelectionDataSource.locationFromLocation_withOffset_.implement(
    builder,
    locationFromLocation_withOffset_,
  );
  NSTextSelectionDataSource.offsetFromLocation_toLocation_.implement(
    builder,
    offsetFromLocation_toLocation_,
  );
  NSTextSelectionDataSource.baseWritingDirectionAtLocation_.implement(
    builder,
    baseWritingDirectionAtLocation_,
  );
  NSTextSelectionDataSource
      .enumerateCaretOffsetsInLineFragmentAtLocation_usingBlock_
      .implement(
        builder,
        enumerateCaretOffsetsInLineFragmentAtLocation_usingBlock_,
      );
  NSTextSelectionDataSource.lineFragmentRangeForPoint_inContainerAtLocation_
      .implement(builder, lineFragmentRangeForPoint_inContainerAtLocation_);
  NSTextSelectionDataSource
      .enumerateContainerBoundariesFromLocation_reverse_usingBlock_
      .implement(
        builder,
        enumerateContainerBoundariesFromLocation_reverse_usingBlock_,
      );
  NSTextSelectionDataSource.textLayoutOrientationAtLocation_.implement(
    builder,
    textLayoutOrientationAtLocation_,
  );
  builder.addProtocol($protocol);
}