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::DynBlock<
13 dyn Fn(NonNull<UIContextualAction>, NonNull<UIView>, NonNull<block2::DynBlock<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
44extern_conformance!(
45 unsafe impl NSObjectProtocol for UIContextualAction {}
46);
47
48impl UIContextualAction {
49 extern_methods!(
50 #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "block2"))]
51 #[unsafe(method(contextualActionWithStyle:title:handler:))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn contextualActionWithStyle_title_handler(
57 style: UIContextualActionStyle,
58 title: Option<&NSString>,
59 handler: UIContextualActionHandler,
60 mtm: MainThreadMarker,
61 ) -> Retained<Self>;
62
63 #[unsafe(method(style))]
64 #[unsafe(method_family = none)]
65 pub fn style(&self) -> UIContextualActionStyle;
66
67 #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "block2"))]
68 #[unsafe(method(handler))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn handler(&self) -> UIContextualActionHandler;
76
77 #[unsafe(method(title))]
78 #[unsafe(method_family = none)]
79 pub fn title(&self) -> Option<Retained<NSString>>;
80
81 #[unsafe(method(setTitle:))]
85 #[unsafe(method_family = none)]
86 pub fn setTitle(&self, title: Option<&NSString>);
87
88 #[cfg(feature = "UIColor")]
89 #[unsafe(method(backgroundColor))]
90 #[unsafe(method_family = none)]
91 pub fn backgroundColor(&self) -> Retained<UIColor>;
92
93 #[cfg(feature = "UIColor")]
94 #[unsafe(method(setBackgroundColor:))]
98 #[unsafe(method_family = none)]
99 pub fn setBackgroundColor(&self, background_color: Option<&UIColor>);
100
101 #[cfg(feature = "UIImage")]
102 #[unsafe(method(image))]
103 #[unsafe(method_family = none)]
104 pub fn image(&self) -> Option<Retained<UIImage>>;
105
106 #[cfg(feature = "UIImage")]
107 #[unsafe(method(setImage:))]
111 #[unsafe(method_family = none)]
112 pub fn setImage(&self, image: Option<&UIImage>);
113 );
114}
115
116impl UIContextualAction {
118 extern_methods!(
119 #[unsafe(method(init))]
120 #[unsafe(method_family = init)]
121 pub fn init(this: Allocated<Self>) -> Retained<Self>;
122
123 #[unsafe(method(new))]
124 #[unsafe(method_family = new)]
125 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
126 );
127}