objc2_ui_kit/generated/
UIShape.rs1use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11#[repr(transparent)]
16#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
17pub struct UICornerCurve(pub NSInteger);
18impl UICornerCurve {
19 #[doc(alias = "UICornerCurveAutomatic")]
21 pub const Automatic: Self = Self(0);
22 #[doc(alias = "UICornerCurveCircular")]
24 pub const Circular: Self = Self(1);
25 #[doc(alias = "UICornerCurveContinuous")]
27 pub const Continuous: Self = Self(2);
28}
29
30unsafe impl Encode for UICornerCurve {
31 const ENCODING: Encoding = NSInteger::ENCODING;
32}
33
34unsafe impl RefEncode for UICornerCurve {
35 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
36}
37
38extern_protocol!(
39 pub unsafe trait UIShapeProvider: NSObjectProtocol {
44 #[unsafe(method(resolvedShapeInContext:))]
46 #[unsafe(method_family = none)]
47 unsafe fn resolvedShapeInContext(
48 &self,
49 context: &UIShapeResolutionContext,
50 ) -> Retained<UIResolvedShape>;
51 }
52);
53
54extern_class!(
55 #[unsafe(super(NSObject))]
68 #[derive(Debug, PartialEq, Eq, Hash)]
69 pub struct UIShape;
70);
71
72unsafe impl NSCopying for UIShape {}
73
74unsafe impl CopyingHelper for UIShape {
75 type Result = Self;
76}
77
78unsafe impl NSObjectProtocol for UIShape {}
79
80unsafe impl UIShapeProvider for UIShape {}
81
82impl UIShape {
83 extern_methods!(
84 #[unsafe(method(rectShape))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn rectShape() -> Retained<UIShape>;
88
89 #[unsafe(method(capsuleShape))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn capsuleShape() -> Retained<UIShape>;
94
95 #[unsafe(method(circleShape))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn circleShape() -> Retained<UIShape>;
100
101 #[cfg(feature = "objc2-core-foundation")]
102 #[unsafe(method(rectShapeWithCornerRadius:))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn rectShapeWithCornerRadius(corner_radius: CGFloat) -> Retained<Self>;
107
108 #[cfg(feature = "objc2-core-foundation")]
109 #[unsafe(method(rectShapeWithCornerRadius:cornerCurve:))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn rectShapeWithCornerRadius_cornerCurve(
114 corner_radius: CGFloat,
115 corner_curve: UICornerCurve,
116 ) -> Retained<Self>;
117
118 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
119 #[unsafe(method(rectShapeWithCornerRadius:cornerCurve:maskedCorners:))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn rectShapeWithCornerRadius_cornerCurve_maskedCorners(
124 corner_radius: CGFloat,
125 corner_curve: UICornerCurve,
126 masked_corners: UIRectCorner,
127 ) -> Retained<Self>;
128
129 #[cfg(feature = "objc2-core-foundation")]
130 #[unsafe(method(fixedRectShapeWithRect:))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn fixedRectShapeWithRect(rect: CGRect) -> Retained<Self>;
135
136 #[cfg(feature = "objc2-core-foundation")]
137 #[unsafe(method(fixedRectShapeWithRect:cornerRadius:))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn fixedRectShapeWithRect_cornerRadius(
142 rect: CGRect,
143 corner_radius: CGFloat,
144 ) -> Retained<Self>;
145
146 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
147 #[unsafe(method(fixedRectShapeWithRect:cornerRadius:cornerCurve:maskedCorners:))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn fixedRectShapeWithRect_cornerRadius_cornerCurve_maskedCorners(
152 rect: CGRect,
153 corner_radius: CGFloat,
154 corner_curve: UICornerCurve,
155 masked_corners: UIRectCorner,
156 ) -> Retained<Self>;
157
158 #[cfg(feature = "UIBezierPath")]
159 #[unsafe(method(shapeWithBezierPath:))]
161 #[unsafe(method_family = none)]
162 pub unsafe fn shapeWithBezierPath(path: &UIBezierPath) -> Retained<Self>;
163
164 #[unsafe(method(shapeWithProvider:))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn shapeWithProvider(
169 provider: &ProtocolObject<dyn UIShapeProvider>,
170 ) -> Retained<Self>;
171
172 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
173 #[unsafe(method(shapeByApplyingInsets:))]
182 #[unsafe(method_family = none)]
183 pub unsafe fn shapeByApplyingInsets(&self, insets: UIEdgeInsets) -> Retained<UIShape>;
184
185 #[cfg(feature = "objc2-core-foundation")]
186 #[unsafe(method(shapeByApplyingInset:))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn shapeByApplyingInset(&self, inset: CGFloat) -> Retained<UIShape>;
197
198 #[unsafe(method(resolvedShapeInContext:))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn resolvedShapeInContext(
202 &self,
203 context: &UIShapeResolutionContext,
204 ) -> Retained<UIResolvedShape>;
205
206 #[unsafe(method(init))]
207 #[unsafe(method_family = init)]
208 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
209
210 #[unsafe(method(new))]
211 #[unsafe(method_family = new)]
212 pub unsafe fn new() -> Retained<Self>;
213 );
214}
215
216extern_class!(
217 #[unsafe(super(NSObject))]
221 #[derive(Debug, PartialEq, Eq, Hash)]
222 pub struct UIResolvedShape;
223);
224
225unsafe impl NSCopying for UIResolvedShape {}
226
227unsafe impl CopyingHelper for UIResolvedShape {
228 type Result = Self;
229}
230
231unsafe impl NSObjectProtocol for UIResolvedShape {}
232
233impl UIResolvedShape {
234 extern_methods!(
235 #[unsafe(method(shape))]
237 #[unsafe(method_family = none)]
238 pub unsafe fn shape(&self) -> Retained<UIShape>;
239
240 #[cfg(feature = "objc2-core-foundation")]
241 #[unsafe(method(boundingRect))]
243 #[unsafe(method_family = none)]
244 pub unsafe fn boundingRect(&self) -> CGRect;
245
246 #[cfg(feature = "UIBezierPath")]
247 #[unsafe(method(path))]
249 #[unsafe(method_family = none)]
250 pub unsafe fn path(&self) -> Retained<UIBezierPath>;
251
252 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
253 #[unsafe(method(shapeByApplyingInsets:))]
262 #[unsafe(method_family = none)]
263 pub unsafe fn shapeByApplyingInsets(
264 &self,
265 insets: UIEdgeInsets,
266 ) -> Retained<UIResolvedShape>;
267
268 #[cfg(feature = "objc2-core-foundation")]
269 #[unsafe(method(shapeByApplyingInset:))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn shapeByApplyingInset(&self, inset: CGFloat) -> Retained<UIResolvedShape>;
280
281 #[unsafe(method(init))]
282 #[unsafe(method_family = init)]
283 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
284
285 #[unsafe(method(new))]
286 #[unsafe(method_family = new)]
287 pub unsafe fn new() -> Retained<Self>;
288 );
289}
290
291extern_class!(
292 #[unsafe(super(NSObject))]
296 #[derive(Debug, PartialEq, Eq, Hash)]
297 pub struct UIShapeResolutionContext;
298);
299
300unsafe impl NSObjectProtocol for UIShapeResolutionContext {}
301
302impl UIShapeResolutionContext {
303 extern_methods!(
304 #[unsafe(method(contentShape))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn contentShape(&self) -> Retained<UIResolvedShape>;
312
313 #[unsafe(method(init))]
314 #[unsafe(method_family = init)]
315 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
316
317 #[unsafe(method(new))]
318 #[unsafe(method_family = new)]
319 pub unsafe fn new() -> Retained<Self>;
320 );
321}