objc2_ui_kit/generated/
UIMenuController.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12#[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
15#[repr(transparent)]
16#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
17pub struct UIMenuControllerArrowDirection(pub NSInteger);
18impl UIMenuControllerArrowDirection {
19 #[doc(alias = "UIMenuControllerArrowDefault")]
20 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
21 pub const Default: Self = Self(0);
22 #[doc(alias = "UIMenuControllerArrowUp")]
23 pub const Up: Self = Self(1);
24 #[doc(alias = "UIMenuControllerArrowDown")]
25 pub const Down: Self = Self(2);
26 #[doc(alias = "UIMenuControllerArrowLeft")]
27 pub const Left: Self = Self(3);
28 #[doc(alias = "UIMenuControllerArrowRight")]
29 pub const Right: Self = Self(4);
30}
31
32unsafe impl Encode for UIMenuControllerArrowDirection {
33 const ENCODING: Encoding = NSInteger::ENCODING;
34}
35
36unsafe impl RefEncode for UIMenuControllerArrowDirection {
37 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_class!(
41 #[unsafe(super(NSObject))]
43 #[thread_kind = MainThreadOnly]
44 #[derive(Debug, PartialEq, Eq, Hash)]
45 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
46 pub struct UIMenuController;
47);
48
49extern_conformance!(
50 unsafe impl NSObjectProtocol for UIMenuController {}
51);
52
53impl UIMenuController {
54 extern_methods!(
55 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
56 #[unsafe(method(sharedMenuController))]
57 #[unsafe(method_family = none)]
58 pub fn sharedMenuController(mtm: MainThreadMarker) -> Retained<UIMenuController>;
59
60 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
61 #[unsafe(method(isMenuVisible))]
62 #[unsafe(method_family = none)]
63 pub fn isMenuVisible(&self) -> bool;
64
65 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
67 #[unsafe(method(setMenuVisible:))]
68 #[unsafe(method_family = none)]
69 pub fn setMenuVisible(&self, menu_visible: bool);
70
71 #[deprecated = "Use showMenuFromView:rect: or hideMenuFromView: instead."]
72 #[unsafe(method(setMenuVisible:animated:))]
73 #[unsafe(method_family = none)]
74 pub fn setMenuVisible_animated(&self, menu_visible: bool, animated: bool);
75
76 #[cfg(all(
77 feature = "UIResponder",
78 feature = "UIView",
79 feature = "objc2-core-foundation"
80 ))]
81 #[deprecated = "Use showMenuFromView:rect: instead."]
82 #[unsafe(method(setTargetRect:inView:))]
83 #[unsafe(method_family = none)]
84 pub fn setTargetRect_inView(&self, target_rect: CGRect, target_view: &UIView);
85
86 #[cfg(all(
87 feature = "UIResponder",
88 feature = "UIView",
89 feature = "objc2-core-foundation"
90 ))]
91 #[unsafe(method(showMenuFromView:rect:))]
92 #[unsafe(method_family = none)]
93 pub fn showMenuFromView_rect(&self, target_view: &UIView, target_rect: CGRect);
94
95 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
96 #[unsafe(method(hideMenuFromView:))]
97 #[unsafe(method_family = none)]
98 pub fn hideMenuFromView(&self, target_view: &UIView);
99
100 #[unsafe(method(hideMenu))]
101 #[unsafe(method_family = none)]
102 pub fn hideMenu(&self);
103
104 #[unsafe(method(arrowDirection))]
105 #[unsafe(method_family = none)]
106 pub fn arrowDirection(&self) -> UIMenuControllerArrowDirection;
107
108 #[unsafe(method(setArrowDirection:))]
110 #[unsafe(method_family = none)]
111 pub fn setArrowDirection(&self, arrow_direction: UIMenuControllerArrowDirection);
112
113 #[unsafe(method(menuItems))]
114 #[unsafe(method_family = none)]
115 pub fn menuItems(&self) -> Option<Retained<NSArray<UIMenuItem>>>;
116
117 #[unsafe(method(setMenuItems:))]
121 #[unsafe(method_family = none)]
122 pub fn setMenuItems(&self, menu_items: Option<&NSArray<UIMenuItem>>);
123
124 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
125 #[unsafe(method(update))]
126 #[unsafe(method_family = none)]
127 pub fn update(&self);
128
129 #[cfg(feature = "objc2-core-foundation")]
130 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
131 #[unsafe(method(menuFrame))]
132 #[unsafe(method_family = none)]
133 pub fn menuFrame(&self) -> CGRect;
134 );
135}
136
137impl UIMenuController {
139 extern_methods!(
140 #[unsafe(method(init))]
141 #[unsafe(method_family = init)]
142 pub fn init(this: Allocated<Self>) -> Retained<Self>;
143
144 #[unsafe(method(new))]
145 #[unsafe(method_family = new)]
146 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
147 );
148}
149
150extern "C" {
151 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
153 pub static UIMenuControllerWillShowMenuNotification: &'static NSNotificationName;
154}
155
156extern "C" {
157 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
159 pub static UIMenuControllerDidShowMenuNotification: &'static NSNotificationName;
160}
161
162extern "C" {
163 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
165 pub static UIMenuControllerWillHideMenuNotification: &'static NSNotificationName;
166}
167
168extern "C" {
169 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
171 pub static UIMenuControllerDidHideMenuNotification: &'static NSNotificationName;
172}
173
174extern "C" {
175 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
177 pub static UIMenuControllerMenuFrameDidChangeNotification: &'static NSNotificationName;
178}
179
180extern_class!(
181 #[unsafe(super(NSObject))]
183 #[thread_kind = MainThreadOnly]
184 #[derive(Debug, PartialEq, Eq, Hash)]
185 #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
186 pub struct UIMenuItem;
187);
188
189extern_conformance!(
190 unsafe impl NSObjectProtocol for UIMenuItem {}
191);
192
193impl UIMenuItem {
194 extern_methods!(
195 #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
199 #[unsafe(method(initWithTitle:action:))]
200 #[unsafe(method_family = init)]
201 pub unsafe fn initWithTitle_action(
202 this: Allocated<Self>,
203 title: &NSString,
204 action: Sel,
205 ) -> Retained<Self>;
206
207 #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
208 #[unsafe(method(title))]
209 #[unsafe(method_family = none)]
210 pub fn title(&self) -> Retained<NSString>;
211
212 #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
216 #[unsafe(method(setTitle:))]
217 #[unsafe(method_family = none)]
218 pub fn setTitle(&self, title: &NSString);
219
220 #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
221 #[unsafe(method(action))]
222 #[unsafe(method_family = none)]
223 pub fn action(&self) -> Sel;
224
225 #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
231 #[unsafe(method(setAction:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn setAction(&self, action: Sel);
234 );
235}
236
237impl UIMenuItem {
239 extern_methods!(
240 #[unsafe(method(init))]
241 #[unsafe(method_family = init)]
242 pub fn init(this: Allocated<Self>) -> Retained<Self>;
243
244 #[unsafe(method(new))]
245 #[unsafe(method_family = new)]
246 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
247 );
248}