implementAsBlocking static method

NSTextViewportLayoutControllerDelegate implementAsBlocking({
  1. required CGRect viewportBoundsForTextViewportLayoutController_(
    1. NSTextViewportLayoutController
    ),
  2. required void textViewportLayoutController_configureRenderingSurfaceForTextLayoutFragment_(
    1. NSTextViewportLayoutController,
    2. NSTextLayoutFragment
    ),
  3. void textViewportLayoutControllerWillLayout_(
    1. NSTextViewportLayoutController
    )?,
  4. void textViewportLayoutControllerDidLayout_(
    1. NSTextViewportLayoutController
    )?,
  5. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSTextViewportLayoutControllerDelegate 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 NSTextViewportLayoutControllerDelegate implementAsBlocking({
  required objc.CGRect Function(NSTextViewportLayoutController)
  viewportBoundsForTextViewportLayoutController_,
  required void Function(NSTextViewportLayoutController, NSTextLayoutFragment)
  textViewportLayoutController_configureRenderingSurfaceForTextLayoutFragment_,
  void Function(NSTextViewportLayoutController)?
  textViewportLayoutControllerWillLayout_,
  void Function(NSTextViewportLayoutController)?
  textViewportLayoutControllerDidLayout_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(
    debugName: 'NSTextViewportLayoutControllerDelegate',
  );
  NSTextViewportLayoutControllerDelegate
      .viewportBoundsForTextViewportLayoutController_
      .implement(builder, viewportBoundsForTextViewportLayoutController_);
  NSTextViewportLayoutControllerDelegate
      .textViewportLayoutController_configureRenderingSurfaceForTextLayoutFragment_
      .implementAsBlocking(
        builder,
        textViewportLayoutController_configureRenderingSurfaceForTextLayoutFragment_,
      );
  NSTextViewportLayoutControllerDelegate
      .textViewportLayoutControllerWillLayout_
      .implementAsBlocking(builder, textViewportLayoutControllerWillLayout_);
  NSTextViewportLayoutControllerDelegate
      .textViewportLayoutControllerDidLayout_
      .implementAsBlocking(builder, textViewportLayoutControllerDidLayout_);
  builder.addProtocol($protocol);
  return NSTextViewportLayoutControllerDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}