1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionidentifier?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type UIActionIdentifier = NSString;
extern "C" {
/// Default action identifiers for paste variants
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionpaste?language=objc)
pub static UIActionPaste: &'static UIActionIdentifier;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionpasteandmatchstyle?language=objc)
pub static UIActionPasteAndMatchStyle: &'static UIActionIdentifier;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionpasteandgo?language=objc)
pub static UIActionPasteAndGo: &'static UIActionIdentifier;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionpasteandsearch?language=objc)
pub static UIActionPasteAndSearch: &'static UIActionIdentifier;
}
extern "C" {
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionnewfrompasteboard?language=objc)
pub static UIActionNewFromPasteboard: &'static UIActionIdentifier;
}
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiactionhandler?language=objc)
#[cfg(all(feature = "UIMenuElement", feature = "block2"))]
pub type UIActionHandler = *mut block2::DynBlock<dyn Fn(NonNull<UIAction>)>;
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiaction?language=objc)
#[unsafe(super(UIMenuElement, NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "UIMenuElement")]
pub struct UIAction;
);
#[cfg(feature = "UIMenuElement")]
extern_conformance!(
unsafe impl NSCoding for UIAction {}
);
#[cfg(feature = "UIMenuElement")]
extern_conformance!(
unsafe impl NSCopying for UIAction {}
);
#[cfg(feature = "UIMenuElement")]
unsafe impl CopyingHelper for UIAction {
type Result = Self;
}
#[cfg(feature = "UIMenuElement")]
extern_conformance!(
unsafe impl NSObjectProtocol for UIAction {}
);
#[cfg(feature = "UIMenuElement")]
extern_conformance!(
unsafe impl NSSecureCoding for UIAction {}
);
#[cfg(all(feature = "UIMenuElement", feature = "UIMenuLeaf"))]
extern_conformance!(
unsafe impl UIMenuLeaf for UIAction {}
);
#[cfg(feature = "UIMenuElement")]
impl UIAction {
extern_methods!(
/// Short display title.
#[unsafe(method(title))]
#[unsafe(method_family = none)]
pub fn title(&self) -> Retained<NSString>;
/// Setter for [`title`][Self::title].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setTitle:))]
#[unsafe(method_family = none)]
pub fn setTitle(&self, title: &NSString);
#[cfg(feature = "UIImage")]
/// Image that can appear next to this action.
#[unsafe(method(image))]
#[unsafe(method_family = none)]
pub fn image(&self) -> Option<Retained<UIImage>>;
#[cfg(feature = "UIImage")]
/// Setter for [`image`][Self::image].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setImage:))]
#[unsafe(method_family = none)]
pub fn setImage(&self, image: Option<&UIImage>);
/// Elaborated title used in keyboard shortcut overlay.
#[unsafe(method(discoverabilityTitle))]
#[unsafe(method_family = none)]
pub fn discoverabilityTitle(&self) -> Option<Retained<NSString>>;
/// Setter for [`discoverabilityTitle`][Self::discoverabilityTitle].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setDiscoverabilityTitle:))]
#[unsafe(method_family = none)]
pub fn setDiscoverabilityTitle(&self, discoverability_title: Option<&NSString>);
/// This action's identifier.
#[unsafe(method(identifier))]
#[unsafe(method_family = none)]
pub fn identifier(&self) -> Retained<UIActionIdentifier>;
/// This action's style.
#[unsafe(method(attributes))]
#[unsafe(method_family = none)]
pub fn attributes(&self) -> UIMenuElementAttributes;
/// Setter for [`attributes`][Self::attributes].
#[unsafe(method(setAttributes:))]
#[unsafe(method_family = none)]
pub fn setAttributes(&self, attributes: UIMenuElementAttributes);
/// State that can appear next to this action.
#[unsafe(method(state))]
#[unsafe(method_family = none)]
pub fn state(&self) -> UIMenuElementState;
/// Setter for [`state`][Self::state].
#[unsafe(method(setState:))]
#[unsafe(method_family = none)]
pub fn setState(&self, state: UIMenuElementState);
/// If available, the object on behalf of which the actionHandler is called.
#[unsafe(method(sender))]
#[unsafe(method_family = none)]
pub fn sender(&self) -> Option<Retained<AnyObject>>;
#[cfg(feature = "block2")]
/// Creates a UIAction with an empty title, nil image, and automatically generated identifier
///
///
/// Parameter `handler`: Handler block. Called when the user selects the action.
///
///
/// Returns: A new UIAction.
///
/// # Safety
///
/// `handler` must be a valid pointer.
#[unsafe(method(actionWithHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn actionWithHandler(
handler: UIActionHandler,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[cfg(all(feature = "UIImage", feature = "block2"))]
/// Creates a UIAction with the given arguments.
///
///
/// Parameter `title`: The action's title.
///
/// Parameter `image`: Image that can appear next to this action, if needed.
///
/// Parameter `identifier`: The action's identifier. Pass nil to use an auto-generated identifier.
///
/// Parameter `handler`: Handler block. Called when the user selects the action.
///
///
/// Returns: A new UIAction.
///
/// # Safety
///
/// `handler` must be a valid pointer.
#[unsafe(method(actionWithTitle:image:identifier:handler:))]
#[unsafe(method_family = none)]
pub unsafe fn actionWithTitle_image_identifier_handler(
title: &NSString,
image: Option<&UIImage>,
identifier: Option<&UIActionIdentifier>,
handler: UIActionHandler,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
/// Methods declared on superclass `UIMenuElement`.
#[cfg(feature = "UIMenuElement")]
impl UIAction {
extern_methods!(
/// # Safety
///
/// `coder` possibly has further requirements.
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
);
}
/// UICaptureTextFromCameraSupporting.
#[cfg(feature = "UIMenuElement")]
impl UIAction {
extern_methods!(
#[cfg(all(
feature = "UIResponder",
feature = "UITextInput",
feature = "UITextInputTraits"
))]
/// Creates a new UIAction for the captureTextFromCamera: standard edit action.
///
///
/// Parameter `responder`: The UIKeyInput responder to send captureTextFromCamera: to.
///
/// Parameter `identifier`: The action's identifier. Pass nil to use an auto-generated identifier.
///
///
/// Returns: A new UIAction.
///
/// # Safety
///
/// `responder` must implement UIKeyInput.
#[unsafe(method(captureTextFromCameraActionForResponder:identifier:))]
#[unsafe(method_family = none)]
pub unsafe fn captureTextFromCameraActionForResponder_identifier(
responder: &UIResponder,
identifier: Option<&UIActionIdentifier>,
) -> Retained<Self>;
);
}