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