objc2_ui_kit/generated/
UIMenuSystem.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::*;
6
7use crate::*;
8
9extern_class!(
10    /// The command system to build or rebuild.
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uimenusystem?language=objc)
13    #[unsafe(super(NSObject))]
14    #[thread_kind = MainThreadOnly]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct UIMenuSystem;
17);
18
19extern_conformance!(
20    unsafe impl NSObjectProtocol for UIMenuSystem {}
21);
22
23impl UIMenuSystem {
24    extern_methods!(
25        /// The main menu system. This is identical to `UIMainMenuSystem.sharedSystem`.
26        #[unsafe(method(mainSystem))]
27        #[unsafe(method_family = none)]
28        pub fn mainSystem(mtm: MainThreadMarker) -> Retained<UIMenuSystem>;
29
30        /// The context menu system. This is identical to `UIContextMenuSystem.sharedSystem`.
31        #[unsafe(method(contextSystem))]
32        #[unsafe(method_family = none)]
33        pub fn contextSystem(mtm: MainThreadMarker) -> Retained<UIMenuSystem>;
34
35        #[unsafe(method(new))]
36        #[unsafe(method_family = new)]
37        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
38
39        #[unsafe(method(init))]
40        #[unsafe(method_family = init)]
41        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
42
43        /// Trigger a rebuild of this system at a suitable time.
44        #[unsafe(method(setNeedsRebuild))]
45        #[unsafe(method_family = none)]
46        pub fn setNeedsRebuild(&self);
47
48        /// Trigger a revalidate of this system at a suitable time.
49        #[unsafe(method(setNeedsRevalidate))]
50        #[unsafe(method_family = none)]
51        pub fn setNeedsRevalidate(&self);
52    );
53}
54
55/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uimenusystemelementgrouppreference?language=objc)
56// NS_ENUM
57#[repr(transparent)]
58#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
59pub struct UIMenuSystemElementGroupPreference(pub NSInteger);
60impl UIMenuSystemElementGroupPreference {
61    /// The default preference. The element group is automatically included based on the platform and other system behaviors.
62    #[doc(alias = "UIMenuSystemElementGroupPreferenceAutomatic")]
63    pub const Automatic: Self = Self(0);
64    /// Prefer that the element group is removed.
65    #[doc(alias = "UIMenuSystemElementGroupPreferenceRemoved")]
66    pub const Removed: Self = Self(1);
67    /// Prefer that the element group is included.
68    #[doc(alias = "UIMenuSystemElementGroupPreferenceIncluded")]
69    pub const Included: Self = Self(2);
70}
71
72unsafe impl Encode for UIMenuSystemElementGroupPreference {
73    const ENCODING: Encoding = NSInteger::ENCODING;
74}
75
76unsafe impl RefEncode for UIMenuSystemElementGroupPreference {
77    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
78}
79
80unsafe impl Send for UIMenuSystemElementGroupPreference {}
81
82unsafe impl Sync for UIMenuSystemElementGroupPreference {}
83
84/// Represents a preference for the structure of Find elements in the main menu.
85///
86/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uimenusystemfindelementgroupconfigurationstyle?language=objc)
87// NS_ENUM
88#[repr(transparent)]
89#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
90pub struct UIMenuSystemFindElementGroupConfigurationStyle(pub NSInteger);
91impl UIMenuSystemFindElementGroupConfigurationStyle {
92    /// The default preference. Find elements are automatically included based on the platform and other system behaviors.
93    #[doc(alias = "UIMenuSystemFindElementGroupConfigurationStyleAutomatic")]
94    pub const Automatic: Self = Self(0);
95    /// Prefer a minimal set of find elements, only consisting of elements to search content in the app.
96    #[doc(alias = "UIMenuSystemFindElementGroupConfigurationStyleSearch")]
97    pub const Search: Self = Self(1);
98    /// Prefer a set of elements for finding within a non-editable text area
99    #[doc(alias = "UIMenuSystemFindElementGroupConfigurationStyleNonEditableText")]
100    pub const NonEditableText: Self = Self(2);
101    /// Prefer a full set of elements for finding and replacing text, such as Find, Find and Replace, Find Navigation, and so on.
102    #[doc(alias = "UIMenuSystemFindElementGroupConfigurationStyleEditableText")]
103    pub const EditableText: Self = Self(3);
104}
105
106unsafe impl Encode for UIMenuSystemFindElementGroupConfigurationStyle {
107    const ENCODING: Encoding = NSInteger::ENCODING;
108}
109
110unsafe impl RefEncode for UIMenuSystemFindElementGroupConfigurationStyle {
111    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
112}
113
114unsafe impl Send for UIMenuSystemFindElementGroupConfigurationStyle {}
115
116unsafe impl Sync for UIMenuSystemFindElementGroupConfigurationStyle {}
117
118extern_class!(
119    /// Represents a configuration for find elements, should they be present.
120    /// You don't create one of these directly. A configuration is provided as part of a `UIMainMenuSystemConfiguration`.
121    ///
122    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uimenusystemfindelementgroupconfiguration?language=objc)
123    #[unsafe(super(NSObject))]
124    #[thread_kind = MainThreadOnly]
125    #[derive(Debug, PartialEq, Eq, Hash)]
126    pub struct UIMenuSystemFindElementGroupConfiguration;
127);
128
129extern_conformance!(
130    unsafe impl NSObjectProtocol for UIMenuSystemFindElementGroupConfiguration {}
131);
132
133impl UIMenuSystemFindElementGroupConfiguration {
134    extern_methods!(
135        /// Specifies a preference for the style of Find elements in the main menu.
136        #[unsafe(method(style))]
137        #[unsafe(method_family = none)]
138        pub fn style(&self) -> UIMenuSystemFindElementGroupConfigurationStyle;
139
140        /// Setter for [`style`][Self::style].
141        #[unsafe(method(setStyle:))]
142        #[unsafe(method_family = none)]
143        pub fn setStyle(&self, style: UIMenuSystemFindElementGroupConfigurationStyle);
144
145        #[unsafe(method(init))]
146        #[unsafe(method_family = init)]
147        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
148
149        #[unsafe(method(new))]
150        #[unsafe(method_family = new)]
151        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
152    );
153}