implementAsBlocking static method

NSLayoutManagerDelegate implementAsBlocking({
  1. DartNSUInteger layoutManager_shouldGenerateGlyphs_properties_characterIndexes_font_forGlyphRange_(
    1. NSLayoutManager,
    2. Pointer<CGGlyph>,
    3. Pointer<NSInteger>,
    4. Pointer<NSUInteger>,
    5. NSFont,
    6. NSRange,
    )?,
  2. DartCGFloat layoutManager_lineSpacingAfterGlyphAtIndex_withProposedLineFragmentRect_(
    1. NSLayoutManager,
    2. DartNSUInteger,
    3. NSRect
    )?,
  3. DartCGFloat layoutManager_paragraphSpacingBeforeGlyphAtIndex_withProposedLineFragmentRect_(
    1. NSLayoutManager,
    2. DartNSUInteger,
    3. NSRect
    )?,
  4. DartCGFloat layoutManager_paragraphSpacingAfterGlyphAtIndex_withProposedLineFragmentRect_(
    1. NSLayoutManager,
    2. DartNSUInteger,
    3. NSRect
    )?,
  5. NSControlCharacterAction layoutManager_shouldUseAction_forControlCharacterAtIndex_(
    1. NSLayoutManager,
    2. NSControlCharacterAction,
    3. DartNSUInteger
    )?,
  6. bool layoutManager_shouldBreakLineByWordBeforeCharacterAtIndex_(
    1. NSLayoutManager,
    2. DartNSUInteger
    )?,
  7. bool layoutManager_shouldBreakLineByHyphenatingBeforeCharacterAtIndex_(
    1. NSLayoutManager,
    2. DartNSUInteger
    )?,
  8. NSRect layoutManager_boundingBoxForControlGlyphAtIndex_forTextContainer_proposedLineFragment_glyphPosition_characterIndex_(
    1. NSLayoutManager,
    2. DartNSUInteger,
    3. NSTextContainer,
    4. NSRect,
    5. NSPoint,
    6. DartNSUInteger,
    )?,
  9. bool layoutManager_shouldSetLineFragmentRect_lineFragmentUsedRect_baselineOffset_inTextContainer_forGlyphRange_(
    1. NSLayoutManager,
    2. Pointer<NSRect>,
    3. Pointer<NSRect>,
    4. Pointer<CGFloat>,
    5. NSTextContainer,
    6. NSRange,
    )?,
  10. void layoutManagerDidInvalidateLayout_(
    1. NSLayoutManager
    )?,
  11. void layoutManager_didCompleteLayoutForTextContainer_atEnd_(
    1. NSLayoutManager,
    2. NSTextContainer?,
    3. bool
    )?,
  12. void layoutManager_textContainer_didChangeGeometryFromSize_(
    1. NSLayoutManager,
    2. NSTextContainer,
    3. NSSize
    )?,
  13. NSDictionary? layoutManager_shouldUseTemporaryAttributes_forDrawingToScreen_atCharacterIndex_effectiveRange_(
    1. NSLayoutManager,
    2. NSDictionary,
    3. bool,
    4. DartNSUInteger,
    5. NSRangePointer,
    )?,
  14. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSLayoutManagerDelegate 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 NSLayoutManagerDelegate implementAsBlocking({
  DartNSUInteger Function(
    NSLayoutManager,
    ffi.Pointer<CGGlyph>,
    ffi.Pointer<NSInteger>,
    ffi.Pointer<NSUInteger>,
    NSFont,
    NSRange,
  )?
  layoutManager_shouldGenerateGlyphs_properties_characterIndexes_font_forGlyphRange_,
  DartCGFloat Function(NSLayoutManager, DartNSUInteger, NSRect)?
  layoutManager_lineSpacingAfterGlyphAtIndex_withProposedLineFragmentRect_,
  DartCGFloat Function(NSLayoutManager, DartNSUInteger, NSRect)?
  layoutManager_paragraphSpacingBeforeGlyphAtIndex_withProposedLineFragmentRect_,
  DartCGFloat Function(NSLayoutManager, DartNSUInteger, NSRect)?
  layoutManager_paragraphSpacingAfterGlyphAtIndex_withProposedLineFragmentRect_,
  NSControlCharacterAction Function(
    NSLayoutManager,
    NSControlCharacterAction,
    DartNSUInteger,
  )?
  layoutManager_shouldUseAction_forControlCharacterAtIndex_,
  bool Function(NSLayoutManager, DartNSUInteger)?
  layoutManager_shouldBreakLineByWordBeforeCharacterAtIndex_,
  bool Function(NSLayoutManager, DartNSUInteger)?
  layoutManager_shouldBreakLineByHyphenatingBeforeCharacterAtIndex_,
  NSRect Function(
    NSLayoutManager,
    DartNSUInteger,
    NSTextContainer,
    NSRect,
    NSPoint,
    DartNSUInteger,
  )?
  layoutManager_boundingBoxForControlGlyphAtIndex_forTextContainer_proposedLineFragment_glyphPosition_characterIndex_,
  bool Function(
    NSLayoutManager,
    ffi.Pointer<NSRect>,
    ffi.Pointer<NSRect>,
    ffi.Pointer<CGFloat>,
    NSTextContainer,
    NSRange,
  )?
  layoutManager_shouldSetLineFragmentRect_lineFragmentUsedRect_baselineOffset_inTextContainer_forGlyphRange_,
  void Function(NSLayoutManager)? layoutManagerDidInvalidateLayout_,
  void Function(NSLayoutManager, NSTextContainer?, bool)?
  layoutManager_didCompleteLayoutForTextContainer_atEnd_,
  void Function(NSLayoutManager, NSTextContainer, NSSize)?
  layoutManager_textContainer_didChangeGeometryFromSize_,
  objc.NSDictionary? Function(
    NSLayoutManager,
    objc.NSDictionary,
    bool,
    DartNSUInteger,
    NSRangePointer,
  )?
  layoutManager_shouldUseTemporaryAttributes_forDrawingToScreen_atCharacterIndex_effectiveRange_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(
    debugName: 'NSLayoutManagerDelegate',
  );
  NSLayoutManagerDelegate
      .layoutManager_shouldGenerateGlyphs_properties_characterIndexes_font_forGlyphRange_
      .implement(
        builder,
        layoutManager_shouldGenerateGlyphs_properties_characterIndexes_font_forGlyphRange_,
      );
  NSLayoutManagerDelegate
      .layoutManager_lineSpacingAfterGlyphAtIndex_withProposedLineFragmentRect_
      .implement(
        builder,
        layoutManager_lineSpacingAfterGlyphAtIndex_withProposedLineFragmentRect_,
      );
  NSLayoutManagerDelegate
      .layoutManager_paragraphSpacingBeforeGlyphAtIndex_withProposedLineFragmentRect_
      .implement(
        builder,
        layoutManager_paragraphSpacingBeforeGlyphAtIndex_withProposedLineFragmentRect_,
      );
  NSLayoutManagerDelegate
      .layoutManager_paragraphSpacingAfterGlyphAtIndex_withProposedLineFragmentRect_
      .implement(
        builder,
        layoutManager_paragraphSpacingAfterGlyphAtIndex_withProposedLineFragmentRect_,
      );
  NSLayoutManagerDelegate
      .layoutManager_shouldUseAction_forControlCharacterAtIndex_
      .implement(
        builder,
        layoutManager_shouldUseAction_forControlCharacterAtIndex_,
      );
  NSLayoutManagerDelegate
      .layoutManager_shouldBreakLineByWordBeforeCharacterAtIndex_
      .implement(
        builder,
        layoutManager_shouldBreakLineByWordBeforeCharacterAtIndex_,
      );
  NSLayoutManagerDelegate
      .layoutManager_shouldBreakLineByHyphenatingBeforeCharacterAtIndex_
      .implement(
        builder,
        layoutManager_shouldBreakLineByHyphenatingBeforeCharacterAtIndex_,
      );
  NSLayoutManagerDelegate
      .layoutManager_boundingBoxForControlGlyphAtIndex_forTextContainer_proposedLineFragment_glyphPosition_characterIndex_
      .implement(
        builder,
        layoutManager_boundingBoxForControlGlyphAtIndex_forTextContainer_proposedLineFragment_glyphPosition_characterIndex_,
      );
  NSLayoutManagerDelegate
      .layoutManager_shouldSetLineFragmentRect_lineFragmentUsedRect_baselineOffset_inTextContainer_forGlyphRange_
      .implement(
        builder,
        layoutManager_shouldSetLineFragmentRect_lineFragmentUsedRect_baselineOffset_inTextContainer_forGlyphRange_,
      );
  NSLayoutManagerDelegate.layoutManagerDidInvalidateLayout_
      .implementAsBlocking(builder, layoutManagerDidInvalidateLayout_);
  NSLayoutManagerDelegate
      .layoutManager_didCompleteLayoutForTextContainer_atEnd_
      .implementAsBlocking(
        builder,
        layoutManager_didCompleteLayoutForTextContainer_atEnd_,
      );
  NSLayoutManagerDelegate
      .layoutManager_textContainer_didChangeGeometryFromSize_
      .implementAsBlocking(
        builder,
        layoutManager_textContainer_didChangeGeometryFromSize_,
      );
  NSLayoutManagerDelegate
      .layoutManager_shouldUseTemporaryAttributes_forDrawingToScreen_atCharacterIndex_effectiveRange_
      .implement(
        builder,
        layoutManager_shouldUseTemporaryAttributes_forDrawingToScreen_atCharacterIndex_effectiveRange_,
      );
  builder.addProtocol($protocol);
  return NSLayoutManagerDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}