implementAsBlocking static method

NSPopoverDelegate implementAsBlocking({
  1. bool popoverShouldClose_(
    1. NSPopover
    )?,
  2. bool popoverShouldDetach_(
    1. NSPopover
    )?,
  3. void popoverDidDetach_(
    1. NSPopover
    )?,
  4. NSWindow? detachableWindowForPopover_(
    1. NSPopover
    )?,
  5. void popoverWillShow_(
    1. NSNotification
    )?,
  6. void popoverDidShow_(
    1. NSNotification
    )?,
  7. void popoverWillClose_(
    1. NSNotification
    )?,
  8. void popoverDidClose_(
    1. NSNotification
    )?,
  9. bool $keepIsolateAlive = true,
})

Builds an object that implements the NSPopoverDelegate 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 NSPopoverDelegate implementAsBlocking({
  bool Function(NSPopover)? popoverShouldClose_,
  bool Function(NSPopover)? popoverShouldDetach_,
  void Function(NSPopover)? popoverDidDetach_,
  NSWindow? Function(NSPopover)? detachableWindowForPopover_,
  void Function(objc.NSNotification)? popoverWillShow_,
  void Function(objc.NSNotification)? popoverDidShow_,
  void Function(objc.NSNotification)? popoverWillClose_,
  void Function(objc.NSNotification)? popoverDidClose_,
  bool $keepIsolateAlive = true,
}) {
  final builder = objc.ObjCProtocolBuilder(debugName: 'NSPopoverDelegate');
  NSPopoverDelegate.popoverShouldClose_.implement(
    builder,
    popoverShouldClose_,
  );
  NSPopoverDelegate.popoverShouldDetach_.implement(
    builder,
    popoverShouldDetach_,
  );
  NSPopoverDelegate.popoverDidDetach_.implementAsBlocking(
    builder,
    popoverDidDetach_,
  );
  NSPopoverDelegate.detachableWindowForPopover_.implement(
    builder,
    detachableWindowForPopover_,
  );
  NSPopoverDelegate.popoverWillShow_.implementAsBlocking(
    builder,
    popoverWillShow_,
  );
  NSPopoverDelegate.popoverDidShow_.implementAsBlocking(
    builder,
    popoverDidShow_,
  );
  NSPopoverDelegate.popoverWillClose_.implementAsBlocking(
    builder,
    popoverWillClose_,
  );
  NSPopoverDelegate.popoverDidClose_.implementAsBlocking(
    builder,
    popoverDidClose_,
  );
  builder.addProtocol($protocol);
  return NSPopoverDelegate.castFrom(
    builder.build(keepIsolateAlive: $keepIsolateAlive),
  );
}