objc2_ui_kit/generated/
UIPushBehavior.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
12/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipushbehaviormode?language=objc)
13// NS_ENUM
14#[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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipushbehavior?language=objc)
34    #[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")]
42extern_conformance!(
43    unsafe impl NSObjectProtocol for UIPushBehavior {}
44);
45
46#[cfg(feature = "UIDynamicBehavior")]
47impl UIPushBehavior {
48    extern_methods!(
49        #[unsafe(method(initWithItems:mode:))]
50        #[unsafe(method_family = init)]
51        pub unsafe fn initWithItems_mode(
52            this: Allocated<Self>,
53            items: &NSArray<ProtocolObject<dyn UIDynamicItem>>,
54            mode: UIPushBehaviorMode,
55        ) -> Retained<Self>;
56
57        #[unsafe(method(addItem:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn addItem(&self, item: &ProtocolObject<dyn UIDynamicItem>);
60
61        #[unsafe(method(removeItem:))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn removeItem(&self, item: &ProtocolObject<dyn UIDynamicItem>);
64
65        #[unsafe(method(items))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn items(&self) -> Retained<NSArray<ProtocolObject<dyn UIDynamicItem>>>;
68
69        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
70        #[unsafe(method(targetOffsetFromCenterForItem:))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn targetOffsetFromCenterForItem(
73            &self,
74            item: &ProtocolObject<dyn UIDynamicItem>,
75        ) -> UIOffset;
76
77        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
78        #[unsafe(method(setTargetOffsetFromCenter:forItem:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn setTargetOffsetFromCenter_forItem(
81            &self,
82            o: UIOffset,
83            item: &ProtocolObject<dyn UIDynamicItem>,
84        );
85
86        #[unsafe(method(mode))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn mode(&self) -> UIPushBehaviorMode;
89
90        #[unsafe(method(active))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn active(&self) -> bool;
93
94        /// Setter for [`active`][Self::active].
95        #[unsafe(method(setActive:))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn setActive(&self, active: bool);
98
99        #[cfg(feature = "objc2-core-foundation")]
100        #[unsafe(method(angle))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn angle(&self) -> CGFloat;
103
104        #[cfg(feature = "objc2-core-foundation")]
105        /// Setter for [`angle`][Self::angle].
106        #[unsafe(method(setAngle:))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn setAngle(&self, angle: CGFloat);
109
110        #[cfg(feature = "objc2-core-foundation")]
111        #[unsafe(method(magnitude))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn magnitude(&self) -> CGFloat;
114
115        #[cfg(feature = "objc2-core-foundation")]
116        /// Setter for [`magnitude`][Self::magnitude].
117        #[unsafe(method(setMagnitude:))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn setMagnitude(&self, magnitude: CGFloat);
120
121        #[cfg(feature = "objc2-core-foundation")]
122        #[unsafe(method(pushDirection))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn pushDirection(&self) -> CGVector;
125
126        #[cfg(feature = "objc2-core-foundation")]
127        /// Setter for [`pushDirection`][Self::pushDirection].
128        #[unsafe(method(setPushDirection:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn setPushDirection(&self, push_direction: CGVector);
131
132        #[cfg(feature = "objc2-core-foundation")]
133        #[unsafe(method(setAngle:magnitude:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setAngle_magnitude(&self, angle: CGFloat, magnitude: CGFloat);
136    );
137}
138
139/// Methods declared on superclass `NSObject`.
140#[cfg(feature = "UIDynamicBehavior")]
141impl UIPushBehavior {
142    extern_methods!(
143        #[unsafe(method(init))]
144        #[unsafe(method_family = init)]
145        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
146
147        #[unsafe(method(new))]
148        #[unsafe(method_family = new)]
149        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
150    );
151}