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::*;
use objc2_foundation::*;

use crate::*;

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

#[cfg(feature = "PHChangeRequest")]
extern_conformance!(
    unsafe impl NSObjectProtocol for PHProjectChangeRequest {}
);

#[cfg(feature = "PHChangeRequest")]
impl PHProjectChangeRequest {
    extern_methods!(
        #[cfg(all(feature = "PHCollection", feature = "PHObject", feature = "PHProject"))]
        #[unsafe(method(initWithProject:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithProject(this: Allocated<Self>, project: &PHProject)
            -> Retained<Self>;

        #[unsafe(method(title))]
        #[unsafe(method_family = none)]
        pub unsafe fn title(&self) -> Retained<NSString>;

        /// Setter for [`title`][Self::title].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setTitle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTitle(&self, title: &NSString);

        /// The projectExtensionData property is intended for storage of compressed, project specific data
        /// only. Do not include things like rasterized images that can be locally cached in this data. The
        /// total size of stored data is limited to 5 MB. Attempting to store more data than allowed will result
        /// in an error.
        #[unsafe(method(projectExtensionData))]
        #[unsafe(method_family = none)]
        pub unsafe fn projectExtensionData(&self) -> Retained<NSData>;

        /// Setter for [`projectExtensionData`][Self::projectExtensionData].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setProjectExtensionData:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setProjectExtensionData(&self, project_extension_data: &NSData);

        #[cfg(all(feature = "PHAsset", feature = "PHObject"))]
        /// Sets the key asset representing the project.
        /// Deprecated in macOS 10.14, please use -[PHProjectChangeRequest setProjectPreviewImage:] to provide a rendered preview instead.
        #[deprecated]
        #[unsafe(method(setKeyAsset:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setKeyAsset(&self, key_asset: Option<&PHAsset>);

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        #[unsafe(method(setProjectPreviewImage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setProjectPreviewImage(&self, preview_image: &NSImage);

        /// Removes the specified assets from the project.
        ///
        /// Parameter `assets`: A collection of PHAsset objects to be removed from the project.
        ///
        /// # Safety
        ///
        /// `assets` should be of the correct type.
        #[unsafe(method(removeAssets:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeAssets(&self, assets: &ProtocolObject<dyn NSFastEnumeration>);
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "PHChangeRequest")]
impl PHProjectChangeRequest {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}