objc2_ui_kit/generated/
UIDynamicAnimator.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
12extern_protocol!(
13 pub unsafe trait UIDynamicAnimatorDelegate: NSObjectProtocol + MainThreadOnly {
15 #[optional]
16 #[unsafe(method(dynamicAnimatorWillResume:))]
17 #[unsafe(method_family = none)]
18 unsafe fn dynamicAnimatorWillResume(&self, animator: &UIDynamicAnimator);
19
20 #[optional]
21 #[unsafe(method(dynamicAnimatorDidPause:))]
22 #[unsafe(method_family = none)]
23 unsafe fn dynamicAnimatorDidPause(&self, animator: &UIDynamicAnimator);
24 }
25);
26
27extern_class!(
28 #[unsafe(super(NSObject))]
30 #[derive(Debug, PartialEq, Eq, Hash)]
31 pub struct UIDynamicAnimator;
32);
33
34extern_conformance!(
35 unsafe impl NSObjectProtocol for UIDynamicAnimator {}
36);
37
38impl UIDynamicAnimator {
39 extern_methods!(
40 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
41 #[unsafe(method(initWithReferenceView:))]
42 #[unsafe(method_family = init)]
43 pub unsafe fn initWithReferenceView(this: Allocated<Self>, view: &UIView)
44 -> Retained<Self>;
45
46 #[cfg(feature = "UIDynamicBehavior")]
47 #[unsafe(method(addBehavior:))]
48 #[unsafe(method_family = none)]
49 pub unsafe fn addBehavior(&self, behavior: &UIDynamicBehavior);
50
51 #[cfg(feature = "UIDynamicBehavior")]
52 #[unsafe(method(removeBehavior:))]
53 #[unsafe(method_family = none)]
54 pub unsafe fn removeBehavior(&self, behavior: &UIDynamicBehavior);
55
56 #[unsafe(method(removeAllBehaviors))]
57 #[unsafe(method_family = none)]
58 pub unsafe fn removeAllBehaviors(&self);
59
60 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
61 #[unsafe(method(referenceView))]
62 #[unsafe(method_family = none)]
63 pub unsafe fn referenceView(&self, mtm: MainThreadMarker) -> Option<Retained<UIView>>;
64
65 #[cfg(feature = "UIDynamicBehavior")]
66 #[unsafe(method(behaviors))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn behaviors(
69 &self,
70 mtm: MainThreadMarker,
71 ) -> Retained<NSArray<UIDynamicBehavior>>;
72
73 #[cfg(all(feature = "UIDynamicBehavior", feature = "objc2-core-foundation"))]
74 #[unsafe(method(itemsInRect:))]
75 #[unsafe(method_family = none)]
76 pub unsafe fn itemsInRect(
77 &self,
78 rect: CGRect,
79 mtm: MainThreadMarker,
80 ) -> Retained<NSArray<ProtocolObject<dyn UIDynamicItem>>>;
81
82 #[cfg(feature = "UIDynamicBehavior")]
83 #[unsafe(method(updateItemUsingCurrentState:))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn updateItemUsingCurrentState(&self, item: &ProtocolObject<dyn UIDynamicItem>);
86
87 #[unsafe(method(isRunning))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn isRunning(&self) -> bool;
90
91 #[unsafe(method(elapsedTime))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn elapsedTime(&self) -> NSTimeInterval;
94
95 #[unsafe(method(delegate))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn delegate(
98 &self,
99 mtm: MainThreadMarker,
100 ) -> Option<Retained<ProtocolObject<dyn UIDynamicAnimatorDelegate>>>;
101
102 #[unsafe(method(setDelegate:))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn setDelegate(
107 &self,
108 delegate: Option<&ProtocolObject<dyn UIDynamicAnimatorDelegate>>,
109 );
110 );
111}
112
113impl UIDynamicAnimator {
115 extern_methods!(
116 #[unsafe(method(init))]
117 #[unsafe(method_family = init)]
118 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
119
120 #[unsafe(method(new))]
121 #[unsafe(method_family = new)]
122 pub unsafe fn new() -> Retained<Self>;
123 );
124}
125
126impl UIDynamicAnimator {
128 extern_methods!(
129 #[cfg(feature = "UICollectionViewLayout")]
130 #[unsafe(method(initWithCollectionViewLayout:))]
131 #[unsafe(method_family = init)]
132 pub unsafe fn initWithCollectionViewLayout(
133 this: Allocated<Self>,
134 layout: &UICollectionViewLayout,
135 ) -> Retained<Self>;
136
137 #[cfg(feature = "UICollectionViewLayout")]
138 #[unsafe(method(layoutAttributesForCellAtIndexPath:))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn layoutAttributesForCellAtIndexPath(
141 &self,
142 index_path: &NSIndexPath,
143 mtm: MainThreadMarker,
144 ) -> Option<Retained<UICollectionViewLayoutAttributes>>;
145
146 #[cfg(feature = "UICollectionViewLayout")]
147 #[unsafe(method(layoutAttributesForSupplementaryViewOfKind:atIndexPath:))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn layoutAttributesForSupplementaryViewOfKind_atIndexPath(
150 &self,
151 kind: &NSString,
152 index_path: &NSIndexPath,
153 mtm: MainThreadMarker,
154 ) -> Option<Retained<UICollectionViewLayoutAttributes>>;
155
156 #[cfg(feature = "UICollectionViewLayout")]
157 #[unsafe(method(layoutAttributesForDecorationViewOfKind:atIndexPath:))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn layoutAttributesForDecorationViewOfKind_atIndexPath(
160 &self,
161 decoration_view_kind: &NSString,
162 index_path: &NSIndexPath,
163 mtm: MainThreadMarker,
164 ) -> Option<Retained<UICollectionViewLayoutAttributes>>;
165 );
166}