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 UINotificationFeedbackType(pub NSInteger);
impl UINotificationFeedbackType {
#[doc(alias = "UINotificationFeedbackTypeSuccess")]
pub const Success: Self = Self(0);
#[doc(alias = "UINotificationFeedbackTypeWarning")]
pub const Warning: Self = Self(1);
#[doc(alias = "UINotificationFeedbackTypeError")]
pub const Error: Self = Self(2);
}
unsafe impl Encode for UINotificationFeedbackType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UINotificationFeedbackType {
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 UINotificationFeedbackGenerator;
);
#[cfg(feature = "UIFeedbackGenerator")]
extern_conformance!(
unsafe impl NSObjectProtocol for UINotificationFeedbackGenerator {}
);
#[cfg(feature = "UIFeedbackGenerator")]
impl UINotificationFeedbackGenerator {
extern_methods!(
#[unsafe(method(notificationOccurred:))]
#[unsafe(method_family = none)]
pub fn notificationOccurred(&self, notification_type: UINotificationFeedbackType);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(notificationOccurred:atLocation:))]
#[unsafe(method_family = none)]
pub fn notificationOccurred_atLocation(
&self,
notification_type: UINotificationFeedbackType,
location: CGPoint,
);
);
}
#[cfg(feature = "UIFeedbackGenerator")]
impl UINotificationFeedbackGenerator {
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 UINotificationFeedbackGenerator {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}