objc2-photos 0.3.2

Bindings to the Photos/PhotoKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/photos/phlivephotorequestid?language=objc)
pub type PHLivePhotoRequestID = i32;

/// [Apple's documentation](https://developer.apple.com/documentation/photos/phlivephotorequestidinvalid?language=objc)
pub static PHLivePhotoRequestIDInvalid: PHLivePhotoRequestID = 0;

extern "C" {
    /// These keys may be found in the info dictionary delivered to a live photo request result handler block.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/photos/phlivephotoinfoerrorkey?language=objc)
    pub static PHLivePhotoInfoErrorKey: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phlivephotoinfoisdegradedkey?language=objc)
    pub static PHLivePhotoInfoIsDegradedKey: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phlivephotoinfocancelledkey?language=objc)
    pub static PHLivePhotoInfoCancelledKey: &'static NSString;
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/photos/phlivephoto?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct PHLivePhoto;
);

unsafe impl Send for PHLivePhoto {}

unsafe impl Sync for PHLivePhoto {}

extern_conformance!(
    unsafe impl NSCoding for PHLivePhoto {}
);

extern_conformance!(
    unsafe impl NSCopying for PHLivePhoto {}
);

unsafe impl CopyingHelper for PHLivePhoto {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for PHLivePhoto {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for PHLivePhoto {}
);

impl PHLivePhoto {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        /// The dimensions of the live photo measured in pixels.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(size))]
        #[unsafe(method_family = none)]
        pub unsafe fn size(&self) -> CGSize;

        #[cfg(all(
            feature = "PhotosTypes",
            feature = "block2",
            feature = "objc2-app-kit",
            feature = "objc2-core-foundation"
        ))]
        #[cfg(target_os = "macos")]
        #[unsafe(method(requestLivePhotoWithResourceFileURLs:placeholderImage:targetSize:contentMode:resultHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestLivePhotoWithResourceFileURLs_placeholderImage_targetSize_contentMode_resultHandler(
            file_ur_ls: &NSArray<NSURL>,
            image: Option<&NSImage>,
            target_size: CGSize,
            content_mode: PHImageContentMode,
            result_handler: &block2::DynBlock<dyn Fn(*mut PHLivePhoto, NonNull<NSDictionary>)>,
        ) -> PHLivePhotoRequestID;

        /// Cancels the loading of a PHLivePhoto. The request's completion handler will be called.
        #[unsafe(method(cancelLivePhotoRequestWithRequestID:))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancelLivePhotoRequestWithRequestID(request_id: PHLivePhotoRequestID);
    );
}

/// Methods declared on superclass `NSObject`.
impl PHLivePhoto {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// NSItemProvider.
impl PHLivePhoto {
    extern_methods!();
}

extern_conformance!(
    unsafe impl NSItemProviderReading for PHLivePhoto {}
);