objc2-app-kit 0.2.2

Bindings to the AppKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAnimationCurve(pub NSUInteger);
impl NSAnimationCurve {
    pub const NSAnimationEaseInOut: Self = Self(0);
    pub const NSAnimationEaseIn: Self = Self(1);
    pub const NSAnimationEaseOut: Self = Self(2);
    pub const NSAnimationLinear: Self = Self(3);
}

unsafe impl Encode for NSAnimationCurve {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSAnimationCurve {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAnimationBlockingMode(pub NSUInteger);
impl NSAnimationBlockingMode {
    pub const NSAnimationBlocking: Self = Self(0);
    pub const NSAnimationNonblocking: Self = Self(1);
    pub const NSAnimationNonblockingThreaded: Self = Self(2);
}

unsafe impl Encode for NSAnimationBlockingMode {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSAnimationBlockingMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

pub type NSAnimationProgress = c_float;

extern "C" {
    pub static NSAnimationProgressMarkNotification: &'static NSNotificationName;
}

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

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

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

unsafe impl NSCoding for NSAnimation {}

unsafe impl NSCopying for NSAnimation {}

unsafe impl NSObjectProtocol for NSAnimation {}

extern_methods!(
    unsafe impl NSAnimation {
        #[method_id(@__retain_semantics Init initWithDuration:animationCurve:)]
        pub unsafe fn initWithDuration_animationCurve(
            this: Allocated<Self>,
            duration: NSTimeInterval,
            animation_curve: NSAnimationCurve,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

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

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

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

        #[method(currentProgress)]
        pub unsafe fn currentProgress(&self) -> NSAnimationProgress;

        #[method(setCurrentProgress:)]
        pub unsafe fn setCurrentProgress(&self, current_progress: NSAnimationProgress);

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

        #[method(setDuration:)]
        pub unsafe fn setDuration(&self, duration: NSTimeInterval);

        #[method(animationBlockingMode)]
        pub unsafe fn animationBlockingMode(&self) -> NSAnimationBlockingMode;

        #[method(setAnimationBlockingMode:)]
        pub unsafe fn setAnimationBlockingMode(
            &self,
            animation_blocking_mode: NSAnimationBlockingMode,
        );

        #[method(frameRate)]
        pub unsafe fn frameRate(&self) -> c_float;

        #[method(setFrameRate:)]
        pub unsafe fn setFrameRate(&self, frame_rate: c_float);

        #[method(animationCurve)]
        pub unsafe fn animationCurve(&self) -> NSAnimationCurve;

        #[method(setAnimationCurve:)]
        pub unsafe fn setAnimationCurve(&self, animation_curve: NSAnimationCurve);

        #[method(currentValue)]
        pub unsafe fn currentValue(&self) -> c_float;

        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSAnimationDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn NSAnimationDelegate>>,
        );

        #[method_id(@__retain_semantics Other progressMarks)]
        pub unsafe fn progressMarks(&self) -> Retained<NSArray<NSNumber>>;

        #[method(setProgressMarks:)]
        pub unsafe fn setProgressMarks(&self, progress_marks: &NSArray<NSNumber>);

        #[method(addProgressMark:)]
        pub unsafe fn addProgressMark(&self, progress_mark: NSAnimationProgress);

        #[method(removeProgressMark:)]
        pub unsafe fn removeProgressMark(&self, progress_mark: NSAnimationProgress);

        #[method(startWhenAnimation:reachesProgress:)]
        pub unsafe fn startWhenAnimation_reachesProgress(
            &self,
            animation: &NSAnimation,
            start_progress: NSAnimationProgress,
        );

        #[method(stopWhenAnimation:reachesProgress:)]
        pub unsafe fn stopWhenAnimation_reachesProgress(
            &self,
            animation: &NSAnimation,
            stop_progress: NSAnimationProgress,
        );

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

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

        #[method_id(@__retain_semantics Other runLoopModesForAnimating)]
        pub unsafe fn runLoopModesForAnimating(&self) -> Option<Retained<NSArray<NSRunLoopMode>>>;
    }
);

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

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

extern_protocol!(
    pub unsafe trait NSAnimationDelegate: NSObjectProtocol {
        #[optional]
        #[method(animationShouldStart:)]
        unsafe fn animationShouldStart(&self, animation: &NSAnimation) -> bool;

        #[optional]
        #[method(animationDidStop:)]
        unsafe fn animationDidStop(&self, animation: &NSAnimation);

        #[optional]
        #[method(animationDidEnd:)]
        unsafe fn animationDidEnd(&self, animation: &NSAnimation);

        #[optional]
        #[method(animation:valueForProgress:)]
        unsafe fn animation_valueForProgress(
            &self,
            animation: &NSAnimation,
            progress: NSAnimationProgress,
        ) -> c_float;

        #[optional]
        #[method(animation:didReachProgressMark:)]
        unsafe fn animation_didReachProgressMark(
            &self,
            animation: &NSAnimation,
            progress: NSAnimationProgress,
        );
    }

    unsafe impl ProtocolType for dyn NSAnimationDelegate {}
);

// NS_TYPED_ENUM
pub type NSViewAnimationKey = NSString;

extern "C" {
    pub static NSViewAnimationTargetKey: &'static NSViewAnimationKey;
}

extern "C" {
    pub static NSViewAnimationStartFrameKey: &'static NSViewAnimationKey;
}

extern "C" {
    pub static NSViewAnimationEndFrameKey: &'static NSViewAnimationKey;
}

extern "C" {
    pub static NSViewAnimationEffectKey: &'static NSViewAnimationKey;
}

// NS_TYPED_ENUM
pub type NSViewAnimationEffectName = NSString;

extern "C" {
    pub static NSViewAnimationFadeInEffect: &'static NSViewAnimationEffectName;
}

extern "C" {
    pub static NSViewAnimationFadeOutEffect: &'static NSViewAnimationEffectName;
}

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

    unsafe impl ClassType for NSViewAnimation {
        #[inherits(NSObject)]
        type Super = NSAnimation;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSCoding for NSViewAnimation {}

unsafe impl NSCopying for NSViewAnimation {}

unsafe impl NSObjectProtocol for NSViewAnimation {}

extern_methods!(
    unsafe impl NSViewAnimation {
        #[method_id(@__retain_semantics Init initWithViewAnimations:)]
        pub unsafe fn initWithViewAnimations(
            this: Allocated<Self>,
            view_animations: &NSArray<NSDictionary<NSViewAnimationKey, AnyObject>>,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Other viewAnimations)]
        pub unsafe fn viewAnimations(
            &self,
        ) -> Retained<NSArray<NSDictionary<NSViewAnimationKey, AnyObject>>>;

        #[method(setViewAnimations:)]
        pub unsafe fn setViewAnimations(
            &self,
            view_animations: &NSArray<NSDictionary<NSViewAnimationKey, AnyObject>>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSAnimation`
    unsafe impl NSViewAnimation {
        #[method_id(@__retain_semantics Init initWithDuration:animationCurve:)]
        pub unsafe fn initWithDuration_animationCurve(
            this: Allocated<Self>,
            duration: NSTimeInterval,
            animation_curve: NSAnimationCurve,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    }
);

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

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

pub type NSAnimatablePropertyKey = NSString;

extern_protocol!(
    pub unsafe trait NSAnimatablePropertyContainer {
        #[method_id(@__retain_semantics Other animator)]
        unsafe fn animator(&self) -> Retained<Self>;

        #[method_id(@__retain_semantics Other animations)]
        unsafe fn animations(&self) -> Retained<NSDictionary<NSAnimatablePropertyKey, AnyObject>>;

        #[method(setAnimations:)]
        unsafe fn setAnimations(
            &self,
            animations: &NSDictionary<NSAnimatablePropertyKey, AnyObject>,
        );

        #[method_id(@__retain_semantics Other animationForKey:)]
        unsafe fn animationForKey(
            &self,
            key: &NSAnimatablePropertyKey,
        ) -> Option<Retained<AnyObject>>;

        #[method_id(@__retain_semantics Other defaultAnimationForKey:)]
        unsafe fn defaultAnimationForKey(
            key: &NSAnimatablePropertyKey,
        ) -> Option<Retained<AnyObject>>;
    }

    unsafe impl ProtocolType for dyn NSAnimatablePropertyContainer {}
);

extern "C" {
    pub static NSAnimationTriggerOrderIn: &'static NSAnimatablePropertyKey;
}

extern "C" {
    pub static NSAnimationTriggerOrderOut: &'static NSAnimatablePropertyKey;
}