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 unsafe 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 unsafe fn menuForIdentifier(
31 &self,
32 identifier: &UIMenuIdentifier,
33 ) -> Option<Retained<UIMenu>>;
34
35 #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
36 /// Fetch the identified action.
37 ///
38 ///
39 /// Parameter `identifier`: The identifier of the action to fetch.
40 ///
41 /// Returns: The action with the given identifier, or `nil` if no such action.
42 #[unsafe(method(actionForIdentifier:))]
43 #[unsafe(method_family = none)]
44 unsafe fn actionForIdentifier(
45 &self,
46 identifier: &UIActionIdentifier,
47 ) -> Option<Retained<UIAction>>;
48
49 #[cfg(all(feature = "UICommand", feature = "UIMenuElement"))]
50 /// Fetch the identified command.
51 ///
52 ///
53 /// Parameter `action`: The action of the command to fetch.
54 ///
55 /// Parameter `propertyList`: Property list object to distinguish commands, if needed.
56 ///
57 /// Returns: The command with the given action and property list, or `nil` if no such command.
58 #[unsafe(method(commandForAction:propertyList:))]
59 #[unsafe(method_family = none)]
60 unsafe fn commandForAction_propertyList(
61 &self,
62 action: Sel,
63 property_list: Option<&AnyObject>,
64 ) -> Option<Retained<UICommand>>;
65
66 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
67 /// Replace an identified menu with a menu.
68 ///
69 ///
70 /// Parameter `replacedIdentifier`: The identifier of the menu to be replaced.
71 ///
72 /// Parameter `replacementGroup`: The replacement menu.
73 #[unsafe(method(replaceMenuForIdentifier:withMenu:))]
74 #[unsafe(method_family = none)]
75 unsafe fn replaceMenuForIdentifier_withMenu(
76 &self,
77 replaced_identifier: &UIMenuIdentifier,
78 replacement_menu: &UIMenu,
79 );
80
81 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement", feature = "block2"))]
82 /// Replace the children of an identified parent menu.
83 ///
84 ///
85 /// Parameter `parentIdentifier`: The identifier of the parent menu.
86 ///
87 /// Parameter `childrenBlock`: A block that returns the new children, given the old children.
88 #[unsafe(method(replaceChildrenOfMenuForIdentifier:fromChildrenBlock:))]
89 #[unsafe(method_family = none)]
90 unsafe fn replaceChildrenOfMenuForIdentifier_fromChildrenBlock(
91 &self,
92 parent_identifier: &UIMenuIdentifier,
93 children_block: &block2::Block<
94 dyn Fn(NonNull<NSArray<UIMenuElement>>) -> NonNull<NSArray<UIMenuElement>> + '_,
95 >,
96 );
97
98 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
99 /// Insert a sibling menu before an identified sibling menu.
100 ///
101 ///
102 /// Parameter `siblingGroup`: The sibling menu to insert.
103 ///
104 /// Parameter `siblingIdentifier`: The identifier of the sibling menu to insert before.
105 #[unsafe(method(insertSiblingMenu:beforeMenuForIdentifier:))]
106 #[unsafe(method_family = none)]
107 unsafe fn insertSiblingMenu_beforeMenuForIdentifier(
108 &self,
109 sibling_menu: &UIMenu,
110 sibling_identifier: &UIMenuIdentifier,
111 );
112
113 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
114 /// Insert a sibling menu after an identified sibling menu.
115 ///
116 ///
117 /// Parameter `siblingGroup`: The sibling menu to insert.
118 ///
119 /// Parameter `siblingIdentifier`: The identifier of the sibling menu to insert after.
120 #[unsafe(method(insertSiblingMenu:afterMenuForIdentifier:))]
121 #[unsafe(method_family = none)]
122 unsafe fn insertSiblingMenu_afterMenuForIdentifier(
123 &self,
124 sibling_menu: &UIMenu,
125 sibling_identifier: &UIMenuIdentifier,
126 );
127
128 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
129 /// Insert a child menu at the start of an identified parent menu.
130 ///
131 ///
132 /// Parameter `childGroup`: The child menu to insert.
133 ///
134 /// Parameter `parentIdentifier`: The identifier of the parent menu to insert at the start of.
135 #[unsafe(method(insertChildMenu:atStartOfMenuForIdentifier:))]
136 #[unsafe(method_family = none)]
137 unsafe fn insertChildMenu_atStartOfMenuForIdentifier(
138 &self,
139 child_menu: &UIMenu,
140 parent_identifier: &UIMenuIdentifier,
141 );
142
143 #[cfg(all(feature = "UIMenu", feature = "UIMenuElement"))]
144 /// Insert a child menu at the end of an identified parent menu.
145 ///
146 ///
147 /// Parameter `childGroup`: The child menu to insert.
148 ///
149 /// Parameter `parentIdentifier`: The identifier of the parent menu to insert at the end of.
150 #[unsafe(method(insertChildMenu:atEndOfMenuForIdentifier:))]
151 #[unsafe(method_family = none)]
152 unsafe fn insertChildMenu_atEndOfMenuForIdentifier(
153 &self,
154 child_menu: &UIMenu,
155 parent_identifier: &UIMenuIdentifier,
156 );
157
158 #[cfg(feature = "UIMenu")]
159 /// Remove an identified menu.
160 ///
161 ///
162 /// Parameter `removedIdentifier`: The menu to remove.
163 #[unsafe(method(removeMenuForIdentifier:))]
164 #[unsafe(method_family = none)]
165 unsafe fn removeMenuForIdentifier(&self, removed_identifier: &UIMenuIdentifier);
166 }
167);