objc2_ui_kit/generated/
UIMainMenuSystem.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_class!(
11    /// The main menu system.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uimainmenusystem?language=objc)
14    #[unsafe(super(UIMenuSystem, NSObject))]
15    #[thread_kind = MainThreadOnly]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[cfg(feature = "UIMenuSystem")]
18    pub struct UIMainMenuSystem;
19);
20
21#[cfg(feature = "UIMenuSystem")]
22extern_conformance!(
23    unsafe impl NSObjectProtocol for UIMainMenuSystem {}
24);
25
26#[cfg(feature = "UIMenuSystem")]
27impl UIMainMenuSystem {
28    extern_methods!(
29        /// The shared main menu system.
30        #[unsafe(method(sharedSystem))]
31        #[unsafe(method_family = none)]
32        pub fn sharedSystem(mtm: MainThreadMarker) -> Retained<UIMainMenuSystem>;
33
34        #[cfg(all(feature = "UIMenuBuilder", feature = "block2"))]
35        /// Specifies that the main menu system should be built using the specified configuration.
36        /// A build handler can be optionally provided, which the main menu system will use instead of calling `-buildMenuWithBuilder:`.
37        /// Setting this will invalidate and rebuild the main menu system. Ideally it should be set once, and as early as possible, preferably in `-application:didFinishLaunchingWithOptions:`.
38        /// Subsequent rebuilds of the main menu system will continue to use this `configuration` and `buildHandler`.
39        /// It is a developer error to set the `configuration` while the main menu system is building. Doing so will assert.
40        #[unsafe(method(setBuildConfiguration:buildHandler:))]
41        #[unsafe(method_family = none)]
42        pub fn setBuildConfiguration_buildHandler(
43            &self,
44            configuration: &UIMainMenuSystemConfiguration,
45            build_handler: Option<
46                &block2::DynBlock<dyn Fn(NonNull<ProtocolObject<dyn UIMenuBuilder>>)>,
47            >,
48        );
49
50        #[unsafe(method(mainSystem))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn mainSystem(mtm: MainThreadMarker) -> Retained<UIMenuSystem>;
53
54        #[unsafe(method(contextSystem))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn contextSystem(mtm: MainThreadMarker) -> Retained<UIMenuSystem>;
57    );
58}
59
60/// Methods declared on superclass `UIMenuSystem`.
61#[cfg(feature = "UIMenuSystem")]
62impl UIMainMenuSystem {
63    extern_methods!(
64        #[unsafe(method(new))]
65        #[unsafe(method_family = new)]
66        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
67
68        #[unsafe(method(init))]
69        #[unsafe(method_family = init)]
70        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
71    );
72}
73
74extern_class!(
75    /// A configuration for the main menu system.
76    /// You can specify whether or not certain elements are present in the initial main menu, as well as a block to build the menu using a UIMenuBuilder.
77    ///
78    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uimainmenusystemconfiguration?language=objc)
79    #[unsafe(super(NSObject))]
80    #[thread_kind = MainThreadOnly]
81    #[derive(Debug, PartialEq, Eq, Hash)]
82    pub struct UIMainMenuSystemConfiguration;
83);
84
85extern_conformance!(
86    unsafe impl NSCopying for UIMainMenuSystemConfiguration {}
87);
88
89unsafe impl CopyingHelper for UIMainMenuSystemConfiguration {
90    type Result = Self;
91}
92
93extern_conformance!(
94    unsafe impl NSObjectProtocol for UIMainMenuSystemConfiguration {}
95);
96
97impl UIMainMenuSystemConfiguration {
98    extern_methods!(
99        #[cfg(feature = "UIMenuSystem")]
100        /// Specifies a preference for new scene elements in the main menu.
101        #[unsafe(method(newScenePreference))]
102        #[unsafe(method_family = none)]
103        pub fn newScenePreference(&self) -> UIMenuSystemElementGroupPreference;
104
105        #[cfg(feature = "UIMenuSystem")]
106        /// Setter for [`newScenePreference`][Self::newScenePreference].
107        #[unsafe(method(setNewScenePreference:))]
108        #[unsafe(method_family = none)]
109        pub fn setNewScenePreference(
110            &self,
111            new_scene_preference: UIMenuSystemElementGroupPreference,
112        );
113
114        #[cfg(feature = "UIMenuSystem")]
115        /// Specifies a preference for document elements in the main menu.
116        #[unsafe(method(documentPreference))]
117        #[unsafe(method_family = none)]
118        pub fn documentPreference(&self) -> UIMenuSystemElementGroupPreference;
119
120        #[cfg(feature = "UIMenuSystem")]
121        /// Setter for [`documentPreference`][Self::documentPreference].
122        #[unsafe(method(setDocumentPreference:))]
123        #[unsafe(method_family = none)]
124        pub fn setDocumentPreference(
125            &self,
126            document_preference: UIMenuSystemElementGroupPreference,
127        );
128
129        #[cfg(feature = "UIMenuSystem")]
130        /// Specifies a preference for printing elements in the main menu.
131        #[unsafe(method(printingPreference))]
132        #[unsafe(method_family = none)]
133        pub fn printingPreference(&self) -> UIMenuSystemElementGroupPreference;
134
135        #[cfg(feature = "UIMenuSystem")]
136        /// Setter for [`printingPreference`][Self::printingPreference].
137        #[unsafe(method(setPrintingPreference:))]
138        #[unsafe(method_family = none)]
139        pub fn setPrintingPreference(
140            &self,
141            printing_preference: UIMenuSystemElementGroupPreference,
142        );
143
144        #[cfg(feature = "UIMenuSystem")]
145        /// Specifies a preference for finding elements in the main menu.
146        #[unsafe(method(findingPreference))]
147        #[unsafe(method_family = none)]
148        pub fn findingPreference(&self) -> UIMenuSystemElementGroupPreference;
149
150        #[cfg(feature = "UIMenuSystem")]
151        /// Setter for [`findingPreference`][Self::findingPreference].
152        #[unsafe(method(setFindingPreference:))]
153        #[unsafe(method_family = none)]
154        pub fn setFindingPreference(&self, finding_preference: UIMenuSystemElementGroupPreference);
155
156        #[cfg(feature = "UIMenuSystem")]
157        /// Configuration for the find elements should they be present in the main menu.
158        #[unsafe(method(findingConfiguration))]
159        #[unsafe(method_family = none)]
160        pub fn findingConfiguration(&self) -> Retained<UIMenuSystemFindElementGroupConfiguration>;
161
162        #[cfg(feature = "UIMenuSystem")]
163        /// Specifies a preference for toolbar elements in the main menu.
164        #[unsafe(method(toolbarPreference))]
165        #[unsafe(method_family = none)]
166        pub fn toolbarPreference(&self) -> UIMenuSystemElementGroupPreference;
167
168        #[cfg(feature = "UIMenuSystem")]
169        /// Setter for [`toolbarPreference`][Self::toolbarPreference].
170        #[unsafe(method(setToolbarPreference:))]
171        #[unsafe(method_family = none)]
172        pub fn setToolbarPreference(&self, toolbar_preference: UIMenuSystemElementGroupPreference);
173
174        #[cfg(feature = "UIMenuSystem")]
175        /// Specifies a preference for sidebar elements in the main menu.
176        #[unsafe(method(sidebarPreference))]
177        #[unsafe(method_family = none)]
178        pub fn sidebarPreference(&self) -> UIMenuSystemElementGroupPreference;
179
180        #[cfg(feature = "UIMenuSystem")]
181        /// Setter for [`sidebarPreference`][Self::sidebarPreference].
182        #[unsafe(method(setSidebarPreference:))]
183        #[unsafe(method_family = none)]
184        pub fn setSidebarPreference(&self, sidebar_preference: UIMenuSystemElementGroupPreference);
185
186        #[cfg(feature = "UIMenuSystem")]
187        /// Specifies a preference for inspector elements in the main menu.
188        #[unsafe(method(inspectorPreference))]
189        #[unsafe(method_family = none)]
190        pub fn inspectorPreference(&self) -> UIMenuSystemElementGroupPreference;
191
192        #[cfg(feature = "UIMenuSystem")]
193        /// Setter for [`inspectorPreference`][Self::inspectorPreference].
194        #[unsafe(method(setInspectorPreference:))]
195        #[unsafe(method_family = none)]
196        pub fn setInspectorPreference(
197            &self,
198            inspector_preference: UIMenuSystemElementGroupPreference,
199        );
200
201        #[cfg(feature = "UIMenuSystem")]
202        /// Specifies a preference for text formatting elements in the main menu.
203        #[unsafe(method(textFormattingPreference))]
204        #[unsafe(method_family = none)]
205        pub fn textFormattingPreference(&self) -> UIMenuSystemElementGroupPreference;
206
207        #[cfg(feature = "UIMenuSystem")]
208        /// Setter for [`textFormattingPreference`][Self::textFormattingPreference].
209        #[unsafe(method(setTextFormattingPreference:))]
210        #[unsafe(method_family = none)]
211        pub fn setTextFormattingPreference(
212            &self,
213            text_formatting_preference: UIMenuSystemElementGroupPreference,
214        );
215    );
216}
217
218/// Methods declared on superclass `NSObject`.
219impl UIMainMenuSystemConfiguration {
220    extern_methods!(
221        #[unsafe(method(init))]
222        #[unsafe(method_family = init)]
223        pub fn init(this: Allocated<Self>) -> Retained<Self>;
224
225        #[unsafe(method(new))]
226        #[unsafe(method_family = new)]
227        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
228    );
229}