objc2_quartz_core/generated/
CAGradientLayer.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/cagradientlayertype?language=objc)
13// NS_TYPED_ENUM
14pub type CAGradientLayerType = NSString;
15
16extern_class!(
17    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/cagradientlayer?language=objc)
18    #[unsafe(super(CALayer, NSObject))]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    #[cfg(feature = "CALayer")]
21    pub struct CAGradientLayer;
22);
23
24#[cfg(all(feature = "CALayer", feature = "CAMediaTiming"))]
25extern_conformance!(
26    unsafe impl CAMediaTiming for CAGradientLayer {}
27);
28
29#[cfg(feature = "CALayer")]
30extern_conformance!(
31    unsafe impl NSCoding for CAGradientLayer {}
32);
33
34#[cfg(feature = "CALayer")]
35extern_conformance!(
36    unsafe impl NSObjectProtocol for CAGradientLayer {}
37);
38
39#[cfg(feature = "CALayer")]
40extern_conformance!(
41    unsafe impl NSSecureCoding for CAGradientLayer {}
42);
43
44#[cfg(feature = "CALayer")]
45impl CAGradientLayer {
46    extern_methods!(
47        #[unsafe(method(colors))]
48        #[unsafe(method_family = none)]
49        pub fn colors(&self) -> Option<Retained<NSArray>>;
50
51        /// Setter for [`colors`][Self::colors].
52        ///
53        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
54        ///
55        /// # Safety
56        ///
57        /// `colors` generic should be of the correct type.
58        #[unsafe(method(setColors:))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn setColors(&self, colors: Option<&NSArray>);
61
62        #[unsafe(method(locations))]
63        #[unsafe(method_family = none)]
64        pub fn locations(&self) -> Option<Retained<NSArray<NSNumber>>>;
65
66        /// Setter for [`locations`][Self::locations].
67        ///
68        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
69        #[unsafe(method(setLocations:))]
70        #[unsafe(method_family = none)]
71        pub fn setLocations(&self, locations: Option<&NSArray<NSNumber>>);
72
73        #[cfg(feature = "objc2-core-foundation")]
74        #[unsafe(method(startPoint))]
75        #[unsafe(method_family = none)]
76        pub fn startPoint(&self) -> CGPoint;
77
78        #[cfg(feature = "objc2-core-foundation")]
79        /// Setter for [`startPoint`][Self::startPoint].
80        #[unsafe(method(setStartPoint:))]
81        #[unsafe(method_family = none)]
82        pub fn setStartPoint(&self, start_point: CGPoint);
83
84        #[cfg(feature = "objc2-core-foundation")]
85        #[unsafe(method(endPoint))]
86        #[unsafe(method_family = none)]
87        pub fn endPoint(&self) -> CGPoint;
88
89        #[cfg(feature = "objc2-core-foundation")]
90        /// Setter for [`endPoint`][Self::endPoint].
91        #[unsafe(method(setEndPoint:))]
92        #[unsafe(method_family = none)]
93        pub fn setEndPoint(&self, end_point: CGPoint);
94
95        #[unsafe(method(type))]
96        #[unsafe(method_family = none)]
97        pub fn r#type(&self) -> Retained<CAGradientLayerType>;
98
99        /// Setter for [`type`][Self::type].
100        ///
101        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
102        #[unsafe(method(setType:))]
103        #[unsafe(method_family = none)]
104        pub fn setType(&self, r#type: &CAGradientLayerType);
105    );
106}
107
108/// Methods declared on superclass `CALayer`.
109#[cfg(feature = "CALayer")]
110impl CAGradientLayer {
111    extern_methods!(
112        /// Layer creation and initialization. *
113        #[unsafe(method(layer))]
114        #[unsafe(method_family = none)]
115        pub fn layer() -> Retained<Self>;
116
117        #[unsafe(method(init))]
118        #[unsafe(method_family = init)]
119        pub fn init(this: Allocated<Self>) -> Retained<Self>;
120
121        /// # Safety
122        ///
123        /// `layer` should be of the correct type.
124        #[unsafe(method(initWithLayer:))]
125        #[unsafe(method_family = init)]
126        pub unsafe fn initWithLayer(this: Allocated<Self>, layer: &AnyObject) -> Retained<Self>;
127    );
128}
129
130/// Methods declared on superclass `NSObject`.
131#[cfg(feature = "CALayer")]
132impl CAGradientLayer {
133    extern_methods!(
134        #[unsafe(method(new))]
135        #[unsafe(method_family = new)]
136        pub fn new() -> Retained<Self>;
137    );
138}
139
140#[cfg(feature = "CALayer")]
141impl DefaultRetained for CAGradientLayer {
142    #[inline]
143    fn default_retained() -> Retained<Self> {
144        Self::new()
145    }
146}
147
148extern "C" {
149    /// `type' values. *
150    ///
151    /// See also [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcagradientlayeraxial?language=objc)
152    pub static kCAGradientLayerAxial: &'static CAGradientLayerType;
153}
154
155extern "C" {
156    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcagradientlayerradial?language=objc)
157    pub static kCAGradientLayerRadial: &'static CAGradientLayerType;
158}
159
160extern "C" {
161    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcagradientlayerconic?language=objc)
162    pub static kCAGradientLayerConic: &'static CAGradientLayerType;
163}