use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[cfg(all(feature = "UIResponder", feature = "UIView", feature = "block2"))]
pub type UIContextualActionHandler = *mut block2::DynBlock<
dyn Fn(NonNull<UIContextualAction>, NonNull<UIView>, NonNull<block2::DynBlock<dyn Fn(Bool)>>),
>;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIContextualActionStyle(pub NSInteger);
impl UIContextualActionStyle {
#[doc(alias = "UIContextualActionStyleNormal")]
pub const Normal: Self = Self(0);
#[doc(alias = "UIContextualActionStyleDestructive")]
pub const Destructive: Self = Self(1);
}
unsafe impl Encode for UIContextualActionStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for UIContextualActionStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UIContextualAction;
);
extern_conformance!(
unsafe impl NSObjectProtocol for UIContextualAction {}
);
impl UIContextualAction {
extern_methods!(
#[cfg(all(feature = "UIResponder", feature = "UIView", feature = "block2"))]
#[unsafe(method(contextualActionWithStyle:title:handler:))]
#[unsafe(method_family = none)]
pub unsafe fn contextualActionWithStyle_title_handler(
style: UIContextualActionStyle,
title: Option<&NSString>,
handler: UIContextualActionHandler,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[unsafe(method(style))]
#[unsafe(method_family = none)]
pub fn style(&self) -> UIContextualActionStyle;
#[cfg(all(feature = "UIResponder", feature = "UIView", feature = "block2"))]
#[unsafe(method(handler))]
#[unsafe(method_family = none)]
pub unsafe fn handler(&self) -> UIContextualActionHandler;
#[unsafe(method(title))]
#[unsafe(method_family = none)]
pub fn title(&self) -> Option<Retained<NSString>>;
#[unsafe(method(setTitle:))]
#[unsafe(method_family = none)]
pub fn setTitle(&self, title: Option<&NSString>);
#[cfg(feature = "UIColor")]
#[unsafe(method(backgroundColor))]
#[unsafe(method_family = none)]
pub fn backgroundColor(&self) -> Retained<UIColor>;
#[cfg(feature = "UIColor")]
#[unsafe(method(setBackgroundColor:))]
#[unsafe(method_family = none)]
pub fn setBackgroundColor(&self, background_color: Option<&UIColor>);
#[cfg(feature = "UIImage")]
#[unsafe(method(image))]
#[unsafe(method_family = none)]
pub fn image(&self) -> Option<Retained<UIImage>>;
#[cfg(feature = "UIImage")]
#[unsafe(method(setImage:))]
#[unsafe(method_family = none)]
pub fn setImage(&self, image: Option<&UIImage>);
);
}
impl UIContextualAction {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}