objc2_ui_kit/generated/
UIAction.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10pub type UIActionIdentifier = NSString;
13
14extern "C" {
15 pub static UIActionPaste: &'static UIActionIdentifier;
19}
20
21extern "C" {
22 pub static UIActionPasteAndMatchStyle: &'static UIActionIdentifier;
24}
25
26extern "C" {
27 pub static UIActionPasteAndGo: &'static UIActionIdentifier;
29}
30
31extern "C" {
32 pub static UIActionPasteAndSearch: &'static UIActionIdentifier;
34}
35
36#[cfg(all(feature = "UIMenuElement", feature = "block2"))]
38pub type UIActionHandler = *mut block2::DynBlock<dyn Fn(NonNull<UIAction>)>;
39
40extern_class!(
41 #[unsafe(super(UIMenuElement, NSObject))]
43 #[thread_kind = MainThreadOnly]
44 #[derive(Debug, PartialEq, Eq, Hash)]
45 #[cfg(feature = "UIMenuElement")]
46 pub struct UIAction;
47);
48
49#[cfg(feature = "UIMenuElement")]
50extern_conformance!(
51 unsafe impl NSCoding for UIAction {}
52);
53
54#[cfg(feature = "UIMenuElement")]
55extern_conformance!(
56 unsafe impl NSCopying for UIAction {}
57);
58
59#[cfg(feature = "UIMenuElement")]
60unsafe impl CopyingHelper for UIAction {
61 type Result = Self;
62}
63
64#[cfg(feature = "UIMenuElement")]
65extern_conformance!(
66 unsafe impl NSObjectProtocol for UIAction {}
67);
68
69#[cfg(feature = "UIMenuElement")]
70extern_conformance!(
71 unsafe impl NSSecureCoding for UIAction {}
72);
73
74#[cfg(all(feature = "UIMenuElement", feature = "UIMenuLeaf"))]
75extern_conformance!(
76 unsafe impl UIMenuLeaf for UIAction {}
77);
78
79#[cfg(feature = "UIMenuElement")]
80impl UIAction {
81 extern_methods!(
82 #[unsafe(method(title))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn title(&self) -> Retained<NSString>;
86
87 #[unsafe(method(setTitle:))]
89 #[unsafe(method_family = none)]
90 pub unsafe fn setTitle(&self, title: &NSString);
91
92 #[cfg(feature = "UIImage")]
93 #[unsafe(method(image))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
97
98 #[cfg(feature = "UIImage")]
99 #[unsafe(method(setImage:))]
101 #[unsafe(method_family = none)]
102 pub unsafe fn setImage(&self, image: Option<&UIImage>);
103
104 #[unsafe(method(discoverabilityTitle))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn discoverabilityTitle(&self) -> Option<Retained<NSString>>;
108
109 #[unsafe(method(setDiscoverabilityTitle:))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn setDiscoverabilityTitle(&self, discoverability_title: Option<&NSString>);
113
114 #[unsafe(method(identifier))]
116 #[unsafe(method_family = none)]
117 pub unsafe fn identifier(&self) -> Retained<UIActionIdentifier>;
118
119 #[unsafe(method(attributes))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn attributes(&self) -> UIMenuElementAttributes;
123
124 #[unsafe(method(setAttributes:))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn setAttributes(&self, attributes: UIMenuElementAttributes);
128
129 #[unsafe(method(state))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn state(&self) -> UIMenuElementState;
133
134 #[unsafe(method(setState:))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn setState(&self, state: UIMenuElementState);
138
139 #[unsafe(method(sender))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn sender(&self) -> Option<Retained<AnyObject>>;
143
144 #[cfg(feature = "block2")]
145 #[unsafe(method(actionWithHandler:))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn actionWithHandler(
155 handler: UIActionHandler,
156 mtm: MainThreadMarker,
157 ) -> Retained<Self>;
158
159 #[cfg(all(feature = "UIImage", feature = "block2"))]
160 #[unsafe(method(actionWithTitle:image:identifier:handler:))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn actionWithTitle_image_identifier_handler(
176 title: &NSString,
177 image: Option<&UIImage>,
178 identifier: Option<&UIActionIdentifier>,
179 handler: UIActionHandler,
180 mtm: MainThreadMarker,
181 ) -> Retained<Self>;
182
183 #[unsafe(method(init))]
184 #[unsafe(method_family = init)]
185 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
186
187 #[unsafe(method(new))]
188 #[unsafe(method_family = new)]
189 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
190 );
191}
192
193#[cfg(feature = "UIMenuElement")]
195impl UIAction {
196 extern_methods!(
197 #[unsafe(method(initWithCoder:))]
198 #[unsafe(method_family = init)]
199 pub unsafe fn initWithCoder(
200 this: Allocated<Self>,
201 coder: &NSCoder,
202 ) -> Option<Retained<Self>>;
203 );
204}
205
206#[cfg(feature = "UIMenuElement")]
208impl UIAction {
209 extern_methods!(
210 #[cfg(all(
211 feature = "UIResponder",
212 feature = "UITextInput",
213 feature = "UITextInputTraits"
214 ))]
215 #[unsafe(method(captureTextFromCameraActionForResponder:identifier:))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn captureTextFromCameraActionForResponder_identifier(
227 responder: &UIResponder,
228 identifier: Option<&UIActionIdentifier>,
229 ) -> Retained<Self>;
230 );
231}