Trait NSSharingServicePickerDelegate

Source
pub unsafe trait NSSharingServicePickerDelegate: NSObjectProtocol {
    // Provided methods
    unsafe fn sharingServicePicker_sharingServicesForItems_proposedSharingServices(
        &self,
        sharing_service_picker: &NSSharingServicePicker,
        items: &NSArray,
        proposed_services: &NSArray<NSSharingService>,
    ) -> Retained<NSArray<NSSharingService>>
       where Self: Sized + Message { ... }
    unsafe fn sharingServicePicker_delegateForSharingService(
        &self,
        sharing_service_picker: &NSSharingServicePicker,
        sharing_service: &NSSharingService,
        mtm: MainThreadMarker,
    ) -> Option<Retained<ProtocolObject<dyn NSSharingServiceDelegate>>>
       where Self: Sized + Message { ... }
    unsafe fn sharingServicePicker_didChooseSharingService(
        &self,
        sharing_service_picker: &NSSharingServicePicker,
        service: Option<&NSSharingService>,
    )
       where Self: Sized + Message { ... }
    unsafe fn sharingServicePickerCollaborationModeRestrictions(
        &self,
        sharing_service_picker: &NSSharingServicePicker,
    ) -> Option<Retained<NSArray<NSSharingCollaborationModeRestriction>>>
       where Self: Sized + Message { ... }
}
Available on crate feature NSSharingService only.
Expand description

Provided Methods§

Source

unsafe fn sharingServicePicker_sharingServicesForItems_proposedSharingServices( &self, sharing_service_picker: &NSSharingServicePicker, items: &NSArray, proposed_services: &NSArray<NSSharingService>, ) -> Retained<NSArray<NSSharingService>>
where Self: Sized + Message,

Allows the delegate to customize exactly what appears in the sharing service picker by reordering or removing the services before the picker is presented. It’s possible to add custom services by mutating the proposedSharingServices array and adding new NSSharingService instances:

NSMutableArray *sharingServices = [proposedServices mutableCopy];
NSSharingService * customService = [[NSSharingService alloc] initWithTitle:
"
Service Title"
image:image alternateImage:alternateImage
handler:^{ [self doCustomServiceWithItems:items]; } ];
[sharingServices addObject:customService];
return [sharingServices autorelease];

The items represent the objects to be shared and must conform to the <NSPasteboardWriting

protocol or be an NSItemProvider or an NSDocument. (e.g. NSString, NSImage, NSURL, etc.)

Source

unsafe fn sharingServicePicker_delegateForSharingService( &self, sharing_service_picker: &NSSharingServicePicker, sharing_service: &NSSharingService, mtm: MainThreadMarker, ) -> Option<Retained<ProtocolObject<dyn NSSharingServiceDelegate>>>
where Self: Sized + Message,

Sent when the user has selected a service and the picker is about to execute it.

Source

unsafe fn sharingServicePicker_didChooseSharingService( &self, sharing_service_picker: &NSSharingServicePicker, service: Option<&NSSharingService>, )
where Self: Sized + Message,

Sent when the user has selected a service and before it is executed. Service will be nil if the picker was dismissed.

Source

unsafe fn sharingServicePickerCollaborationModeRestrictions( &self, sharing_service_picker: &NSSharingServicePicker, ) -> Option<Retained<NSArray<NSSharingCollaborationModeRestriction>>>
where Self: Sized + Message,

Available on crate feature NSSharingCollaborationModeRestriction only.

Used to specify the case where the share picker should not support some modes of sharing even if they are supported by the items being shared. Disabling all possible modes at the same time is not supported behavior.

Trait Implementations§

Source§

impl ProtocolType for dyn NSSharingServicePickerDelegate

Source§

const NAME: &'static str = "NSSharingServicePickerDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn NSSharingServicePickerDelegate

Implementations on Foreign Types§

Source§

impl<T> NSSharingServicePickerDelegate for ProtocolObject<T>

Implementors§