objc2_ui_kit/generated/
UIPushBehavior.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
12#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UIPushBehaviorMode(pub NSInteger);
17impl UIPushBehaviorMode {
18 #[doc(alias = "UIPushBehaviorModeContinuous")]
19 pub const Continuous: Self = Self(0);
20 #[doc(alias = "UIPushBehaviorModeInstantaneous")]
21 pub const Instantaneous: Self = Self(1);
22}
23
24unsafe impl Encode for UIPushBehaviorMode {
25 const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for UIPushBehaviorMode {
29 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32extern_class!(
33 #[unsafe(super(UIDynamicBehavior, NSObject))]
35 #[thread_kind = MainThreadOnly]
36 #[derive(Debug, PartialEq, Eq, Hash)]
37 #[cfg(feature = "UIDynamicBehavior")]
38 pub struct UIPushBehavior;
39);
40
41#[cfg(feature = "UIDynamicBehavior")]
42unsafe impl NSObjectProtocol for UIPushBehavior {}
43
44#[cfg(feature = "UIDynamicBehavior")]
45impl UIPushBehavior {
46 extern_methods!(
47 #[unsafe(method(initWithItems:mode:))]
48 #[unsafe(method_family = init)]
49 pub unsafe fn initWithItems_mode(
50 this: Allocated<Self>,
51 items: &NSArray<ProtocolObject<dyn UIDynamicItem>>,
52 mode: UIPushBehaviorMode,
53 ) -> Retained<Self>;
54
55 #[unsafe(method(addItem:))]
56 #[unsafe(method_family = none)]
57 pub unsafe fn addItem(&self, item: &ProtocolObject<dyn UIDynamicItem>);
58
59 #[unsafe(method(removeItem:))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn removeItem(&self, item: &ProtocolObject<dyn UIDynamicItem>);
62
63 #[unsafe(method(items))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn items(&self) -> Retained<NSArray<ProtocolObject<dyn UIDynamicItem>>>;
66
67 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
68 #[unsafe(method(targetOffsetFromCenterForItem:))]
69 #[unsafe(method_family = none)]
70 pub unsafe fn targetOffsetFromCenterForItem(
71 &self,
72 item: &ProtocolObject<dyn UIDynamicItem>,
73 ) -> UIOffset;
74
75 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
76 #[unsafe(method(setTargetOffsetFromCenter:forItem:))]
77 #[unsafe(method_family = none)]
78 pub unsafe fn setTargetOffsetFromCenter_forItem(
79 &self,
80 o: UIOffset,
81 item: &ProtocolObject<dyn UIDynamicItem>,
82 );
83
84 #[unsafe(method(mode))]
85 #[unsafe(method_family = none)]
86 pub unsafe fn mode(&self) -> UIPushBehaviorMode;
87
88 #[unsafe(method(active))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn active(&self) -> bool;
91
92 #[unsafe(method(setActive:))]
94 #[unsafe(method_family = none)]
95 pub unsafe fn setActive(&self, active: bool);
96
97 #[cfg(feature = "objc2-core-foundation")]
98 #[unsafe(method(angle))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn angle(&self) -> CGFloat;
101
102 #[cfg(feature = "objc2-core-foundation")]
103 #[unsafe(method(setAngle:))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn setAngle(&self, angle: CGFloat);
107
108 #[cfg(feature = "objc2-core-foundation")]
109 #[unsafe(method(magnitude))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn magnitude(&self) -> CGFloat;
112
113 #[cfg(feature = "objc2-core-foundation")]
114 #[unsafe(method(setMagnitude:))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn setMagnitude(&self, magnitude: CGFloat);
118
119 #[cfg(feature = "objc2-core-foundation")]
120 #[unsafe(method(pushDirection))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn pushDirection(&self) -> CGVector;
123
124 #[cfg(feature = "objc2-core-foundation")]
125 #[unsafe(method(setPushDirection:))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn setPushDirection(&self, push_direction: CGVector);
129
130 #[cfg(feature = "objc2-core-foundation")]
131 #[unsafe(method(setAngle:magnitude:))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn setAngle_magnitude(&self, angle: CGFloat, magnitude: CGFloat);
134 );
135}
136
137#[cfg(feature = "UIDynamicBehavior")]
139impl UIPushBehavior {
140 extern_methods!(
141 #[unsafe(method(init))]
142 #[unsafe(method_family = init)]
143 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
144
145 #[unsafe(method(new))]
146 #[unsafe(method_family = new)]
147 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
148 );
149}