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