objc2-quartz-core 0.3.2

Bindings to the QuartzCore/CoreAnimation 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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/cagradientlayertype?language=objc)
// NS_TYPED_ENUM
pub type CAGradientLayerType = NSString;

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

#[cfg(all(feature = "CALayer", feature = "CAMediaTiming"))]
extern_conformance!(
    unsafe impl CAMediaTiming for CAGradientLayer {}
);

#[cfg(feature = "CALayer")]
extern_conformance!(
    unsafe impl NSCoding for CAGradientLayer {}
);

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

#[cfg(feature = "CALayer")]
extern_conformance!(
    unsafe impl NSSecureCoding for CAGradientLayer {}
);

#[cfg(feature = "CALayer")]
impl CAGradientLayer {
    extern_methods!(
        #[unsafe(method(colors))]
        #[unsafe(method_family = none)]
        pub fn colors(&self) -> Option<Retained<NSArray>>;

        /// Setter for [`colors`][Self::colors].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `colors` generic should be of the correct type.
        #[unsafe(method(setColors:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setColors(&self, colors: Option<&NSArray>);

        #[unsafe(method(locations))]
        #[unsafe(method_family = none)]
        pub fn locations(&self) -> Option<Retained<NSArray<NSNumber>>>;

        /// Setter for [`locations`][Self::locations].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setLocations:))]
        #[unsafe(method_family = none)]
        pub fn setLocations(&self, locations: Option<&NSArray<NSNumber>>);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(startPoint))]
        #[unsafe(method_family = none)]
        pub fn startPoint(&self) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`startPoint`][Self::startPoint].
        #[unsafe(method(setStartPoint:))]
        #[unsafe(method_family = none)]
        pub fn setStartPoint(&self, start_point: CGPoint);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(endPoint))]
        #[unsafe(method_family = none)]
        pub fn endPoint(&self) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`endPoint`][Self::endPoint].
        #[unsafe(method(setEndPoint:))]
        #[unsafe(method_family = none)]
        pub fn setEndPoint(&self, end_point: CGPoint);

        #[unsafe(method(type))]
        #[unsafe(method_family = none)]
        pub fn r#type(&self) -> Retained<CAGradientLayerType>;

        /// Setter for [`type`][Self::type].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setType:))]
        #[unsafe(method_family = none)]
        pub fn setType(&self, r#type: &CAGradientLayerType);
    );
}

/// Methods declared on superclass `CALayer`.
#[cfg(feature = "CALayer")]
impl CAGradientLayer {
    extern_methods!(
        /// Layer creation and initialization. *
        #[unsafe(method(layer))]
        #[unsafe(method_family = none)]
        pub fn layer() -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        /// # Safety
        ///
        /// `layer` should be of the correct type.
        #[unsafe(method(initWithLayer:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "CALayer")]
impl CAGradientLayer {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

#[cfg(feature = "CALayer")]
impl DefaultRetained for CAGradientLayer {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern "C" {
    /// `type' values. *
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcagradientlayeraxial?language=objc)
    pub static kCAGradientLayerAxial: &'static CAGradientLayerType;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcagradientlayerradial?language=objc)
    pub static kCAGradientLayerRadial: &'static CAGradientLayerType;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcagradientlayerconic?language=objc)
    pub static kCAGradientLayerConic: &'static CAGradientLayerType;
}