objc2-ui-kit 0.3.2

Bindings to the UIKit 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-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

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

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

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

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

impl UIZoomTransitionOptions {
    extern_methods!(
        #[cfg(feature = "block2")]
        /// Called when an interactive dismissal of this transition begins.
        /// Return value indicates whether the interaction should begin for the given context.
        ///
        /// # Safety
        ///
        /// The returned block's argument must be a valid pointer.
        #[unsafe(method(interactiveDismissShouldBegin))]
        #[unsafe(method_family = none)]
        pub unsafe fn interactiveDismissShouldBegin(
            &self,
        ) -> *mut block2::DynBlock<dyn Fn(NonNull<UIZoomTransitionInteractionContext>) -> Bool>;

        #[cfg(feature = "block2")]
        /// Setter for [`interactiveDismissShouldBegin`][Self::interactiveDismissShouldBegin].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setInteractiveDismissShouldBegin:))]
        #[unsafe(method_family = none)]
        pub fn setInteractiveDismissShouldBegin(
            &self,
            interactive_dismiss_should_begin: Option<
                &block2::DynBlock<dyn Fn(NonNull<UIZoomTransitionInteractionContext>) -> Bool>,
            >,
        );

        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
        /// Return a frame in the zoomed view controller's view to which to align the source view.
        /// Return `CGRectNull` to indicate no preference.
        ///
        /// # Safety
        ///
        /// The returned block's argument must be a valid pointer.
        #[unsafe(method(alignmentRectProvider))]
        #[unsafe(method_family = none)]
        pub unsafe fn alignmentRectProvider(
            &self,
        ) -> *mut block2::DynBlock<dyn Fn(NonNull<UIZoomTransitionAlignmentRectContext>) -> CGRect>;

        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
        /// Setter for [`alignmentRectProvider`][Self::alignmentRectProvider].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setAlignmentRectProvider:))]
        #[unsafe(method_family = none)]
        pub fn setAlignmentRectProvider(
            &self,
            alignment_rect_provider: Option<
                &block2::DynBlock<dyn Fn(NonNull<UIZoomTransitionAlignmentRectContext>) -> CGRect>,
            >,
        );

        #[cfg(feature = "UIColor")]
        /// Dimming color to apply to the content behind the zoomed in view. Set to nil to use the default.
        #[unsafe(method(dimmingColor))]
        #[unsafe(method_family = none)]
        pub fn dimmingColor(&self) -> Option<Retained<UIColor>>;

        #[cfg(feature = "UIColor")]
        /// Setter for [`dimmingColor`][Self::dimmingColor].
        #[unsafe(method(setDimmingColor:))]
        #[unsafe(method_family = none)]
        pub fn setDimmingColor(&self, dimming_color: Option<&UIColor>);

        #[cfg(all(feature = "UIBlurEffect", feature = "UIVisualEffect"))]
        /// Visual effect to apply to the content behind the zoomed in view. Defaults to nil.
        #[unsafe(method(dimmingVisualEffect))]
        #[unsafe(method_family = none)]
        pub fn dimmingVisualEffect(&self, mtm: MainThreadMarker) -> Option<Retained<UIBlurEffect>>;

        #[cfg(all(feature = "UIBlurEffect", feature = "UIVisualEffect"))]
        /// Setter for [`dimmingVisualEffect`][Self::dimmingVisualEffect].
        #[unsafe(method(setDimmingVisualEffect:))]
        #[unsafe(method_family = none)]
        pub fn setDimmingVisualEffect(&self, dimming_visual_effect: Option<&UIBlurEffect>);
    );
}

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

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

impl DefaultRetained for UIZoomTransitionOptions {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

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

impl UIZoomTransitionInteractionContext {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// Location of the interaction in the displayed view controller's view's coordinate space.
        #[unsafe(method(location))]
        #[unsafe(method_family = none)]
        pub fn location(&self) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        /// The interaction's velocity.
        #[unsafe(method(velocity))]
        #[unsafe(method_family = none)]
        pub fn velocity(&self) -> CGVector;

        /// Whether the interaction would begin under the current conditions by default.
        #[unsafe(method(willBegin))]
        #[unsafe(method_family = none)]
        pub fn willBegin(&self) -> bool;
    );
}

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

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

impl DefaultRetained for UIZoomTransitionInteractionContext {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

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

impl UIZoomTransitionAlignmentRectContext {
    extern_methods!(
        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        /// The transition's source view.
        #[unsafe(method(sourceView))]
        #[unsafe(method_family = none)]
        pub fn sourceView(&self, mtm: MainThreadMarker) -> Retained<UIView>;

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        /// The zoomed view controller.
        #[unsafe(method(zoomedViewController))]
        #[unsafe(method_family = none)]
        pub fn zoomedViewController(&self, mtm: MainThreadMarker) -> Retained<UIViewController>;
    );
}

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

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

impl DefaultRetained for UIZoomTransitionAlignmentRectContext {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}