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 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
72extern_conformance!(
73 unsafe impl NSCopying for UIShape {}
74);
75
76unsafe impl CopyingHelper for UIShape {
77 type Result = Self;
78}
79
80extern_conformance!(
81 unsafe impl NSObjectProtocol for UIShape {}
82);
83
84extern_conformance!(
85 unsafe impl UIShapeProvider for UIShape {}
86);
87
88impl UIShape {
89 extern_methods!(
90 #[unsafe(method(rectShape))]
92 #[unsafe(method_family = none)]
93 pub fn rectShape() -> Retained<UIShape>;
94
95 #[unsafe(method(capsuleShape))]
98 #[unsafe(method_family = none)]
99 pub fn capsuleShape() -> Retained<UIShape>;
100
101 #[unsafe(method(circleShape))]
104 #[unsafe(method_family = none)]
105 pub fn circleShape() -> Retained<UIShape>;
106
107 #[cfg(feature = "objc2-core-foundation")]
108 #[unsafe(method(rectShapeWithCornerRadius:))]
111 #[unsafe(method_family = none)]
112 pub fn rectShapeWithCornerRadius(corner_radius: CGFloat) -> Retained<Self>;
113
114 #[cfg(feature = "objc2-core-foundation")]
115 #[unsafe(method(rectShapeWithCornerRadius:cornerCurve:))]
118 #[unsafe(method_family = none)]
119 pub fn rectShapeWithCornerRadius_cornerCurve(
120 corner_radius: CGFloat,
121 corner_curve: UICornerCurve,
122 ) -> Retained<Self>;
123
124 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
125 #[unsafe(method(rectShapeWithCornerRadius:cornerCurve:maskedCorners:))]
128 #[unsafe(method_family = none)]
129 pub fn rectShapeWithCornerRadius_cornerCurve_maskedCorners(
130 corner_radius: CGFloat,
131 corner_curve: UICornerCurve,
132 masked_corners: UIRectCorner,
133 ) -> Retained<Self>;
134
135 #[cfg(feature = "objc2-core-foundation")]
136 #[unsafe(method(fixedRectShapeWithRect:))]
139 #[unsafe(method_family = none)]
140 pub fn fixedRectShapeWithRect(rect: CGRect) -> Retained<Self>;
141
142 #[cfg(feature = "objc2-core-foundation")]
143 #[unsafe(method(fixedRectShapeWithRect:cornerRadius:))]
146 #[unsafe(method_family = none)]
147 pub fn fixedRectShapeWithRect_cornerRadius(
148 rect: CGRect,
149 corner_radius: CGFloat,
150 ) -> Retained<Self>;
151
152 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
153 #[unsafe(method(fixedRectShapeWithRect:cornerRadius:cornerCurve:maskedCorners:))]
156 #[unsafe(method_family = none)]
157 pub fn fixedRectShapeWithRect_cornerRadius_cornerCurve_maskedCorners(
158 rect: CGRect,
159 corner_radius: CGFloat,
160 corner_curve: UICornerCurve,
161 masked_corners: UIRectCorner,
162 ) -> Retained<Self>;
163
164 #[cfg(feature = "UIBezierPath")]
165 #[unsafe(method(shapeWithBezierPath:))]
167 #[unsafe(method_family = none)]
168 pub fn shapeWithBezierPath(path: &UIBezierPath) -> Retained<Self>;
169
170 #[unsafe(method(shapeWithProvider:))]
173 #[unsafe(method_family = none)]
174 pub fn shapeWithProvider(provider: &ProtocolObject<dyn UIShapeProvider>) -> Retained<Self>;
175
176 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
177 #[unsafe(method(shapeByApplyingInsets:))]
186 #[unsafe(method_family = none)]
187 pub fn shapeByApplyingInsets(&self, insets: UIEdgeInsets) -> Retained<UIShape>;
188
189 #[cfg(feature = "objc2-core-foundation")]
190 #[unsafe(method(shapeByApplyingInset:))]
199 #[unsafe(method_family = none)]
200 pub fn shapeByApplyingInset(&self, inset: CGFloat) -> Retained<UIShape>;
201
202 #[unsafe(method(resolvedShapeInContext:))]
204 #[unsafe(method_family = none)]
205 pub fn resolvedShapeInContext(
206 &self,
207 context: &UIShapeResolutionContext,
208 ) -> Retained<UIResolvedShape>;
209
210 #[unsafe(method(init))]
211 #[unsafe(method_family = init)]
212 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
213
214 #[unsafe(method(new))]
215 #[unsafe(method_family = new)]
216 pub unsafe fn new() -> Retained<Self>;
217 );
218}
219
220extern_class!(
221 #[unsafe(super(NSObject))]
225 #[derive(Debug, PartialEq, Eq, Hash)]
226 pub struct UIResolvedShape;
227);
228
229extern_conformance!(
230 unsafe impl NSCopying for UIResolvedShape {}
231);
232
233unsafe impl CopyingHelper for UIResolvedShape {
234 type Result = Self;
235}
236
237extern_conformance!(
238 unsafe impl NSObjectProtocol for UIResolvedShape {}
239);
240
241impl UIResolvedShape {
242 extern_methods!(
243 #[unsafe(method(shape))]
245 #[unsafe(method_family = none)]
246 pub fn shape(&self) -> Retained<UIShape>;
247
248 #[cfg(feature = "objc2-core-foundation")]
249 #[unsafe(method(boundingRect))]
251 #[unsafe(method_family = none)]
252 pub fn boundingRect(&self) -> CGRect;
253
254 #[cfg(feature = "UIBezierPath")]
255 #[unsafe(method(path))]
257 #[unsafe(method_family = none)]
258 pub fn path(&self) -> Retained<UIBezierPath>;
259
260 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
261 #[unsafe(method(shapeByApplyingInsets:))]
270 #[unsafe(method_family = none)]
271 pub fn shapeByApplyingInsets(&self, insets: UIEdgeInsets) -> Retained<UIResolvedShape>;
272
273 #[cfg(feature = "objc2-core-foundation")]
274 #[unsafe(method(shapeByApplyingInset:))]
283 #[unsafe(method_family = none)]
284 pub fn shapeByApplyingInset(&self, inset: CGFloat) -> Retained<UIResolvedShape>;
285
286 #[unsafe(method(init))]
287 #[unsafe(method_family = init)]
288 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
289
290 #[unsafe(method(new))]
291 #[unsafe(method_family = new)]
292 pub unsafe fn new() -> Retained<Self>;
293 );
294}
295
296extern_class!(
297 #[unsafe(super(NSObject))]
301 #[derive(Debug, PartialEq, Eq, Hash)]
302 pub struct UIShapeResolutionContext;
303);
304
305extern_conformance!(
306 unsafe impl NSObjectProtocol for UIShapeResolutionContext {}
307);
308
309impl UIShapeResolutionContext {
310 extern_methods!(
311 #[unsafe(method(contentShape))]
317 #[unsafe(method_family = none)]
318 pub fn contentShape(&self) -> Retained<UIResolvedShape>;
319
320 #[unsafe(method(init))]
321 #[unsafe(method_family = init)]
322 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
323
324 #[unsafe(method(new))]
325 #[unsafe(method_family = new)]
326 pub unsafe fn new() -> Retained<Self>;
327 );
328}