objc2_ui_kit/generated/
UIDynamicItemBehavior.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_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidynamicitembehavior?language=objc)
14    #[unsafe(super(UIDynamicBehavior, NSObject))]
15    #[thread_kind = MainThreadOnly]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[cfg(feature = "UIDynamicBehavior")]
18    pub struct UIDynamicItemBehavior;
19);
20
21#[cfg(feature = "UIDynamicBehavior")]
22unsafe impl NSObjectProtocol for UIDynamicItemBehavior {}
23
24#[cfg(feature = "UIDynamicBehavior")]
25impl UIDynamicItemBehavior {
26    extern_methods!(
27        #[unsafe(method(initWithItems:))]
28        #[unsafe(method_family = init)]
29        pub unsafe fn initWithItems(
30            this: Allocated<Self>,
31            items: &NSArray<ProtocolObject<dyn UIDynamicItem>>,
32        ) -> Retained<Self>;
33
34        #[unsafe(method(addItem:))]
35        #[unsafe(method_family = none)]
36        pub unsafe fn addItem(&self, item: &ProtocolObject<dyn UIDynamicItem>);
37
38        #[unsafe(method(removeItem:))]
39        #[unsafe(method_family = none)]
40        pub unsafe fn removeItem(&self, item: &ProtocolObject<dyn UIDynamicItem>);
41
42        #[unsafe(method(items))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn items(&self) -> Retained<NSArray<ProtocolObject<dyn UIDynamicItem>>>;
45
46        #[cfg(feature = "objc2-core-foundation")]
47        #[unsafe(method(elasticity))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn elasticity(&self) -> CGFloat;
50
51        #[cfg(feature = "objc2-core-foundation")]
52        /// Setter for [`elasticity`][Self::elasticity].
53        #[unsafe(method(setElasticity:))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn setElasticity(&self, elasticity: CGFloat);
56
57        #[cfg(feature = "objc2-core-foundation")]
58        #[unsafe(method(friction))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn friction(&self) -> CGFloat;
61
62        #[cfg(feature = "objc2-core-foundation")]
63        /// Setter for [`friction`][Self::friction].
64        #[unsafe(method(setFriction:))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn setFriction(&self, friction: CGFloat);
67
68        #[cfg(feature = "objc2-core-foundation")]
69        #[unsafe(method(density))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn density(&self) -> CGFloat;
72
73        #[cfg(feature = "objc2-core-foundation")]
74        /// Setter for [`density`][Self::density].
75        #[unsafe(method(setDensity:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn setDensity(&self, density: CGFloat);
78
79        #[cfg(feature = "objc2-core-foundation")]
80        #[unsafe(method(resistance))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn resistance(&self) -> CGFloat;
83
84        #[cfg(feature = "objc2-core-foundation")]
85        /// Setter for [`resistance`][Self::resistance].
86        #[unsafe(method(setResistance:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn setResistance(&self, resistance: CGFloat);
89
90        #[cfg(feature = "objc2-core-foundation")]
91        #[unsafe(method(angularResistance))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn angularResistance(&self) -> CGFloat;
94
95        #[cfg(feature = "objc2-core-foundation")]
96        /// Setter for [`angularResistance`][Self::angularResistance].
97        #[unsafe(method(setAngularResistance:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn setAngularResistance(&self, angular_resistance: CGFloat);
100
101        #[cfg(feature = "objc2-core-foundation")]
102        /// Specifies the charge associated with the item behavior. Charge determines the degree to which a dynamic item is affected by
103        /// electric and magnetic fields. Note that this is a unitless quantity, it is up to the developer to
104        /// set charge and field strength appropriately. Defaults to 0.0
105        #[unsafe(method(charge))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn charge(&self) -> CGFloat;
108
109        #[cfg(feature = "objc2-core-foundation")]
110        /// Setter for [`charge`][Self::charge].
111        #[unsafe(method(setCharge:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn setCharge(&self, charge: CGFloat);
114
115        /// If an item is anchored, it can participate in collisions, but will not exhibit
116        /// any dynamic response. i.e. The item will behave more like a collision boundary.
117        /// The default is NO
118        #[unsafe(method(isAnchored))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn isAnchored(&self) -> bool;
121
122        /// Setter for [`isAnchored`][Self::isAnchored].
123        #[unsafe(method(setAnchored:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setAnchored(&self, anchored: bool);
126
127        #[unsafe(method(allowsRotation))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn allowsRotation(&self) -> bool;
130
131        /// Setter for [`allowsRotation`][Self::allowsRotation].
132        #[unsafe(method(setAllowsRotation:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn setAllowsRotation(&self, allows_rotation: bool);
135
136        #[cfg(feature = "objc2-core-foundation")]
137        #[unsafe(method(addLinearVelocity:forItem:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn addLinearVelocity_forItem(
140            &self,
141            velocity: CGPoint,
142            item: &ProtocolObject<dyn UIDynamicItem>,
143        );
144
145        #[cfg(feature = "objc2-core-foundation")]
146        #[unsafe(method(linearVelocityForItem:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn linearVelocityForItem(
149            &self,
150            item: &ProtocolObject<dyn UIDynamicItem>,
151        ) -> CGPoint;
152
153        #[cfg(feature = "objc2-core-foundation")]
154        #[unsafe(method(addAngularVelocity:forItem:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn addAngularVelocity_forItem(
157            &self,
158            velocity: CGFloat,
159            item: &ProtocolObject<dyn UIDynamicItem>,
160        );
161
162        #[cfg(feature = "objc2-core-foundation")]
163        #[unsafe(method(angularVelocityForItem:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn angularVelocityForItem(
166            &self,
167            item: &ProtocolObject<dyn UIDynamicItem>,
168        ) -> CGFloat;
169    );
170}
171
172/// Methods declared on superclass `NSObject`.
173#[cfg(feature = "UIDynamicBehavior")]
174impl UIDynamicItemBehavior {
175    extern_methods!(
176        #[unsafe(method(init))]
177        #[unsafe(method_family = init)]
178        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
179
180        #[unsafe(method(new))]
181        #[unsafe(method_family = new)]
182        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
183    );
184}