objc2_ui_kit/generated/
UIDynamicBehavior.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use 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/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidynamicitemcollisionboundstype?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UIDynamicItemCollisionBoundsType(pub NSUInteger);
17impl UIDynamicItemCollisionBoundsType {
18    #[doc(alias = "UIDynamicItemCollisionBoundsTypeRectangle")]
19    pub const Rectangle: Self = Self(0);
20    #[doc(alias = "UIDynamicItemCollisionBoundsTypeEllipse")]
21    pub const Ellipse: Self = Self(1);
22    #[doc(alias = "UIDynamicItemCollisionBoundsTypePath")]
23    pub const Path: Self = Self(2);
24}
25
26unsafe impl Encode for UIDynamicItemCollisionBoundsType {
27    const ENCODING: Encoding = NSUInteger::ENCODING;
28}
29
30unsafe impl RefEncode for UIDynamicItemCollisionBoundsType {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34extern_protocol!(
35    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidynamicitem?language=objc)
36    pub unsafe trait UIDynamicItem: NSObjectProtocol + MainThreadOnly {
37        #[cfg(feature = "objc2-core-foundation")]
38        #[unsafe(method(center))]
39        #[unsafe(method_family = none)]
40        unsafe fn center(&self) -> CGPoint;
41
42        #[cfg(feature = "objc2-core-foundation")]
43        /// Setter for [`center`][Self::center].
44        #[unsafe(method(setCenter:))]
45        #[unsafe(method_family = none)]
46        unsafe fn setCenter(&self, center: CGPoint);
47
48        #[cfg(feature = "objc2-core-foundation")]
49        #[unsafe(method(bounds))]
50        #[unsafe(method_family = none)]
51        unsafe fn bounds(&self) -> CGRect;
52
53        #[cfg(feature = "objc2-core-foundation")]
54        #[unsafe(method(transform))]
55        #[unsafe(method_family = none)]
56        unsafe fn transform(&self) -> CGAffineTransform;
57
58        #[cfg(feature = "objc2-core-foundation")]
59        /// Setter for [`transform`][Self::transform].
60        #[unsafe(method(setTransform:))]
61        #[unsafe(method_family = none)]
62        unsafe fn setTransform(&self, transform: CGAffineTransform);
63
64        /// The collision type represents how the dynamics system will evaluate collisions with
65        /// respect to the dynamic item. defaults to UIDynamicItemCollisionBoundsTypeRectangle
66        #[optional]
67        #[unsafe(method(collisionBoundsType))]
68        #[unsafe(method_family = none)]
69        unsafe fn collisionBoundsType(&self) -> UIDynamicItemCollisionBoundsType;
70
71        #[cfg(feature = "UIBezierPath")]
72        /// The path must represent a convex polygon with counter clockwise winding and no self intersection.
73        /// The point (0,0) in the path corresponds to the dynamic item's center.
74        #[optional]
75        #[unsafe(method(collisionBoundingPath))]
76        #[unsafe(method_family = none)]
77        unsafe fn collisionBoundingPath(&self) -> Retained<UIBezierPath>;
78    }
79);
80
81extern_class!(
82    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidynamicitemgroup?language=objc)
83    #[unsafe(super(NSObject))]
84    #[thread_kind = MainThreadOnly]
85    #[derive(Debug, PartialEq, Eq, Hash)]
86    pub struct UIDynamicItemGroup;
87);
88
89extern_conformance!(
90    unsafe impl NSObjectProtocol for UIDynamicItemGroup {}
91);
92
93extern_conformance!(
94    unsafe impl UIDynamicItem for UIDynamicItemGroup {}
95);
96
97impl UIDynamicItemGroup {
98    extern_methods!(
99        #[unsafe(method(initWithItems:))]
100        #[unsafe(method_family = init)]
101        pub unsafe fn initWithItems(
102            this: Allocated<Self>,
103            items: &NSArray<ProtocolObject<dyn UIDynamicItem>>,
104        ) -> Retained<Self>;
105
106        #[unsafe(method(items))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn items(&self) -> Retained<NSArray<ProtocolObject<dyn UIDynamicItem>>>;
109    );
110}
111
112/// Methods declared on superclass `NSObject`.
113impl UIDynamicItemGroup {
114    extern_methods!(
115        #[unsafe(method(init))]
116        #[unsafe(method_family = init)]
117        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
118
119        #[unsafe(method(new))]
120        #[unsafe(method_family = new)]
121        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
122    );
123}
124
125extern_class!(
126    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidynamicbehavior?language=objc)
127    #[unsafe(super(NSObject))]
128    #[thread_kind = MainThreadOnly]
129    #[derive(Debug, PartialEq, Eq, Hash)]
130    pub struct UIDynamicBehavior;
131);
132
133extern_conformance!(
134    unsafe impl NSObjectProtocol for UIDynamicBehavior {}
135);
136
137impl UIDynamicBehavior {
138    extern_methods!(
139        #[unsafe(method(addChildBehavior:))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn addChildBehavior(&self, behavior: &UIDynamicBehavior);
142
143        #[unsafe(method(removeChildBehavior:))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn removeChildBehavior(&self, behavior: &UIDynamicBehavior);
146
147        #[unsafe(method(childBehaviors))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn childBehaviors(&self) -> Retained<NSArray<UIDynamicBehavior>>;
150
151        #[cfg(feature = "block2")]
152        #[unsafe(method(action))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn action(&self) -> *mut block2::DynBlock<dyn Fn()>;
155
156        #[cfg(feature = "block2")]
157        /// Setter for [`action`][Self::action].
158        #[unsafe(method(setAction:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn setAction(&self, action: Option<&block2::DynBlock<dyn Fn()>>);
161
162        #[cfg(feature = "UIDynamicAnimator")]
163        #[unsafe(method(willMoveToAnimator:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn willMoveToAnimator(&self, dynamic_animator: Option<&UIDynamicAnimator>);
166
167        #[cfg(feature = "UIDynamicAnimator")]
168        #[unsafe(method(dynamicAnimator))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn dynamicAnimator(&self) -> Option<Retained<UIDynamicAnimator>>;
171    );
172}
173
174/// Methods declared on superclass `NSObject`.
175impl UIDynamicBehavior {
176    extern_methods!(
177        #[unsafe(method(init))]
178        #[unsafe(method_family = init)]
179        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
180
181        #[unsafe(method(new))]
182        #[unsafe(method_family = new)]
183        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
184    );
185}