1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
//! 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 UICornerCurve(pub NSInteger);
impl UICornerCurve {
    #[doc(alias = "UICornerCurveAutomatic")]
    pub const Automatic: Self = Self(0);
    #[doc(alias = "UICornerCurveCircular")]
    pub const Circular: Self = Self(1);
    #[doc(alias = "UICornerCurveContinuous")]
    pub const Continuous: Self = Self(2);
}

unsafe impl Encode for UICornerCurve {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

extern_protocol!(
    pub unsafe trait UIShapeProvider: NSObjectProtocol {
        #[method_id(@__retain_semantics Other resolvedShapeInContext:)]
        unsafe fn resolvedShapeInContext(
            &self,
            context: &UIShapeResolutionContext,
        ) -> Retained<UIResolvedShape>;
    }

    unsafe impl ProtocolType for dyn UIShapeProvider {}
);

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

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

unsafe impl NSCopying for UIShape {}

unsafe impl NSObjectProtocol for UIShape {}

unsafe impl UIShapeProvider for UIShape {}

extern_methods!(
    unsafe impl UIShape {
        #[method_id(@__retain_semantics Other rectShape)]
        pub unsafe fn rectShape() -> Retained<UIShape>;

        #[method_id(@__retain_semantics Other capsuleShape)]
        pub unsafe fn capsuleShape() -> Retained<UIShape>;

        #[method_id(@__retain_semantics Other circleShape)]
        pub unsafe fn circleShape() -> Retained<UIShape>;

        #[method_id(@__retain_semantics Other rectShapeWithCornerRadius:)]
        pub unsafe fn rectShapeWithCornerRadius(corner_radius: CGFloat) -> Retained<Self>;

        #[method_id(@__retain_semantics Other rectShapeWithCornerRadius:cornerCurve:)]
        pub unsafe fn rectShapeWithCornerRadius_cornerCurve(
            corner_radius: CGFloat,
            corner_curve: UICornerCurve,
        ) -> Retained<Self>;

        #[cfg(feature = "UIGeometry")]
        #[method_id(@__retain_semantics Other rectShapeWithCornerRadius:cornerCurve:maskedCorners:)]
        pub unsafe fn rectShapeWithCornerRadius_cornerCurve_maskedCorners(
            corner_radius: CGFloat,
            corner_curve: UICornerCurve,
            masked_corners: UIRectCorner,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Other fixedRectShapeWithRect:)]
        pub unsafe fn fixedRectShapeWithRect(rect: CGRect) -> Retained<Self>;

        #[method_id(@__retain_semantics Other fixedRectShapeWithRect:cornerRadius:)]
        pub unsafe fn fixedRectShapeWithRect_cornerRadius(
            rect: CGRect,
            corner_radius: CGFloat,
        ) -> Retained<Self>;

        #[cfg(feature = "UIGeometry")]
        #[method_id(@__retain_semantics Other fixedRectShapeWithRect:cornerRadius:cornerCurve:maskedCorners:)]
        pub unsafe fn fixedRectShapeWithRect_cornerRadius_cornerCurve_maskedCorners(
            rect: CGRect,
            corner_radius: CGFloat,
            corner_curve: UICornerCurve,
            masked_corners: UIRectCorner,
        ) -> Retained<Self>;

        #[cfg(feature = "UIBezierPath")]
        #[method_id(@__retain_semantics Other shapeWithBezierPath:)]
        pub unsafe fn shapeWithBezierPath(path: &UIBezierPath) -> Retained<Self>;

        #[method_id(@__retain_semantics Other shapeWithProvider:)]
        pub unsafe fn shapeWithProvider(
            provider: &ProtocolObject<dyn UIShapeProvider>,
        ) -> Retained<Self>;

        #[cfg(feature = "UIGeometry")]
        #[method_id(@__retain_semantics Other shapeByApplyingInsets:)]
        pub unsafe fn shapeByApplyingInsets(&self, insets: UIEdgeInsets) -> Retained<UIShape>;

        #[method_id(@__retain_semantics Other shapeByApplyingInset:)]
        pub unsafe fn shapeByApplyingInset(&self, inset: CGFloat) -> Retained<UIShape>;

        #[method_id(@__retain_semantics Other resolvedShapeInContext:)]
        pub unsafe fn resolvedShapeInContext(
            &self,
            context: &UIShapeResolutionContext,
        ) -> Retained<UIResolvedShape>;

        #[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_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIResolvedShape;

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

unsafe impl NSCopying for UIResolvedShape {}

unsafe impl NSObjectProtocol for UIResolvedShape {}

extern_methods!(
    unsafe impl UIResolvedShape {
        #[method_id(@__retain_semantics Other shape)]
        pub unsafe fn shape(&self) -> Retained<UIShape>;

        #[method(boundingRect)]
        pub unsafe fn boundingRect(&self) -> CGRect;

        #[cfg(feature = "UIBezierPath")]
        #[method_id(@__retain_semantics Other path)]
        pub unsafe fn path(&self) -> Retained<UIBezierPath>;

        #[cfg(feature = "UIGeometry")]
        #[method_id(@__retain_semantics Other shapeByApplyingInsets:)]
        pub unsafe fn shapeByApplyingInsets(
            &self,
            insets: UIEdgeInsets,
        ) -> Retained<UIResolvedShape>;

        #[method_id(@__retain_semantics Other shapeByApplyingInset:)]
        pub unsafe fn shapeByApplyingInset(&self, inset: CGFloat) -> Retained<UIResolvedShape>;

        #[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_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIShapeResolutionContext;

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

unsafe impl NSObjectProtocol for UIShapeResolutionContext {}

extern_methods!(
    unsafe impl UIShapeResolutionContext {
        #[method_id(@__retain_semantics Other contentShape)]
        pub unsafe fn contentShape(&self) -> Retained<UIResolvedShape>;

        #[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>;
    }
);