objc2-photos 0.2.0

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

use crate::*;

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "PHChangeRequest")]
    pub struct PHAssetChangeRequest;

    #[cfg(feature = "PHChangeRequest")]
    unsafe impl ClassType for PHAssetChangeRequest {
        #[inherits(NSObject)]
        type Super = PHChangeRequest;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "PHChangeRequest")]
unsafe impl NSObjectProtocol for PHAssetChangeRequest {}

extern_methods!(
    #[cfg(feature = "PHChangeRequest")]
    unsafe impl PHAssetChangeRequest {
        #[cfg(feature = "objc2-app-kit")]
        #[method_id(@__retain_semantics Other creationRequestForAssetFromImage:)]
        pub unsafe fn creationRequestForAssetFromImage(image: &NSImage) -> Id<Self>;

        #[method_id(@__retain_semantics Other creationRequestForAssetFromImageAtFileURL:)]
        pub unsafe fn creationRequestForAssetFromImageAtFileURL(
            file_url: &NSURL,
        ) -> Option<Id<Self>>;

        #[method_id(@__retain_semantics Other creationRequestForAssetFromVideoAtFileURL:)]
        pub unsafe fn creationRequestForAssetFromVideoAtFileURL(
            file_url: &NSURL,
        ) -> Option<Id<Self>>;

        #[cfg(feature = "PHObject")]
        #[method_id(@__retain_semantics Other placeholderForCreatedAsset)]
        pub unsafe fn placeholderForCreatedAsset(&self) -> Option<Id<PHObjectPlaceholder>>;

        #[method(deleteAssets:)]
        pub unsafe fn deleteAssets(assets: &ProtocolObject<dyn NSFastEnumeration>);

        #[cfg(all(feature = "PHAsset", feature = "PHObject"))]
        #[method_id(@__retain_semantics Other changeRequestForAsset:)]
        pub unsafe fn changeRequestForAsset(asset: &PHAsset) -> Id<Self>;

        #[method_id(@__retain_semantics Other creationDate)]
        pub unsafe fn creationDate(&self) -> Option<Id<NSDate>>;

        #[method(setCreationDate:)]
        pub unsafe fn setCreationDate(&self, creation_date: Option<&NSDate>);

        #[cfg(feature = "objc2-core-location")]
        #[method_id(@__retain_semantics Other location)]
        pub unsafe fn location(&self) -> Option<Id<CLLocation>>;

        #[cfg(feature = "objc2-core-location")]
        #[method(setLocation:)]
        pub unsafe fn setLocation(&self, location: Option<&CLLocation>);

        #[method(isFavorite)]
        pub unsafe fn isFavorite(&self) -> bool;

        #[method(setFavorite:)]
        pub unsafe fn setFavorite(&self, favorite: bool);

        #[method(isHidden)]
        pub unsafe fn isHidden(&self) -> bool;

        #[method(setHidden:)]
        pub unsafe fn setHidden(&self, hidden: bool);

        #[cfg(feature = "PHContentEditingOutput")]
        #[method_id(@__retain_semantics Other contentEditingOutput)]
        pub unsafe fn contentEditingOutput(&self) -> Option<Id<PHContentEditingOutput>>;

        #[cfg(feature = "PHContentEditingOutput")]
        #[method(setContentEditingOutput:)]
        pub unsafe fn setContentEditingOutput(
            &self,
            content_editing_output: Option<&PHContentEditingOutput>,
        );

        #[method(revertAssetContentToOriginal)]
        pub unsafe fn revertAssetContentToOriginal(&self);
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "PHChangeRequest")]
    unsafe impl PHAssetChangeRequest {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);

pub type PHContentEditingInputRequestID = NSUInteger;

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct PHContentEditingInputRequestOptions;

    unsafe impl ClassType for PHContentEditingInputRequestOptions {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for PHContentEditingInputRequestOptions {}

extern_methods!(
    unsafe impl PHContentEditingInputRequestOptions {
        #[cfg(all(feature = "PHAdjustmentData", feature = "block2"))]
        #[method(canHandleAdjustmentData)]
        pub unsafe fn canHandleAdjustmentData(
            &self,
        ) -> NonNull<Block<dyn Fn(NonNull<PHAdjustmentData>) -> Bool>>;

        #[cfg(all(feature = "PHAdjustmentData", feature = "block2"))]
        #[method(setCanHandleAdjustmentData:)]
        pub unsafe fn setCanHandleAdjustmentData(
            &self,
            can_handle_adjustment_data: &Block<dyn Fn(NonNull<PHAdjustmentData>) -> Bool>,
        );

        #[method(isNetworkAccessAllowed)]
        pub unsafe fn isNetworkAccessAllowed(&self) -> bool;

        #[method(setNetworkAccessAllowed:)]
        pub unsafe fn setNetworkAccessAllowed(&self, network_access_allowed: bool);

        #[cfg(feature = "block2")]
        #[method(progressHandler)]
        pub unsafe fn progressHandler(&self) -> *mut Block<dyn Fn(c_double, NonNull<Bool>)>;

        #[cfg(feature = "block2")]
        #[method(setProgressHandler:)]
        pub unsafe fn setProgressHandler(
            &self,
            progress_handler: Option<&Block<dyn Fn(c_double, NonNull<Bool>)>>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl PHContentEditingInputRequestOptions {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);

extern_methods!(
    /// PHContentEditingInput
    #[cfg(all(feature = "PHAsset", feature = "PHObject"))]
    unsafe impl PHAsset {
        #[cfg(all(feature = "PHContentEditingInput", feature = "block2"))]
        #[method(requestContentEditingInputWithOptions:completionHandler:)]
        pub unsafe fn requestContentEditingInputWithOptions_completionHandler(
            &self,
            options: Option<&PHContentEditingInputRequestOptions>,
            completion_handler: &Block<dyn Fn(*mut PHContentEditingInput, NonNull<NSDictionary>)>,
        ) -> PHContentEditingInputRequestID;

        #[method(cancelContentEditingInputRequest:)]
        pub unsafe fn cancelContentEditingInputRequest(
            &self,
            request_id: PHContentEditingInputRequestID,
        );
    }
);

extern "C" {
    pub static PHContentEditingInputResultIsInCloudKey: &'static NSString;
}

extern "C" {
    pub static PHContentEditingInputCancelledKey: &'static NSString;
}

extern "C" {
    pub static PHContentEditingInputErrorKey: &'static NSString;
}

extern_methods!(
    /// PHAssetChangeRequest
    #[cfg(feature = "PHContentEditingOutput")]
    unsafe impl PHContentEditingOutput {
        #[cfg(feature = "PHObject")]
        #[method_id(@__retain_semantics Init initWithPlaceholderForCreatedAsset:)]
        pub unsafe fn initWithPlaceholderForCreatedAsset(
            this: Allocated<Self>,
            placeholder_for_created_asset: &PHObjectPlaceholder,
        ) -> Id<Self>;
    }
);