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")]
70#[inline]
71pub unsafe extern "C-unwind" fn UIFloatRangeIsInfinite(range: UIFloatRange) -> bool {
72 extern "C-unwind" {
73 fn UIFloatRangeIsInfinite(range: UIFloatRange) -> Bool;
74 }
75 unsafe { UIFloatRangeIsInfinite(range) }.as_bool()
76}
77
78extern_class!(
83 #[unsafe(super(UIDynamicBehavior, NSObject))]
85 #[thread_kind = MainThreadOnly]
86 #[derive(Debug, PartialEq, Eq, Hash)]
87 #[cfg(feature = "UIDynamicBehavior")]
88 pub struct UIAttachmentBehavior;
89);
90
91#[cfg(feature = "UIDynamicBehavior")]
92unsafe impl NSObjectProtocol for UIAttachmentBehavior {}
93
94#[cfg(feature = "UIDynamicBehavior")]
95impl UIAttachmentBehavior {
96 extern_methods!(
97 #[cfg(feature = "objc2-core-foundation")]
98 #[unsafe(method(initWithItem:attachedToAnchor:))]
99 #[unsafe(method_family = init)]
100 pub unsafe fn initWithItem_attachedToAnchor(
101 this: Allocated<Self>,
102 item: &ProtocolObject<dyn UIDynamicItem>,
103 point: CGPoint,
104 ) -> Retained<Self>;
105
106 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
107 #[unsafe(method(initWithItem:offsetFromCenter:attachedToAnchor:))]
108 #[unsafe(method_family = init)]
109 pub unsafe fn initWithItem_offsetFromCenter_attachedToAnchor(
110 this: Allocated<Self>,
111 item: &ProtocolObject<dyn UIDynamicItem>,
112 offset: UIOffset,
113 point: CGPoint,
114 ) -> Retained<Self>;
115
116 #[unsafe(method(initWithItem:attachedToItem:))]
117 #[unsafe(method_family = init)]
118 pub unsafe fn initWithItem_attachedToItem(
119 this: Allocated<Self>,
120 item1: &ProtocolObject<dyn UIDynamicItem>,
121 item2: &ProtocolObject<dyn UIDynamicItem>,
122 ) -> Retained<Self>;
123
124 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
125 #[unsafe(method(initWithItem:offsetFromCenter:attachedToItem:offsetFromCenter:))]
126 #[unsafe(method_family = init)]
127 pub unsafe fn initWithItem_offsetFromCenter_attachedToItem_offsetFromCenter(
128 this: Allocated<Self>,
129 item1: &ProtocolObject<dyn UIDynamicItem>,
130 offset1: UIOffset,
131 item2: &ProtocolObject<dyn UIDynamicItem>,
132 offset2: UIOffset,
133 ) -> Retained<Self>;
134
135 #[cfg(feature = "objc2-core-foundation")]
136 #[unsafe(method(slidingAttachmentWithItem:attachedToItem:attachmentAnchor:axisOfTranslation:))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn slidingAttachmentWithItem_attachedToItem_attachmentAnchor_axisOfTranslation(
151 item1: &ProtocolObject<dyn UIDynamicItem>,
152 item2: &ProtocolObject<dyn UIDynamicItem>,
153 point: CGPoint,
154 axis: CGVector,
155 ) -> Retained<Self>;
156
157 #[cfg(feature = "objc2-core-foundation")]
158 #[unsafe(method(slidingAttachmentWithItem:attachmentAnchor:axisOfTranslation:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn slidingAttachmentWithItem_attachmentAnchor_axisOfTranslation(
171 item: &ProtocolObject<dyn UIDynamicItem>,
172 point: CGPoint,
173 axis: CGVector,
174 ) -> Retained<Self>;
175
176 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
177 #[unsafe(method(limitAttachmentWithItem:offsetFromCenter:attachedToItem:offsetFromCenter:))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn limitAttachmentWithItem_offsetFromCenter_attachedToItem_offsetFromCenter(
191 item1: &ProtocolObject<dyn UIDynamicItem>,
192 offset1: UIOffset,
193 item2: &ProtocolObject<dyn UIDynamicItem>,
194 offset2: UIOffset,
195 ) -> Retained<Self>;
196
197 #[cfg(feature = "objc2-core-foundation")]
198 #[unsafe(method(fixedAttachmentWithItem:attachedToItem:attachmentAnchor:))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn fixedAttachmentWithItem_attachedToItem_attachmentAnchor(
209 item1: &ProtocolObject<dyn UIDynamicItem>,
210 item2: &ProtocolObject<dyn UIDynamicItem>,
211 point: CGPoint,
212 ) -> Retained<Self>;
213
214 #[cfg(feature = "objc2-core-foundation")]
215 #[unsafe(method(pinAttachmentWithItem:attachedToItem:attachmentAnchor:))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn pinAttachmentWithItem_attachedToItem_attachmentAnchor(
228 item1: &ProtocolObject<dyn UIDynamicItem>,
229 item2: &ProtocolObject<dyn UIDynamicItem>,
230 point: CGPoint,
231 ) -> Retained<Self>;
232
233 #[unsafe(method(items))]
234 #[unsafe(method_family = none)]
235 pub unsafe fn items(&self) -> Retained<NSArray<ProtocolObject<dyn UIDynamicItem>>>;
236
237 #[unsafe(method(attachedBehaviorType))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn attachedBehaviorType(&self) -> UIAttachmentBehaviorType;
240
241 #[cfg(feature = "objc2-core-foundation")]
242 #[unsafe(method(anchorPoint))]
243 #[unsafe(method_family = none)]
244 pub unsafe fn anchorPoint(&self) -> CGPoint;
245
246 #[cfg(feature = "objc2-core-foundation")]
247 #[unsafe(method(setAnchorPoint:))]
249 #[unsafe(method_family = none)]
250 pub unsafe fn setAnchorPoint(&self, anchor_point: CGPoint);
251
252 #[cfg(feature = "objc2-core-foundation")]
253 #[unsafe(method(length))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn length(&self) -> CGFloat;
256
257 #[cfg(feature = "objc2-core-foundation")]
258 #[unsafe(method(setLength:))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn setLength(&self, length: CGFloat);
262
263 #[cfg(feature = "objc2-core-foundation")]
264 #[unsafe(method(damping))]
265 #[unsafe(method_family = none)]
266 pub unsafe fn damping(&self) -> CGFloat;
267
268 #[cfg(feature = "objc2-core-foundation")]
269 #[unsafe(method(setDamping:))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn setDamping(&self, damping: CGFloat);
273
274 #[cfg(feature = "objc2-core-foundation")]
275 #[unsafe(method(frequency))]
276 #[unsafe(method_family = none)]
277 pub unsafe fn frequency(&self) -> CGFloat;
278
279 #[cfg(feature = "objc2-core-foundation")]
280 #[unsafe(method(setFrequency:))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn setFrequency(&self, frequency: CGFloat);
284
285 #[cfg(feature = "objc2-core-foundation")]
286 #[unsafe(method(frictionTorque))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn frictionTorque(&self) -> CGFloat;
289
290 #[cfg(feature = "objc2-core-foundation")]
291 #[unsafe(method(setFrictionTorque:))]
293 #[unsafe(method_family = none)]
294 pub unsafe fn setFrictionTorque(&self, friction_torque: CGFloat);
295
296 #[cfg(feature = "objc2-core-foundation")]
297 #[unsafe(method(attachmentRange))]
298 #[unsafe(method_family = none)]
299 pub unsafe fn attachmentRange(&self) -> UIFloatRange;
300
301 #[cfg(feature = "objc2-core-foundation")]
302 #[unsafe(method(setAttachmentRange:))]
304 #[unsafe(method_family = none)]
305 pub unsafe fn setAttachmentRange(&self, attachment_range: UIFloatRange);
306 );
307}
308
309#[cfg(feature = "UIDynamicBehavior")]
311impl UIAttachmentBehavior {
312 extern_methods!(
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(mtm: MainThreadMarker) -> Retained<Self>;
320 );
321}