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
36extern "C" {
37 pub static UIActionNewFromPasteboard: &'static UIActionIdentifier;
39}
40
41#[cfg(all(feature = "UIMenuElement", feature = "block2"))]
43pub type UIActionHandler = *mut block2::DynBlock<dyn Fn(NonNull<UIAction>)>;
44
45extern_class!(
46 #[unsafe(super(UIMenuElement, NSObject))]
48 #[thread_kind = MainThreadOnly]
49 #[derive(Debug, PartialEq, Eq, Hash)]
50 #[cfg(feature = "UIMenuElement")]
51 pub struct UIAction;
52);
53
54#[cfg(feature = "UIMenuElement")]
55extern_conformance!(
56 unsafe impl NSCoding for UIAction {}
57);
58
59#[cfg(feature = "UIMenuElement")]
60extern_conformance!(
61 unsafe impl NSCopying for UIAction {}
62);
63
64#[cfg(feature = "UIMenuElement")]
65unsafe impl CopyingHelper for UIAction {
66 type Result = Self;
67}
68
69#[cfg(feature = "UIMenuElement")]
70extern_conformance!(
71 unsafe impl NSObjectProtocol for UIAction {}
72);
73
74#[cfg(feature = "UIMenuElement")]
75extern_conformance!(
76 unsafe impl NSSecureCoding for UIAction {}
77);
78
79#[cfg(all(feature = "UIMenuElement", feature = "UIMenuLeaf"))]
80extern_conformance!(
81 unsafe impl UIMenuLeaf for UIAction {}
82);
83
84#[cfg(feature = "UIMenuElement")]
85impl UIAction {
86 extern_methods!(
87 #[unsafe(method(title))]
89 #[unsafe(method_family = none)]
90 pub fn title(&self) -> Retained<NSString>;
91
92 #[unsafe(method(setTitle:))]
96 #[unsafe(method_family = none)]
97 pub fn setTitle(&self, title: &NSString);
98
99 #[cfg(feature = "UIImage")]
100 #[unsafe(method(image))]
102 #[unsafe(method_family = none)]
103 pub fn image(&self) -> Option<Retained<UIImage>>;
104
105 #[cfg(feature = "UIImage")]
106 #[unsafe(method(setImage:))]
110 #[unsafe(method_family = none)]
111 pub fn setImage(&self, image: Option<&UIImage>);
112
113 #[unsafe(method(discoverabilityTitle))]
115 #[unsafe(method_family = none)]
116 pub fn discoverabilityTitle(&self) -> Option<Retained<NSString>>;
117
118 #[unsafe(method(setDiscoverabilityTitle:))]
122 #[unsafe(method_family = none)]
123 pub fn setDiscoverabilityTitle(&self, discoverability_title: Option<&NSString>);
124
125 #[unsafe(method(identifier))]
127 #[unsafe(method_family = none)]
128 pub fn identifier(&self) -> Retained<UIActionIdentifier>;
129
130 #[unsafe(method(attributes))]
132 #[unsafe(method_family = none)]
133 pub fn attributes(&self) -> UIMenuElementAttributes;
134
135 #[unsafe(method(setAttributes:))]
137 #[unsafe(method_family = none)]
138 pub fn setAttributes(&self, attributes: UIMenuElementAttributes);
139
140 #[unsafe(method(state))]
142 #[unsafe(method_family = none)]
143 pub fn state(&self) -> UIMenuElementState;
144
145 #[unsafe(method(setState:))]
147 #[unsafe(method_family = none)]
148 pub fn setState(&self, state: UIMenuElementState);
149
150 #[unsafe(method(sender))]
152 #[unsafe(method_family = none)]
153 pub fn sender(&self) -> Option<Retained<AnyObject>>;
154
155 #[cfg(feature = "block2")]
156 #[unsafe(method(actionWithHandler:))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn actionWithHandler(
170 handler: UIActionHandler,
171 mtm: MainThreadMarker,
172 ) -> Retained<Self>;
173
174 #[cfg(all(feature = "UIImage", feature = "block2"))]
175 #[unsafe(method(actionWithTitle:image:identifier:handler:))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn actionWithTitle_image_identifier_handler(
195 title: &NSString,
196 image: Option<&UIImage>,
197 identifier: Option<&UIActionIdentifier>,
198 handler: UIActionHandler,
199 mtm: MainThreadMarker,
200 ) -> Retained<Self>;
201
202 #[unsafe(method(init))]
203 #[unsafe(method_family = init)]
204 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
205
206 #[unsafe(method(new))]
207 #[unsafe(method_family = new)]
208 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
209 );
210}
211
212#[cfg(feature = "UIMenuElement")]
214impl UIAction {
215 extern_methods!(
216 #[unsafe(method(initWithCoder:))]
220 #[unsafe(method_family = init)]
221 pub unsafe fn initWithCoder(
222 this: Allocated<Self>,
223 coder: &NSCoder,
224 ) -> Option<Retained<Self>>;
225 );
226}
227
228#[cfg(feature = "UIMenuElement")]
230impl UIAction {
231 extern_methods!(
232 #[cfg(all(
233 feature = "UIResponder",
234 feature = "UITextInput",
235 feature = "UITextInputTraits"
236 ))]
237 #[unsafe(method(captureTextFromCameraActionForResponder:identifier:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn captureTextFromCameraActionForResponder_identifier(
253 responder: &UIResponder,
254 identifier: Option<&UIActionIdentifier>,
255 ) -> Retained<Self>;
256 );
257}