implementAsBlocking static method

NSTextAttachmentCell implementAsBlocking({
  1. required void drawWithFrame_inView_(
    1. NSRect,
    2. NSView?
    ),
  2. required bool wantsToTrackMouse(),
  3. required void highlight_withFrame_inView_(
    1. bool,
    2. NSRect,
    3. NSView?
    ),
  4. required bool trackMouse_inRect_ofView_untilMouseUp_(
    1. NSEvent,
    2. NSRect,
    3. NSView?,
    4. bool,
    ),
  5. required CGSize cellSize(),
  6. required CGPoint cellBaselineOffset(),
  7. required NSTextAttachment? attachment(),
  8. required void setAttachment_(
    1. NSTextAttachment?
    ),
  9. required void drawWithFrame_inView_characterIndex_(
    1. NSRect,
    2. NSView?,
    3. DartNSUInteger
    ),
  10. required void drawWithFrame_inView_characterIndex_layoutManager_(
    1. NSRect,
    2. NSView?,
    3. DartNSUInteger,
    4. NSLayoutManager,
    ),
  11. required bool wantsToTrackMouseForEvent_inRect_ofView_atCharacterIndex_(
    1. NSEvent,
    2. NSRect,
    3. NSView?,
    4. DartNSUInteger,
    ),
  12. required bool trackMouse_inRect_ofView_atCharacterIndex_untilMouseUp_(
    1. NSEvent,
    2. NSRect,
    3. NSView?,
    4. DartNSUInteger,
    5. bool,
    ),
  13. required NSRect cellFrameForTextContainer_proposedLineFragment_glyphPosition_characterIndex_(
    1. NSTextContainer,
    2. NSRect,
    3. NSPoint,
    4. DartNSUInteger,
    ),
  14. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSTextAttachmentCell protocol. To implement multiple protocols, use addToBuilder or objc.ObjCProtocolBuilder directly. All methods that can be implemented as blocking listeners will be.

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

Implementation

static NSTextAttachmentCell implementAsBlocking({
  required void Function(NSRect, NSView?) drawWithFrame_inView_,
  required bool Function() wantsToTrackMouse,
  required void Function(bool, NSRect, NSView?) highlight_withFrame_inView_,
  required bool Function(NSEvent, NSRect, NSView?, bool)
  trackMouse_inRect_ofView_untilMouseUp_,
  required NSSize Function() cellSize,
  required NSPoint Function() cellBaselineOffset,
  required NSTextAttachment? Function() attachment,
  required void Function(NSTextAttachment?) setAttachment_,
  required void Function(NSRect, NSView?, DartNSUInteger)
  drawWithFrame_inView_characterIndex_,
  required void Function(NSRect, NSView?, DartNSUInteger, NSLayoutManager)
  drawWithFrame_inView_characterIndex_layoutManager_,
  required bool Function(NSEvent, NSRect, NSView?, DartNSUInteger)
  wantsToTrackMouseForEvent_inRect_ofView_atCharacterIndex_,
  required bool Function(NSEvent, NSRect, NSView?, DartNSUInteger, bool)
  trackMouse_inRect_ofView_atCharacterIndex_untilMouseUp_,
  required NSRect Function(NSTextContainer, NSRect, NSPoint, DartNSUInteger)
  cellFrameForTextContainer_proposedLineFragment_glyphPosition_characterIndex_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSTextAttachmentCell');
  NSTextAttachmentCell.drawWithFrame_inView_.implementAsBlocking(
    builder,
    drawWithFrame_inView_,
  );
  NSTextAttachmentCell.wantsToTrackMouse.implement(
    builder,
    wantsToTrackMouse,
  );
  NSTextAttachmentCell.highlight_withFrame_inView_.implementAsBlocking(
    builder,
    highlight_withFrame_inView_,
  );
  NSTextAttachmentCell.trackMouse_inRect_ofView_untilMouseUp_.implement(
    builder,
    trackMouse_inRect_ofView_untilMouseUp_,
  );
  NSTextAttachmentCell.cellSize.implement(builder, cellSize);
  NSTextAttachmentCell.cellBaselineOffset.implement(
    builder,
    cellBaselineOffset,
  );
  NSTextAttachmentCell.attachment.implement(builder, attachment);
  NSTextAttachmentCell.setAttachment_.implementAsBlocking(
    builder,
    setAttachment_,
  );
  NSTextAttachmentCell.drawWithFrame_inView_characterIndex_
      .implementAsBlocking(builder, drawWithFrame_inView_characterIndex_);
  NSTextAttachmentCell.drawWithFrame_inView_characterIndex_layoutManager_
      .implementAsBlocking(
        builder,
        drawWithFrame_inView_characterIndex_layoutManager_,
      );
  NSTextAttachmentCell
      .wantsToTrackMouseForEvent_inRect_ofView_atCharacterIndex_
      .implement(
        builder,
        wantsToTrackMouseForEvent_inRect_ofView_atCharacterIndex_,
      );
  NSTextAttachmentCell.trackMouse_inRect_ofView_atCharacterIndex_untilMouseUp_
      .implement(
        builder,
        trackMouse_inRect_ofView_atCharacterIndex_untilMouseUp_,
      );
  NSTextAttachmentCell
      .cellFrameForTextContainer_proposedLineFragment_glyphPosition_characterIndex_
      .implement(
        builder,
        cellFrameForTextContainer_proposedLineFragment_glyphPosition_characterIndex_,
      );
  builder.addProtocol($protocol);
  return NSTextAttachmentCell.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}