objc2_ui_kit/generated/
UIContextualAction.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[cfg(all(feature = "UIResponder", feature = "UIView", feature = "block2"))]
12pub type UIContextualActionHandler = *mut block2::Block<
13 dyn Fn(NonNull<UIContextualAction>, NonNull<UIView>, NonNull<block2::Block<dyn Fn(Bool)>>),
14>;
15
16#[repr(transparent)]
19#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
20pub struct UIContextualActionStyle(pub NSInteger);
21impl UIContextualActionStyle {
22 #[doc(alias = "UIContextualActionStyleNormal")]
23 pub const Normal: Self = Self(0);
24 #[doc(alias = "UIContextualActionStyleDestructive")]
25 pub const Destructive: Self = Self(1);
26}
27
28unsafe impl Encode for UIContextualActionStyle {
29 const ENCODING: Encoding = NSInteger::ENCODING;
30}
31
32unsafe impl RefEncode for UIContextualActionStyle {
33 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36extern_class!(
37 #[unsafe(super(NSObject))]
39 #[thread_kind = MainThreadOnly]
40 #[derive(Debug, PartialEq, Eq, Hash)]
41 pub struct UIContextualAction;
42);
43
44unsafe impl NSObjectProtocol for UIContextualAction {}
45
46impl UIContextualAction {
47 extern_methods!(
48 #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "block2"))]
49 #[unsafe(method(contextualActionWithStyle:title:handler:))]
50 #[unsafe(method_family = none)]
51 pub unsafe fn contextualActionWithStyle_title_handler(
52 style: UIContextualActionStyle,
53 title: Option<&NSString>,
54 handler: UIContextualActionHandler,
55 mtm: MainThreadMarker,
56 ) -> Retained<Self>;
57
58 #[unsafe(method(style))]
59 #[unsafe(method_family = none)]
60 pub unsafe fn style(&self) -> UIContextualActionStyle;
61
62 #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "block2"))]
63 #[unsafe(method(handler))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn handler(&self) -> UIContextualActionHandler;
66
67 #[unsafe(method(title))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn title(&self) -> Option<Retained<NSString>>;
70
71 #[unsafe(method(setTitle:))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn setTitle(&self, title: Option<&NSString>);
75
76 #[cfg(feature = "UIColor")]
77 #[unsafe(method(backgroundColor))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn backgroundColor(&self) -> Retained<UIColor>;
80
81 #[cfg(feature = "UIColor")]
82 #[unsafe(method(setBackgroundColor:))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn setBackgroundColor(&self, background_color: Option<&UIColor>);
86
87 #[cfg(feature = "UIImage")]
88 #[unsafe(method(image))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
91
92 #[cfg(feature = "UIImage")]
93 #[unsafe(method(setImage:))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn setImage(&self, image: Option<&UIImage>);
97 );
98}
99
100impl UIContextualAction {
102 extern_methods!(
103 #[unsafe(method(init))]
104 #[unsafe(method_family = init)]
105 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
106
107 #[unsafe(method(new))]
108 #[unsafe(method_family = new)]
109 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
110 );
111}