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        fn dynamicAnimatorWillResume(&self, animator: &UIDynamicAnimator);
19
20        #[optional]
21        #[unsafe(method(dynamicAnimatorDidPause:))]
22        #[unsafe(method_family = none)]
23        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
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 fn initWithReferenceView(this: Allocated<Self>, view: &UIView) -> Retained<Self>;
44
45        #[cfg(feature = "UIDynamicBehavior")]
46        #[unsafe(method(addBehavior:))]
47        #[unsafe(method_family = none)]
48        pub fn addBehavior(&self, behavior: &UIDynamicBehavior);
49
50        #[cfg(feature = "UIDynamicBehavior")]
51        #[unsafe(method(removeBehavior:))]
52        #[unsafe(method_family = none)]
53        pub fn removeBehavior(&self, behavior: &UIDynamicBehavior);
54
55        #[unsafe(method(removeAllBehaviors))]
56        #[unsafe(method_family = none)]
57        pub fn removeAllBehaviors(&self);
58
59        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
60        #[unsafe(method(referenceView))]
61        #[unsafe(method_family = none)]
62        pub fn referenceView(&self, mtm: MainThreadMarker) -> Option<Retained<UIView>>;
63
64        #[cfg(feature = "UIDynamicBehavior")]
65        #[unsafe(method(behaviors))]
66        #[unsafe(method_family = none)]
67        pub fn behaviors(&self, mtm: MainThreadMarker) -> Retained<NSArray<UIDynamicBehavior>>;
68
69        #[cfg(all(feature = "UIDynamicBehavior", feature = "objc2-core-foundation"))]
70        #[unsafe(method(itemsInRect:))]
71        #[unsafe(method_family = none)]
72        pub fn itemsInRect(
73            &self,
74            rect: CGRect,
75            mtm: MainThreadMarker,
76        ) -> Retained<NSArray<ProtocolObject<dyn UIDynamicItem>>>;
77
78        #[cfg(feature = "UIDynamicBehavior")]
79        #[unsafe(method(updateItemUsingCurrentState:))]
80        #[unsafe(method_family = none)]
81        pub fn updateItemUsingCurrentState(&self, item: &ProtocolObject<dyn UIDynamicItem>);
82
83        #[unsafe(method(isRunning))]
84        #[unsafe(method_family = none)]
85        pub fn isRunning(&self) -> bool;
86
87        #[unsafe(method(elapsedTime))]
88        #[unsafe(method_family = none)]
89        pub fn elapsedTime(&self) -> NSTimeInterval;
90
91        #[unsafe(method(delegate))]
92        #[unsafe(method_family = none)]
93        pub fn delegate(
94            &self,
95            mtm: MainThreadMarker,
96        ) -> Option<Retained<ProtocolObject<dyn UIDynamicAnimatorDelegate>>>;
97
98        /// Setter for [`delegate`][Self::delegate].
99        ///
100        /// This is a [weak property][objc2::topics::weak_property].
101        #[unsafe(method(setDelegate:))]
102        #[unsafe(method_family = none)]
103        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UIDynamicAnimatorDelegate>>);
104    );
105}
106
107/// Methods declared on superclass `NSObject`.
108impl UIDynamicAnimator {
109    extern_methods!(
110        #[unsafe(method(init))]
111        #[unsafe(method_family = init)]
112        pub fn init(this: Allocated<Self>) -> Retained<Self>;
113
114        #[unsafe(method(new))]
115        #[unsafe(method_family = new)]
116        pub fn new() -> Retained<Self>;
117    );
118}
119
120impl DefaultRetained for UIDynamicAnimator {
121    #[inline]
122    fn default_retained() -> Retained<Self> {
123        Self::new()
124    }
125}
126
127/// UICollectionViewAdditions.
128impl UIDynamicAnimator {
129    extern_methods!(
130        #[cfg(feature = "UICollectionViewLayout")]
131        #[unsafe(method(initWithCollectionViewLayout:))]
132        #[unsafe(method_family = init)]
133        pub fn initWithCollectionViewLayout(
134            this: Allocated<Self>,
135            layout: &UICollectionViewLayout,
136        ) -> Retained<Self>;
137
138        #[cfg(feature = "UICollectionViewLayout")]
139        #[unsafe(method(layoutAttributesForCellAtIndexPath:))]
140        #[unsafe(method_family = none)]
141        pub fn layoutAttributesForCellAtIndexPath(
142            &self,
143            index_path: &NSIndexPath,
144            mtm: MainThreadMarker,
145        ) -> Option<Retained<UICollectionViewLayoutAttributes>>;
146
147        #[cfg(feature = "UICollectionViewLayout")]
148        #[unsafe(method(layoutAttributesForSupplementaryViewOfKind:atIndexPath:))]
149        #[unsafe(method_family = none)]
150        pub fn layoutAttributesForSupplementaryViewOfKind_atIndexPath(
151            &self,
152            kind: &NSString,
153            index_path: &NSIndexPath,
154            mtm: MainThreadMarker,
155        ) -> Option<Retained<UICollectionViewLayoutAttributes>>;
156
157        #[cfg(feature = "UICollectionViewLayout")]
158        #[unsafe(method(layoutAttributesForDecorationViewOfKind:atIndexPath:))]
159        #[unsafe(method_family = none)]
160        pub fn layoutAttributesForDecorationViewOfKind_atIndexPath(
161            &self,
162            decoration_view_kind: &NSString,
163            index_path: &NSIndexPath,
164            mtm: MainThreadMarker,
165        ) -> Option<Retained<UICollectionViewLayoutAttributes>>;
166    );
167}