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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
//! 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::*;
extern_protocol!(
/// Encapsulates access and mutation for a menu hierarchy.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uimenubuilder?language=objc)
pub unsafe trait UIMenuBuilder: MainThreadOnly {
#[cfg(feature = "UIMenuSystem")]
/// Which system we are building for.
#[unsafe(method(system))]
#[unsafe(method_family = none)]
fn system(&self) -> Retained<UIMenuSystem>;
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
/// Fetch the identified menu.
///
///
/// Parameter `identifier`: The identifier of the menu to fetch.
///
/// Returns: The menu with the given identifier, or `nil` if no such menu.
#[unsafe(method(menuForIdentifier:))]
#[unsafe(method_family = none)]
fn menuForIdentifier(&self, identifier: &UIMenuIdentifier) -> Option<Retained<UIMenu>>;
#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
/// Fetch the identified action.
///
///
/// Parameter `identifier`: The identifier of the action to fetch.
///
/// Returns: The action with the given identifier, or `nil` if no such action.
#[unsafe(method(actionForIdentifier:))]
#[unsafe(method_family = none)]
fn actionForIdentifier(
&self,
identifier: &UIActionIdentifier,
) -> Option<Retained<UIAction>>;
#[cfg(all(feature = "UICommand", feature = "UIMenuElement"))]
/// Fetch the identified command.
///
///
/// Parameter `action`: The action of the command to fetch.
///
/// Parameter `propertyList`: Property list object to distinguish commands, if needed.
///
/// Returns: The command with the given action and property list, or `nil` if no such command.
///
/// # Safety
///
/// - `action` must be a valid selector.
/// - `property_list` should be of the correct type.
#[unsafe(method(commandForAction:propertyList:))]
#[unsafe(method_family = none)]
unsafe fn commandForAction_propertyList(
&self,
action: Sel,
property_list: Option<&AnyObject>,
) -> Option<Retained<UICommand>>;
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
/// Replace an identified menu with a menu.
///
///
/// Parameter `replacedIdentifier`: The identifier of the menu to be replaced.
///
/// Parameter `replacementGroup`: The replacement menu.
#[unsafe(method(replaceMenuForIdentifier:withMenu:))]
#[unsafe(method_family = none)]
fn replaceMenuForIdentifier_withMenu(
&self,
replaced_identifier: &UIMenuIdentifier,
replacement_menu: &UIMenu,
);
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
/// Replace the children of an identified parent menu.
///
///
/// Parameter `parentIdentifier`: The identifier of the parent menu.
///
/// Parameter `childrenBlock`: A block that returns the new children, given the old children.
///
/// # Safety
///
/// `children_block` block's return must be a valid pointer.
#[unsafe(method(replaceChildrenOfMenuForIdentifier:fromChildrenBlock:))]
#[unsafe(method_family = none)]
unsafe fn replaceChildrenOfMenuForIdentifier_fromChildrenBlock(
&self,
parent_identifier: &UIMenuIdentifier,
children_block: &block2::DynBlock<
dyn Fn(NonNull<NSArray<UIMenuElement>>) -> NonNull<NSArray<UIMenuElement>> + '_,
>,
);
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
/// Replace an identified menu with menu elements.
///
///
/// Parameter `replacedIdentifier`: The identifier of the menu to be replaced.
///
/// Parameter `replacementElements`: The replacement elements.
#[unsafe(method(replaceMenuForIdentifier:withElements:))]
#[unsafe(method_family = none)]
fn replaceMenuForIdentifier_withElements(
&self,
replaced_identifier: &UIMenuIdentifier,
replacement_elements: &NSArray<UIMenuElement>,
);
#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
/// Replace an identified action with menu elements.
///
///
/// Parameter `replacedIdentifier`: The identifier of the action to be replaced.
///
/// Parameter `replacementElements`: The replacement elements.
#[unsafe(method(replaceActionForIdentifier:withElements:))]
#[unsafe(method_family = none)]
fn replaceActionForIdentifier_withElements(
&self,
replaced_identifier: &UIActionIdentifier,
replacement_elements: &NSArray<UIMenuElement>,
);
#[cfg(feature = "UIMenuElement")]
/// Replace an identified command with menu elements.
///
///
/// Parameter `replacedAction`: The action of the command to be replaced.
///
/// Parameter `replacedPropertyList`: Property list object to distinguish commands, if needed.
///
/// Parameter `replacementElements`: The replacement elements.
///
/// # Safety
///
/// - `replaced_action` must be a valid selector.
/// - `replaced_property_list` should be of the correct type.
#[unsafe(method(replaceCommandForAction:propertyList:withElements:))]
#[unsafe(method_family = none)]
unsafe fn replaceCommandForAction_propertyList_withElements(
&self,
replaced_action: Sel,
replaced_property_list: Option<&AnyObject>,
replacement_elements: &NSArray<UIMenuElement>,
);
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
/// Insert a sibling menu before an identified sibling menu.
///
///
/// Parameter `siblingGroup`: The sibling menu to insert.
///
/// Parameter `siblingIdentifier`: The identifier of the sibling menu to insert before.
#[unsafe(method(insertSiblingMenu:beforeMenuForIdentifier:))]
#[unsafe(method_family = none)]
fn insertSiblingMenu_beforeMenuForIdentifier(
&self,
sibling_menu: &UIMenu,
sibling_identifier: &UIMenuIdentifier,
);
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
/// Insert elements before an identified menu.
///
///
/// Parameter `insertedElements`: The elements to insert.
///
/// Parameter `siblingIdentifier`: The identifier of the menu to insert elements before.
#[unsafe(method(insertElements:beforeMenuForIdentifier:))]
#[unsafe(method_family = none)]
fn insertElements_beforeMenuForIdentifier(
&self,
inserted_elements: &NSArray<UIMenuElement>,
sibling_identifier: &UIMenuIdentifier,
);
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
/// Insert elements after an identified menu.
///
///
/// Parameter `insertedElements`: The elements to insert.
///
/// Parameter `siblingIdentifier`: The identifier of the menu to insert elements after.
#[unsafe(method(insertElements:afterMenuForIdentifier:))]
#[unsafe(method_family = none)]
fn insertElements_afterMenuForIdentifier(
&self,
inserted_elements: &NSArray<UIMenuElement>,
sibling_identifier: &UIMenuIdentifier,
);
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
/// Insert a sibling menu after an identified sibling menu.
///
///
/// Parameter `siblingGroup`: The sibling menu to insert.
///
/// Parameter `siblingIdentifier`: The identifier of the sibling menu to insert after.
#[unsafe(method(insertSiblingMenu:afterMenuForIdentifier:))]
#[unsafe(method_family = none)]
fn insertSiblingMenu_afterMenuForIdentifier(
&self,
sibling_menu: &UIMenu,
sibling_identifier: &UIMenuIdentifier,
);
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
/// Insert a child menu at the start of an identified parent menu.
///
///
/// Parameter `childGroup`: The child menu to insert.
///
/// Parameter `parentIdentifier`: The identifier of the parent menu to insert at the start of.
#[unsafe(method(insertChildMenu:atStartOfMenuForIdentifier:))]
#[unsafe(method_family = none)]
fn insertChildMenu_atStartOfMenuForIdentifier(
&self,
child_menu: &UIMenu,
parent_identifier: &UIMenuIdentifier,
);
#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
/// Insert elements before an identified action.
///
///
/// Parameter `insertedElements`: The elements to insert.
///
/// Parameter `siblingIdentifier`: The identifier of the action to insert elements before.
#[unsafe(method(insertElements:beforeActionForIdentifier:))]
#[unsafe(method_family = none)]
fn insertElements_beforeActionForIdentifier(
&self,
inserted_elements: &NSArray<UIMenuElement>,
sibling_identifier: &UIActionIdentifier,
);
#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
/// Insert elements after an identified action.
///
///
/// Parameter `insertedElements`: The elements to insert.
///
/// Parameter `siblingIdentifier`: The identifier of the action to insert elements after.
#[unsafe(method(insertElements:afterActionForIdentifier:))]
#[unsafe(method_family = none)]
fn insertElements_afterActionForIdentifier(
&self,
inserted_elements: &NSArray<UIMenuElement>,
sibling_identifier: &UIActionIdentifier,
);
#[cfg(feature = "UIMenuElement")]
/// Insert elements before an identified command.
///
///
/// Parameter `insertedElements`: The elements to insert.
///
/// Parameter `siblingAction`: The action of the command to insert elements before.
///
/// Parameter `siblingPropertyList`: Property list object to distinguish commands, if needed.
///
/// # Safety
///
/// - `sibling_action` must be a valid selector.
/// - `sibling_property_list` should be of the correct type.
#[unsafe(method(insertElements:beforeCommandForAction:propertyList:))]
#[unsafe(method_family = none)]
unsafe fn insertElements_beforeCommandForAction_propertyList(
&self,
inserted_elements: &NSArray<UIMenuElement>,
sibling_action: Sel,
sibling_property_list: Option<&AnyObject>,
);
#[cfg(feature = "UIMenuElement")]
/// Insert elements after an identified command.
///
///
/// Parameter `insertedElements`: The elements to insert.
///
/// Parameter `siblingAction`: The action of the command to insert elements after.
///
/// Parameter `siblingPropertyList`: Property list object to distinguish commands, if needed.
///
/// # Safety
///
/// - `sibling_action` must be a valid selector.
/// - `sibling_property_list` should be of the correct type.
#[unsafe(method(insertElements:afterCommandForAction:propertyList:))]
#[unsafe(method_family = none)]
unsafe fn insertElements_afterCommandForAction_propertyList(
&self,
inserted_elements: &NSArray<UIMenuElement>,
sibling_action: Sel,
sibling_property_list: Option<&AnyObject>,
);
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
/// Insert elements at the start of an identified parent menu.
///
///
/// Parameter `childElements`: The child elements to insert.
///
/// Parameter `parentIdentifier`: The identifier of the parent menu to insert elements at the start of.
#[unsafe(method(insertElements:atStartOfMenuForIdentifier:))]
#[unsafe(method_family = none)]
fn insertElements_atStartOfMenuForIdentifier(
&self,
child_elements: &NSArray<UIMenuElement>,
parent_identifier: &UIMenuIdentifier,
);
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
/// Insert a child menu at the end of an identified parent menu.
///
///
/// Parameter `childGroup`: The child menu to insert.
///
/// Parameter `parentIdentifier`: The identifier of the parent menu to insert at the end of.
#[unsafe(method(insertChildMenu:atEndOfMenuForIdentifier:))]
#[unsafe(method_family = none)]
fn insertChildMenu_atEndOfMenuForIdentifier(
&self,
child_menu: &UIMenu,
parent_identifier: &UIMenuIdentifier,
);
#[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
/// Insert elements at the end of an identified parent menu.
///
///
/// Parameter `childElements`: The child elements to insert.
///
/// Parameter `parentIdentifier`: The identifier of the parent menu to insert elements at the end of.
#[unsafe(method(insertElements:atEndOfMenuForIdentifier:))]
#[unsafe(method_family = none)]
fn insertElements_atEndOfMenuForIdentifier(
&self,
child_elements: &NSArray<UIMenuElement>,
parent_identifier: &UIMenuIdentifier,
);
#[cfg(feature = "UIMenu")]
/// Remove an identified menu.
///
///
/// Parameter `removedIdentifier`: The menu to remove.
#[unsafe(method(removeMenuForIdentifier:))]
#[unsafe(method_family = none)]
fn removeMenuForIdentifier(&self, removed_identifier: &UIMenuIdentifier);
#[cfg(feature = "UIAction")]
/// Remove an identified action.
///
///
/// Parameter `removedIdentifier`: The identifier of the action to remove.
#[unsafe(method(removeActionForIdentifier:))]
#[unsafe(method_family = none)]
fn removeActionForIdentifier(&self, removed_identifier: &UIActionIdentifier);
/// Remove an identified command.
///
///
/// Parameter `removedAction`: The action of the command to remove.
///
/// Parameter `removedPropertyList`: Property list object to distinguish commands, if needed.
///
/// # Safety
///
/// - `removed_action` must be a valid selector.
/// - `removed_property_list` should be of the correct type.
#[unsafe(method(removeCommandForAction:propertyList:))]
#[unsafe(method_family = none)]
unsafe fn removeCommandForAction_propertyList(
&self,
removed_action: Sel,
removed_property_list: Option<&AnyObject>,
);
}
);