objc2_ui_kit/generated/
UIImpactFeedbackGenerator.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8
9use crate::*;
10
11#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct UIImpactFeedbackStyle(pub NSInteger);
16impl UIImpactFeedbackStyle {
17 #[doc(alias = "UIImpactFeedbackStyleLight")]
18 pub const Light: Self = Self(0);
19 #[doc(alias = "UIImpactFeedbackStyleMedium")]
20 pub const Medium: Self = Self(1);
21 #[doc(alias = "UIImpactFeedbackStyleHeavy")]
22 pub const Heavy: Self = Self(2);
23 #[doc(alias = "UIImpactFeedbackStyleSoft")]
24 pub const Soft: Self = Self(3);
25 #[doc(alias = "UIImpactFeedbackStyleRigid")]
26 pub const Rigid: Self = Self(4);
27}
28
29unsafe impl Encode for UIImpactFeedbackStyle {
30 const ENCODING: Encoding = NSInteger::ENCODING;
31}
32
33unsafe impl RefEncode for UIImpactFeedbackStyle {
34 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37extern_class!(
38 #[unsafe(super(UIFeedbackGenerator, NSObject))]
40 #[thread_kind = MainThreadOnly]
41 #[derive(Debug, PartialEq, Eq, Hash)]
42 #[cfg(feature = "UIFeedbackGenerator")]
43 pub struct UIImpactFeedbackGenerator;
44);
45
46#[cfg(feature = "UIFeedbackGenerator")]
47unsafe impl NSObjectProtocol for UIImpactFeedbackGenerator {}
48
49#[cfg(feature = "UIFeedbackGenerator")]
50impl UIImpactFeedbackGenerator {
51 extern_methods!(
52 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
53 #[unsafe(method(feedbackGeneratorWithStyle:forView:))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn feedbackGeneratorWithStyle_forView(
57 style: UIImpactFeedbackStyle,
58 view: &UIView,
59 ) -> Retained<Self>;
60
61 #[unsafe(method(impactOccurred))]
63 #[unsafe(method_family = none)]
64 pub unsafe fn impactOccurred(&self);
65
66 #[cfg(feature = "objc2-core-foundation")]
67 #[unsafe(method(impactOccurredAtLocation:))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn impactOccurredAtLocation(&self, location: CGPoint);
70
71 #[cfg(feature = "objc2-core-foundation")]
72 #[unsafe(method(impactOccurredWithIntensity:))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn impactOccurredWithIntensity(&self, intensity: CGFloat);
76
77 #[cfg(feature = "objc2-core-foundation")]
78 #[unsafe(method(impactOccurredWithIntensity:atLocation:))]
79 #[unsafe(method_family = none)]
80 pub unsafe fn impactOccurredWithIntensity_atLocation(
81 &self,
82 intensity: CGFloat,
83 location: CGPoint,
84 );
85
86 #[deprecated]
87 #[unsafe(method(initWithStyle:))]
88 #[unsafe(method_family = init)]
89 pub unsafe fn initWithStyle(
90 this: Allocated<Self>,
91 style: UIImpactFeedbackStyle,
92 ) -> Retained<Self>;
93 );
94}
95
96#[cfg(feature = "UIFeedbackGenerator")]
98impl UIImpactFeedbackGenerator {
99 extern_methods!(
100 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
101 #[unsafe(method(feedbackGeneratorForView:))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn feedbackGeneratorForView(view: &UIView) -> Retained<Self>;
105
106 #[deprecated]
107 #[unsafe(method(init))]
108 #[unsafe(method_family = init)]
109 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
110 );
111}
112
113#[cfg(feature = "UIFeedbackGenerator")]
115impl UIImpactFeedbackGenerator {
116 extern_methods!(
117 #[unsafe(method(new))]
118 #[unsafe(method_family = new)]
119 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
120 );
121}