objc2_ui_kit/generated/UIMenuBuilder.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_protocol!(
11 /// Encapsulates access and mutation for a menu hierarchy.
12 ///
13 /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uimenubuilder?language=objc)
14 pub unsafe trait UIMenuBuilder: MainThreadOnly {
15 #[cfg(feature = "UIMenuSystem")]
16 /// Which system we are building for.
17 #[unsafe(method(system))]
18 #[unsafe(method_family = none)]
19 fn system(&self) -> Retained<UIMenuSystem>;
20
21 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
22 /// Fetch the identified menu.
23 ///
24 ///
25 /// Parameter `identifier`: The identifier of the menu to fetch.
26 ///
27 /// Returns: The menu with the given identifier, or `nil` if no such menu.
28 #[unsafe(method(menuForIdentifier:))]
29 #[unsafe(method_family = none)]
30 fn menuForIdentifier(&self, identifier: &UIMenuIdentifier) -> Option<Retained<UIMenu>>;
31
32 #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
33 /// Fetch the identified action.
34 ///
35 ///
36 /// Parameter `identifier`: The identifier of the action to fetch.
37 ///
38 /// Returns: The action with the given identifier, or `nil` if no such action.
39 #[unsafe(method(actionForIdentifier:))]
40 #[unsafe(method_family = none)]
41 fn actionForIdentifier(
42 &self,
43 identifier: &UIActionIdentifier,
44 ) -> Option<Retained<UIAction>>;
45
46 #[cfg(all(feature = "UICommand", feature = "UIMenuElement"))]
47 /// Fetch the identified command.
48 ///
49 ///
50 /// Parameter `action`: The action of the command to fetch.
51 ///
52 /// Parameter `propertyList`: Property list object to distinguish commands, if needed.
53 ///
54 /// Returns: The command with the given action and property list, or `nil` if no such command.
55 ///
56 /// # Safety
57 ///
58 /// - `action` must be a valid selector.
59 /// - `property_list` should be of the correct type.
60 #[unsafe(method(commandForAction:propertyList:))]
61 #[unsafe(method_family = none)]
62 unsafe fn commandForAction_propertyList(
63 &self,
64 action: Sel,
65 property_list: Option<&AnyObject>,
66 ) -> Option<Retained<UICommand>>;
67
68 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
69 /// Replace an identified menu with a menu.
70 ///
71 ///
72 /// Parameter `replacedIdentifier`: The identifier of the menu to be replaced.
73 ///
74 /// Parameter `replacementGroup`: The replacement menu.
75 #[unsafe(method(replaceMenuForIdentifier:withMenu:))]
76 #[unsafe(method_family = none)]
77 fn replaceMenuForIdentifier_withMenu(
78 &self,
79 replaced_identifier: &UIMenuIdentifier,
80 replacement_menu: &UIMenu,
81 );
82
83 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
84 /// Replace the children of an identified parent menu.
85 ///
86 ///
87 /// Parameter `parentIdentifier`: The identifier of the parent menu.
88 ///
89 /// Parameter `childrenBlock`: A block that returns the new children, given the old children.
90 ///
91 /// # Safety
92 ///
93 /// `children_block` block's return must be a valid pointer.
94 #[unsafe(method(replaceChildrenOfMenuForIdentifier:fromChildrenBlock:))]
95 #[unsafe(method_family = none)]
96 unsafe fn replaceChildrenOfMenuForIdentifier_fromChildrenBlock(
97 &self,
98 parent_identifier: &UIMenuIdentifier,
99 children_block: &block2::DynBlock<
100 dyn Fn(NonNull<NSArray<UIMenuElement>>) -> NonNull<NSArray<UIMenuElement>> + '_,
101 >,
102 );
103
104 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
105 /// Replace an identified menu with menu elements.
106 ///
107 ///
108 /// Parameter `replacedIdentifier`: The identifier of the menu to be replaced.
109 ///
110 /// Parameter `replacementElements`: The replacement elements.
111 #[unsafe(method(replaceMenuForIdentifier:withElements:))]
112 #[unsafe(method_family = none)]
113 fn replaceMenuForIdentifier_withElements(
114 &self,
115 replaced_identifier: &UIMenuIdentifier,
116 replacement_elements: &NSArray<UIMenuElement>,
117 );
118
119 #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
120 /// Replace an identified action with menu elements.
121 ///
122 ///
123 /// Parameter `replacedIdentifier`: The identifier of the action to be replaced.
124 ///
125 /// Parameter `replacementElements`: The replacement elements.
126 #[unsafe(method(replaceActionForIdentifier:withElements:))]
127 #[unsafe(method_family = none)]
128 fn replaceActionForIdentifier_withElements(
129 &self,
130 replaced_identifier: &UIActionIdentifier,
131 replacement_elements: &NSArray<UIMenuElement>,
132 );
133
134 #[cfg(feature = "UIMenuElement")]
135 /// Replace an identified command with menu elements.
136 ///
137 ///
138 /// Parameter `replacedAction`: The action of the command to be replaced.
139 ///
140 /// Parameter `replacedPropertyList`: Property list object to distinguish commands, if needed.
141 ///
142 /// Parameter `replacementElements`: The replacement elements.
143 ///
144 /// # Safety
145 ///
146 /// - `replaced_action` must be a valid selector.
147 /// - `replaced_property_list` should be of the correct type.
148 #[unsafe(method(replaceCommandForAction:propertyList:withElements:))]
149 #[unsafe(method_family = none)]
150 unsafe fn replaceCommandForAction_propertyList_withElements(
151 &self,
152 replaced_action: Sel,
153 replaced_property_list: Option<&AnyObject>,
154 replacement_elements: &NSArray<UIMenuElement>,
155 );
156
157 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
158 /// Insert a sibling menu before an identified sibling menu.
159 ///
160 ///
161 /// Parameter `siblingGroup`: The sibling menu to insert.
162 ///
163 /// Parameter `siblingIdentifier`: The identifier of the sibling menu to insert before.
164 #[unsafe(method(insertSiblingMenu:beforeMenuForIdentifier:))]
165 #[unsafe(method_family = none)]
166 fn insertSiblingMenu_beforeMenuForIdentifier(
167 &self,
168 sibling_menu: &UIMenu,
169 sibling_identifier: &UIMenuIdentifier,
170 );
171
172 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
173 /// Insert elements before an identified menu.
174 ///
175 ///
176 /// Parameter `insertedElements`: The elements to insert.
177 ///
178 /// Parameter `siblingIdentifier`: The identifier of the menu to insert elements before.
179 #[unsafe(method(insertElements:beforeMenuForIdentifier:))]
180 #[unsafe(method_family = none)]
181 fn insertElements_beforeMenuForIdentifier(
182 &self,
183 inserted_elements: &NSArray<UIMenuElement>,
184 sibling_identifier: &UIMenuIdentifier,
185 );
186
187 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
188 /// Insert elements after an identified menu.
189 ///
190 ///
191 /// Parameter `insertedElements`: The elements to insert.
192 ///
193 /// Parameter `siblingIdentifier`: The identifier of the menu to insert elements after.
194 #[unsafe(method(insertElements:afterMenuForIdentifier:))]
195 #[unsafe(method_family = none)]
196 fn insertElements_afterMenuForIdentifier(
197 &self,
198 inserted_elements: &NSArray<UIMenuElement>,
199 sibling_identifier: &UIMenuIdentifier,
200 );
201
202 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
203 /// Insert a sibling menu after an identified sibling menu.
204 ///
205 ///
206 /// Parameter `siblingGroup`: The sibling menu to insert.
207 ///
208 /// Parameter `siblingIdentifier`: The identifier of the sibling menu to insert after.
209 #[unsafe(method(insertSiblingMenu:afterMenuForIdentifier:))]
210 #[unsafe(method_family = none)]
211 fn insertSiblingMenu_afterMenuForIdentifier(
212 &self,
213 sibling_menu: &UIMenu,
214 sibling_identifier: &UIMenuIdentifier,
215 );
216
217 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
218 /// Insert a child menu at the start of an identified parent menu.
219 ///
220 ///
221 /// Parameter `childGroup`: The child menu to insert.
222 ///
223 /// Parameter `parentIdentifier`: The identifier of the parent menu to insert at the start of.
224 #[unsafe(method(insertChildMenu:atStartOfMenuForIdentifier:))]
225 #[unsafe(method_family = none)]
226 fn insertChildMenu_atStartOfMenuForIdentifier(
227 &self,
228 child_menu: &UIMenu,
229 parent_identifier: &UIMenuIdentifier,
230 );
231
232 #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
233 /// Insert elements before an identified action.
234 ///
235 ///
236 /// Parameter `insertedElements`: The elements to insert.
237 ///
238 /// Parameter `siblingIdentifier`: The identifier of the action to insert elements before.
239 #[unsafe(method(insertElements:beforeActionForIdentifier:))]
240 #[unsafe(method_family = none)]
241 fn insertElements_beforeActionForIdentifier(
242 &self,
243 inserted_elements: &NSArray<UIMenuElement>,
244 sibling_identifier: &UIActionIdentifier,
245 );
246
247 #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
248 /// Insert elements after an identified action.
249 ///
250 ///
251 /// Parameter `insertedElements`: The elements to insert.
252 ///
253 /// Parameter `siblingIdentifier`: The identifier of the action to insert elements after.
254 #[unsafe(method(insertElements:afterActionForIdentifier:))]
255 #[unsafe(method_family = none)]
256 fn insertElements_afterActionForIdentifier(
257 &self,
258 inserted_elements: &NSArray<UIMenuElement>,
259 sibling_identifier: &UIActionIdentifier,
260 );
261
262 #[cfg(feature = "UIMenuElement")]
263 /// Insert elements before an identified command.
264 ///
265 ///
266 /// Parameter `insertedElements`: The elements to insert.
267 ///
268 /// Parameter `siblingAction`: The action of the command to insert elements before.
269 ///
270 /// Parameter `siblingPropertyList`: Property list object to distinguish commands, if needed.
271 ///
272 /// # Safety
273 ///
274 /// - `sibling_action` must be a valid selector.
275 /// - `sibling_property_list` should be of the correct type.
276 #[unsafe(method(insertElements:beforeCommandForAction:propertyList:))]
277 #[unsafe(method_family = none)]
278 unsafe fn insertElements_beforeCommandForAction_propertyList(
279 &self,
280 inserted_elements: &NSArray<UIMenuElement>,
281 sibling_action: Sel,
282 sibling_property_list: Option<&AnyObject>,
283 );
284
285 #[cfg(feature = "UIMenuElement")]
286 /// Insert elements after an identified command.
287 ///
288 ///
289 /// Parameter `insertedElements`: The elements to insert.
290 ///
291 /// Parameter `siblingAction`: The action of the command to insert elements after.
292 ///
293 /// Parameter `siblingPropertyList`: Property list object to distinguish commands, if needed.
294 ///
295 /// # Safety
296 ///
297 /// - `sibling_action` must be a valid selector.
298 /// - `sibling_property_list` should be of the correct type.
299 #[unsafe(method(insertElements:afterCommandForAction:propertyList:))]
300 #[unsafe(method_family = none)]
301 unsafe fn insertElements_afterCommandForAction_propertyList(
302 &self,
303 inserted_elements: &NSArray<UIMenuElement>,
304 sibling_action: Sel,
305 sibling_property_list: Option<&AnyObject>,
306 );
307
308 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
309 /// Insert elements at the start of an identified parent menu.
310 ///
311 ///
312 /// Parameter `childElements`: The child elements to insert.
313 ///
314 /// Parameter `parentIdentifier`: The identifier of the parent menu to insert elements at the start of.
315 #[unsafe(method(insertElements:atStartOfMenuForIdentifier:))]
316 #[unsafe(method_family = none)]
317 fn insertElements_atStartOfMenuForIdentifier(
318 &self,
319 child_elements: &NSArray<UIMenuElement>,
320 parent_identifier: &UIMenuIdentifier,
321 );
322
323 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
324 /// Insert a child menu at the end of an identified parent menu.
325 ///
326 ///
327 /// Parameter `childGroup`: The child menu to insert.
328 ///
329 /// Parameter `parentIdentifier`: The identifier of the parent menu to insert at the end of.
330 #[unsafe(method(insertChildMenu:atEndOfMenuForIdentifier:))]
331 #[unsafe(method_family = none)]
332 fn insertChildMenu_atEndOfMenuForIdentifier(
333 &self,
334 child_menu: &UIMenu,
335 parent_identifier: &UIMenuIdentifier,
336 );
337
338 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
339 /// Insert elements at the end of an identified parent menu.
340 ///
341 ///
342 /// Parameter `childElements`: The child elements to insert.
343 ///
344 /// Parameter `parentIdentifier`: The identifier of the parent menu to insert elements at the end of.
345 #[unsafe(method(insertElements:atEndOfMenuForIdentifier:))]
346 #[unsafe(method_family = none)]
347 fn insertElements_atEndOfMenuForIdentifier(
348 &self,
349 child_elements: &NSArray<UIMenuElement>,
350 parent_identifier: &UIMenuIdentifier,
351 );
352
353 #[cfg(feature = "UIMenu")]
354 /// Remove an identified menu.
355 ///
356 ///
357 /// Parameter `removedIdentifier`: The menu to remove.
358 #[unsafe(method(removeMenuForIdentifier:))]
359 #[unsafe(method_family = none)]
360 fn removeMenuForIdentifier(&self, removed_identifier: &UIMenuIdentifier);
361
362 #[cfg(feature = "UIAction")]
363 /// Remove an identified action.
364 ///
365 ///
366 /// Parameter `removedIdentifier`: The identifier of the action to remove.
367 #[unsafe(method(removeActionForIdentifier:))]
368 #[unsafe(method_family = none)]
369 fn removeActionForIdentifier(&self, removed_identifier: &UIActionIdentifier);
370
371 /// Remove an identified command.
372 ///
373 ///
374 /// Parameter `removedAction`: The action of the command to remove.
375 ///
376 /// Parameter `removedPropertyList`: Property list object to distinguish commands, if needed.
377 ///
378 /// # Safety
379 ///
380 /// - `removed_action` must be a valid selector.
381 /// - `removed_property_list` should be of the correct type.
382 #[unsafe(method(removeCommandForAction:propertyList:))]
383 #[unsafe(method_family = none)]
384 unsafe fn removeCommandForAction_propertyList(
385 &self,
386 removed_action: Sel,
387 removed_property_list: Option<&AnyObject>,
388 );
389 }
390);