addToBuilderAsBlocking static method

void addToBuilderAsBlocking(
  1. ObjCProtocolBuilder builder, {
  2. required void insertText_replacementRange_(
    1. ObjCObjectBase,
    2. NSRange
    ),
  3. required void doCommandBySelector_(
    1. Pointer<ObjCSelector> aSelector
    ),
  4. required void setMarkedText_selectedRange_replacementRange_(
    1. ObjCObjectBase,
    2. NSRange,
    3. NSRange
    ),
  5. required void unmarkText(),
  6. required NSRange selectedRange(),
  7. required NSRange markedRange(),
  8. required bool hasMarkedText(),
  9. required NSAttributedString? attributedSubstringForProposedRange_actualRange_(
    1. NSRange,
    2. NSRangePointer
    ),
  10. required NSArray validAttributesForMarkedText(),
  11. required NSRect firstRectForCharacterRange_actualRange_(
    1. NSRange,
    2. NSRangePointer
    ),
  12. required DartNSInteger characterIndexForPoint_(
    1. NSPoint point
    ),
  13. NSAttributedString attributedString()?,
  14. DartCGFloat fractionOfDistanceThroughGlyphForPoint_(
    1. NSPoint
    )?,
  15. DartCGFloat baselineDeltaForCharacterAtIndex_(
    1. DartNSUInteger
    )?,
  16. DartNSInteger windowLevel()?,
  17. bool drawsVerticallyForCharacterAtIndex_(
    1. DartNSUInteger
    )?,
  18. NSTextCursorAccessoryPlacement preferredTextAccessoryPlacement()?,
  19. NSRect unionRectInVisibleSelectedRange()?,
  20. NSRect documentVisibleRect()?,
  21. bool supportsAdaptiveImageGlyph()?,
  22. void insertAdaptiveImageGlyph_replacementRange_(
    1. NSAdaptiveImageGlyph,
    2. NSRange
    )?,
  23. bool $keepIsolateAlive = true,
})

Adds the implementation of the NSTextInputClient protocol to an existing objc.ObjCProtocolBuilder. All methods that can be implemented as blocking listeners will be.

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

Implementation

static void addToBuilderAsBlocking(
  objc.ObjCProtocolBuilder builder, {
  required void Function(objc.ObjCObjectBase, NSRange)
  insertText_replacementRange_,
  required void Function(ffi.Pointer<objc.ObjCSelector>) doCommandBySelector_,
  required void Function(objc.ObjCObjectBase, NSRange, NSRange)
  setMarkedText_selectedRange_replacementRange_,
  required void Function() unmarkText,
  required NSRange Function() selectedRange,
  required NSRange Function() markedRange,
  required bool Function() hasMarkedText,
  required NSAttributedString? Function(NSRange, NSRangePointer)
  attributedSubstringForProposedRange_actualRange_,
  required objc.NSArray Function() validAttributesForMarkedText,
  required NSRect Function(NSRange, NSRangePointer)
  firstRectForCharacterRange_actualRange_,
  required DartNSUInteger Function(NSPoint) characterIndexForPoint_,
  NSAttributedString Function()? attributedString,
  DartCGFloat Function(NSPoint)? fractionOfDistanceThroughGlyphForPoint_,
  DartCGFloat Function(DartNSUInteger)? baselineDeltaForCharacterAtIndex_,
  DartNSInteger Function()? windowLevel,
  bool Function(DartNSUInteger)? drawsVerticallyForCharacterAtIndex_,
  NSTextCursorAccessoryPlacement Function()? preferredTextAccessoryPlacement,
  NSRect Function()? unionRectInVisibleSelectedRange,
  NSRect Function()? documentVisibleRect,
  bool Function()? supportsAdaptiveImageGlyph,
  void Function(NSAdaptiveImageGlyph, NSRange)?
  insertAdaptiveImageGlyph_replacementRange_,
  bool $keepIsolateAlive = true,
}) {
  NSTextInputClient.insertText_replacementRange_.implementAsBlocking(
    builder,
    insertText_replacementRange_,
  );
  NSTextInputClient.doCommandBySelector_.implementAsBlocking(
    builder,
    doCommandBySelector_,
  );
  NSTextInputClient.setMarkedText_selectedRange_replacementRange_
      .implementAsBlocking(
        builder,
        setMarkedText_selectedRange_replacementRange_,
      );
  NSTextInputClient.unmarkText.implementAsBlocking(builder, unmarkText);
  NSTextInputClient.selectedRange.implement(builder, selectedRange);
  NSTextInputClient.markedRange.implement(builder, markedRange);
  NSTextInputClient.hasMarkedText.implement(builder, hasMarkedText);
  NSTextInputClient.attributedSubstringForProposedRange_actualRange_
      .implement(builder, attributedSubstringForProposedRange_actualRange_);
  NSTextInputClient.validAttributesForMarkedText.implement(
    builder,
    validAttributesForMarkedText,
  );
  NSTextInputClient.firstRectForCharacterRange_actualRange_.implement(
    builder,
    firstRectForCharacterRange_actualRange_,
  );
  NSTextInputClient.characterIndexForPoint_.implement(
    builder,
    characterIndexForPoint_,
  );
  NSTextInputClient.attributedString.implement(builder, attributedString);
  NSTextInputClient.fractionOfDistanceThroughGlyphForPoint_.implement(
    builder,
    fractionOfDistanceThroughGlyphForPoint_,
  );
  NSTextInputClient.baselineDeltaForCharacterAtIndex_.implement(
    builder,
    baselineDeltaForCharacterAtIndex_,
  );
  NSTextInputClient.windowLevel.implement(builder, windowLevel);
  NSTextInputClient.drawsVerticallyForCharacterAtIndex_.implement(
    builder,
    drawsVerticallyForCharacterAtIndex_,
  );
  NSTextInputClient.preferredTextAccessoryPlacement.implement(
    builder,
    preferredTextAccessoryPlacement,
  );
  NSTextInputClient.unionRectInVisibleSelectedRange.implement(
    builder,
    unionRectInVisibleSelectedRange,
  );
  NSTextInputClient.documentVisibleRect.implement(
    builder,
    documentVisibleRect,
  );
  NSTextInputClient.supportsAdaptiveImageGlyph.implement(
    builder,
    supportsAdaptiveImageGlyph,
  );
  NSTextInputClient.insertAdaptiveImageGlyph_replacementRange_
      .implementAsBlocking(
        builder,
        insertAdaptiveImageGlyph_replacementRange_,
      );
  builder.addProtocol($protocol);
}