objc2-app-kit 0.3.2

Bindings to the AppKit 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::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(target_vendor = "apple")]
use objc2_quartz_core::*;

use crate::*;

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

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

impl NSAnimationContext {
    extern_methods!(
        #[cfg(feature = "block2")]
        #[unsafe(method(runAnimationGroup:completionHandler:))]
        #[unsafe(method_family = none)]
        pub fn runAnimationGroup_completionHandler(
            changes: &block2::DynBlock<dyn Fn(NonNull<NSAnimationContext>) + '_>,
            completion_handler: Option<&block2::DynBlock<dyn Fn()>>,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(runAnimationGroup:))]
        #[unsafe(method_family = none)]
        pub fn runAnimationGroup(
            changes: &block2::DynBlock<dyn Fn(NonNull<NSAnimationContext>) + '_>,
        );

        #[unsafe(method(beginGrouping))]
        #[unsafe(method_family = none)]
        pub fn beginGrouping();

        #[unsafe(method(endGrouping))]
        #[unsafe(method_family = none)]
        pub fn endGrouping();

        #[unsafe(method(currentContext))]
        #[unsafe(method_family = none)]
        pub fn currentContext() -> Retained<NSAnimationContext>;

        #[unsafe(method(duration))]
        #[unsafe(method_family = none)]
        pub fn duration(&self) -> NSTimeInterval;

        /// Setter for [`duration`][Self::duration].
        #[unsafe(method(setDuration:))]
        #[unsafe(method_family = none)]
        pub fn setDuration(&self, duration: NSTimeInterval);

        #[cfg(feature = "objc2-quartz-core")]
        #[cfg(target_vendor = "apple")]
        #[unsafe(method(timingFunction))]
        #[unsafe(method_family = none)]
        pub fn timingFunction(&self) -> Option<Retained<CAMediaTimingFunction>>;

        #[cfg(feature = "objc2-quartz-core")]
        #[cfg(target_vendor = "apple")]
        /// Setter for [`timingFunction`][Self::timingFunction].
        #[unsafe(method(setTimingFunction:))]
        #[unsafe(method_family = none)]
        pub fn setTimingFunction(&self, timing_function: Option<&CAMediaTimingFunction>);

        #[cfg(feature = "block2")]
        #[unsafe(method(completionHandler))]
        #[unsafe(method_family = none)]
        pub fn completionHandler(&self) -> *mut block2::DynBlock<dyn Fn()>;

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

        #[unsafe(method(allowsImplicitAnimation))]
        #[unsafe(method_family = none)]
        pub fn allowsImplicitAnimation(&self) -> bool;

        /// Setter for [`allowsImplicitAnimation`][Self::allowsImplicitAnimation].
        #[unsafe(method(setAllowsImplicitAnimation:))]
        #[unsafe(method_family = none)]
        pub fn setAllowsImplicitAnimation(&self, allows_implicit_animation: bool);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSAnimationContext {
    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 NSAnimationContext {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}