use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIImpactFeedbackStyle(pub NSInteger);
impl UIImpactFeedbackStyle {
#[doc(alias = "UIImpactFeedbackStyleLight")]
pub const Light: Self = Self(0);
#[doc(alias = "UIImpactFeedbackStyleMedium")]
pub const Medium: Self = Self(1);
#[doc(alias = "UIImpactFeedbackStyleHeavy")]
pub const Heavy: Self = Self(2);
#[doc(alias = "UIImpactFeedbackStyleSoft")]
pub const Soft: Self = Self(3);
#[doc(alias = "UIImpactFeedbackStyleRigid")]
pub const Rigid: Self = Self(4);
}
unsafe impl Encode for UIImpactFeedbackStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIImpactFeedbackStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(UIFeedbackGenerator, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIFeedbackGenerator")]
pub struct UIImpactFeedbackGenerator;
);
#[cfg(feature = "UIFeedbackGenerator")]
extern_conformance!(
unsafe impl NSObjectProtocol for UIImpactFeedbackGenerator {}
);
#[cfg(feature = "UIFeedbackGenerator")]
impl UIImpactFeedbackGenerator {
extern_methods!(
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[unsafe(method(feedbackGeneratorWithStyle:forView:))]
#[unsafe(method_family = none)]
pub fn feedbackGeneratorWithStyle_forView(
style: UIImpactFeedbackStyle,
view: &UIView,
) -> Retained<Self>;
#[unsafe(method(impactOccurred))]
#[unsafe(method_family = none)]
pub fn impactOccurred(&self);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(impactOccurredAtLocation:))]
#[unsafe(method_family = none)]
pub fn impactOccurredAtLocation(&self, location: CGPoint);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(impactOccurredWithIntensity:))]
#[unsafe(method_family = none)]
pub fn impactOccurredWithIntensity(&self, intensity: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(impactOccurredWithIntensity:atLocation:))]
#[unsafe(method_family = none)]
pub fn impactOccurredWithIntensity_atLocation(&self, intensity: CGFloat, location: CGPoint);
#[deprecated]
#[unsafe(method(initWithStyle:))]
#[unsafe(method_family = init)]
pub fn initWithStyle(this: Allocated<Self>, style: UIImpactFeedbackStyle)
-> Retained<Self>;
);
}
#[cfg(feature = "UIFeedbackGenerator")]
impl UIImpactFeedbackGenerator {
extern_methods!(
#[cfg(all(feature = "UIResponder", feature = "UIView"))]
#[unsafe(method(feedbackGeneratorForView:))]
#[unsafe(method_family = none)]
pub fn feedbackGeneratorForView(view: &UIView) -> Retained<Self>;
#[deprecated]
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(feature = "UIFeedbackGenerator")]
impl UIImpactFeedbackGenerator {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}