objc2_ui_kit/generated/
UIAttachmentBehavior.rs1use 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#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UIAttachmentBehaviorType(pub NSInteger);
17impl UIAttachmentBehaviorType {
18 #[doc(alias = "UIAttachmentBehaviorTypeItems")]
19 pub const Items: Self = Self(0);
20 #[doc(alias = "UIAttachmentBehaviorTypeAnchor")]
21 pub const Anchor: Self = Self(1);
22}
23
24unsafe impl Encode for UIAttachmentBehaviorType {
25 const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for UIAttachmentBehaviorType {
29 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32#[cfg(feature = "objc2-core-foundation")]
34#[repr(C)]
35#[derive(Clone, Copy, Debug, PartialEq)]
36pub struct UIFloatRange {
37 pub minimum: CGFloat,
38 pub maximum: CGFloat,
39}
40
41#[cfg(feature = "objc2-core-foundation")]
42unsafe impl Encode for UIFloatRange {
43 const ENCODING: Encoding = Encoding::Struct("?", &[<CGFloat>::ENCODING, <CGFloat>::ENCODING]);
44}
45
46#[cfg(feature = "objc2-core-foundation")]
47unsafe impl RefEncode for UIFloatRange {
48 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
49}
50
51#[cfg(feature = "objc2-core-foundation")]
52unsafe impl Send for UIFloatRange {}
53
54#[cfg(feature = "objc2-core-foundation")]
55unsafe impl Sync for UIFloatRange {}
56
57extern "C" {
58 #[cfg(feature = "objc2-core-foundation")]
60 pub static UIFloatRangeZero: UIFloatRange;
61}
62
63extern "C" {
64 #[cfg(feature = "objc2-core-foundation")]
66 pub static UIFloatRangeInfinite: UIFloatRange;
67}
68
69#[cfg(feature = "objc2-core-foundation")]
70impl UIFloatRange {
71 #[doc(alias = "UIFloatRangeIsInfinite")]
72 #[cfg(feature = "objc2-core-foundation")]
73 #[inline]
74 pub fn is_infinite(self) -> bool {
75 extern "C-unwind" {
76 fn UIFloatRangeIsInfinite(range: UIFloatRange) -> Bool;
77 }
78 unsafe { UIFloatRangeIsInfinite(self) }.as_bool()
79 }
80
81 }
85
86extern_class!(
87 #[unsafe(super(UIDynamicBehavior, NSObject))]
89 #[thread_kind = MainThreadOnly]
90 #[derive(Debug, PartialEq, Eq, Hash)]
91 #[cfg(feature = "UIDynamicBehavior")]
92 pub struct UIAttachmentBehavior;
93);
94
95#[cfg(feature = "UIDynamicBehavior")]
96extern_conformance!(
97 unsafe impl NSObjectProtocol for UIAttachmentBehavior {}
98);
99
100#[cfg(feature = "UIDynamicBehavior")]
101impl UIAttachmentBehavior {
102 extern_methods!(
103 #[cfg(feature = "objc2-core-foundation")]
104 #[unsafe(method(initWithItem:attachedToAnchor:))]
105 #[unsafe(method_family = init)]
106 pub fn initWithItem_attachedToAnchor(
107 this: Allocated<Self>,
108 item: &ProtocolObject<dyn UIDynamicItem>,
109 point: CGPoint,
110 ) -> Retained<Self>;
111
112 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
113 #[unsafe(method(initWithItem:offsetFromCenter:attachedToAnchor:))]
114 #[unsafe(method_family = init)]
115 pub fn initWithItem_offsetFromCenter_attachedToAnchor(
116 this: Allocated<Self>,
117 item: &ProtocolObject<dyn UIDynamicItem>,
118 offset: UIOffset,
119 point: CGPoint,
120 ) -> Retained<Self>;
121
122 #[unsafe(method(initWithItem:attachedToItem:))]
123 #[unsafe(method_family = init)]
124 pub fn initWithItem_attachedToItem(
125 this: Allocated<Self>,
126 item1: &ProtocolObject<dyn UIDynamicItem>,
127 item2: &ProtocolObject<dyn UIDynamicItem>,
128 ) -> Retained<Self>;
129
130 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
131 #[unsafe(method(initWithItem:offsetFromCenter:attachedToItem:offsetFromCenter:))]
132 #[unsafe(method_family = init)]
133 pub fn initWithItem_offsetFromCenter_attachedToItem_offsetFromCenter(
134 this: Allocated<Self>,
135 item1: &ProtocolObject<dyn UIDynamicItem>,
136 offset1: UIOffset,
137 item2: &ProtocolObject<dyn UIDynamicItem>,
138 offset2: UIOffset,
139 ) -> Retained<Self>;
140
141 #[cfg(feature = "objc2-core-foundation")]
142 #[unsafe(method(slidingAttachmentWithItem:attachedToItem:attachmentAnchor:axisOfTranslation:))]
155 #[unsafe(method_family = none)]
156 pub fn slidingAttachmentWithItem_attachedToItem_attachmentAnchor_axisOfTranslation(
157 item1: &ProtocolObject<dyn UIDynamicItem>,
158 item2: &ProtocolObject<dyn UIDynamicItem>,
159 point: CGPoint,
160 axis: CGVector,
161 ) -> Retained<Self>;
162
163 #[cfg(feature = "objc2-core-foundation")]
164 #[unsafe(method(slidingAttachmentWithItem:attachmentAnchor:axisOfTranslation:))]
175 #[unsafe(method_family = none)]
176 pub fn slidingAttachmentWithItem_attachmentAnchor_axisOfTranslation(
177 item: &ProtocolObject<dyn UIDynamicItem>,
178 point: CGPoint,
179 axis: CGVector,
180 ) -> Retained<Self>;
181
182 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
183 #[unsafe(method(limitAttachmentWithItem:offsetFromCenter:attachedToItem:offsetFromCenter:))]
195 #[unsafe(method_family = none)]
196 pub fn limitAttachmentWithItem_offsetFromCenter_attachedToItem_offsetFromCenter(
197 item1: &ProtocolObject<dyn UIDynamicItem>,
198 offset1: UIOffset,
199 item2: &ProtocolObject<dyn UIDynamicItem>,
200 offset2: UIOffset,
201 ) -> Retained<Self>;
202
203 #[cfg(feature = "objc2-core-foundation")]
204 #[unsafe(method(fixedAttachmentWithItem:attachedToItem:attachmentAnchor:))]
213 #[unsafe(method_family = none)]
214 pub fn fixedAttachmentWithItem_attachedToItem_attachmentAnchor(
215 item1: &ProtocolObject<dyn UIDynamicItem>,
216 item2: &ProtocolObject<dyn UIDynamicItem>,
217 point: CGPoint,
218 ) -> Retained<Self>;
219
220 #[cfg(feature = "objc2-core-foundation")]
221 #[unsafe(method(pinAttachmentWithItem:attachedToItem:attachmentAnchor:))]
232 #[unsafe(method_family = none)]
233 pub fn pinAttachmentWithItem_attachedToItem_attachmentAnchor(
234 item1: &ProtocolObject<dyn UIDynamicItem>,
235 item2: &ProtocolObject<dyn UIDynamicItem>,
236 point: CGPoint,
237 ) -> Retained<Self>;
238
239 #[unsafe(method(items))]
240 #[unsafe(method_family = none)]
241 pub fn items(&self) -> Retained<NSArray<ProtocolObject<dyn UIDynamicItem>>>;
242
243 #[unsafe(method(attachedBehaviorType))]
244 #[unsafe(method_family = none)]
245 pub fn attachedBehaviorType(&self) -> UIAttachmentBehaviorType;
246
247 #[cfg(feature = "objc2-core-foundation")]
248 #[unsafe(method(anchorPoint))]
249 #[unsafe(method_family = none)]
250 pub fn anchorPoint(&self) -> CGPoint;
251
252 #[cfg(feature = "objc2-core-foundation")]
253 #[unsafe(method(setAnchorPoint:))]
255 #[unsafe(method_family = none)]
256 pub fn setAnchorPoint(&self, anchor_point: CGPoint);
257
258 #[cfg(feature = "objc2-core-foundation")]
259 #[unsafe(method(length))]
260 #[unsafe(method_family = none)]
261 pub fn length(&self) -> CGFloat;
262
263 #[cfg(feature = "objc2-core-foundation")]
264 #[unsafe(method(setLength:))]
266 #[unsafe(method_family = none)]
267 pub fn setLength(&self, length: CGFloat);
268
269 #[cfg(feature = "objc2-core-foundation")]
270 #[unsafe(method(damping))]
271 #[unsafe(method_family = none)]
272 pub fn damping(&self) -> CGFloat;
273
274 #[cfg(feature = "objc2-core-foundation")]
275 #[unsafe(method(setDamping:))]
277 #[unsafe(method_family = none)]
278 pub fn setDamping(&self, damping: CGFloat);
279
280 #[cfg(feature = "objc2-core-foundation")]
281 #[unsafe(method(frequency))]
282 #[unsafe(method_family = none)]
283 pub fn frequency(&self) -> CGFloat;
284
285 #[cfg(feature = "objc2-core-foundation")]
286 #[unsafe(method(setFrequency:))]
288 #[unsafe(method_family = none)]
289 pub fn setFrequency(&self, frequency: CGFloat);
290
291 #[cfg(feature = "objc2-core-foundation")]
292 #[unsafe(method(frictionTorque))]
293 #[unsafe(method_family = none)]
294 pub fn frictionTorque(&self) -> CGFloat;
295
296 #[cfg(feature = "objc2-core-foundation")]
297 #[unsafe(method(setFrictionTorque:))]
299 #[unsafe(method_family = none)]
300 pub fn setFrictionTorque(&self, friction_torque: CGFloat);
301
302 #[cfg(feature = "objc2-core-foundation")]
303 #[unsafe(method(attachmentRange))]
304 #[unsafe(method_family = none)]
305 pub fn attachmentRange(&self) -> UIFloatRange;
306
307 #[cfg(feature = "objc2-core-foundation")]
308 #[unsafe(method(setAttachmentRange:))]
310 #[unsafe(method_family = none)]
311 pub fn setAttachmentRange(&self, attachment_range: UIFloatRange);
312 );
313}
314
315#[cfg(feature = "UIDynamicBehavior")]
317impl UIAttachmentBehavior {
318 extern_methods!(
319 #[unsafe(method(init))]
320 #[unsafe(method_family = init)]
321 pub fn init(this: Allocated<Self>) -> Retained<Self>;
322
323 #[unsafe(method(new))]
324 #[unsafe(method_family = new)]
325 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
326 );
327}
328
329#[cfg(feature = "objc2-core-foundation")]
330#[deprecated = "renamed to `UIFloatRange::is_infinite`"]
331#[inline]
332pub extern "C-unwind" fn UIFloatRangeIsInfinite(range: UIFloatRange) -> bool {
333 extern "C-unwind" {
334 fn UIFloatRangeIsInfinite(range: UIFloatRange) -> Bool;
335 }
336 unsafe { UIFloatRangeIsInfinite(range) }.as_bool()
337}