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 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
20 #[doc(alias = "UIMenuControllerArrowDefault")]
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
49unsafe impl NSObjectProtocol for UIMenuController {}
50
51impl UIMenuController {
52 extern_methods!(
53 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
54 #[unsafe(method(sharedMenuController))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn sharedMenuController(mtm: MainThreadMarker) -> Retained<UIMenuController>;
57
58 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
59 #[unsafe(method(isMenuVisible))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn isMenuVisible(&self) -> bool;
62
63 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
65 #[unsafe(method(setMenuVisible:))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn setMenuVisible(&self, menu_visible: bool);
68
69 #[deprecated = "Use showMenuFromView:rect: or hideMenuFromView: instead."]
70 #[unsafe(method(setMenuVisible:animated:))]
71 #[unsafe(method_family = none)]
72 pub unsafe fn setMenuVisible_animated(&self, menu_visible: bool, animated: bool);
73
74 #[cfg(all(
75 feature = "UIResponder",
76 feature = "UIView",
77 feature = "objc2-core-foundation"
78 ))]
79 #[deprecated = "Use showMenuFromView:rect: instead."]
80 #[unsafe(method(setTargetRect:inView:))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn setTargetRect_inView(&self, target_rect: CGRect, target_view: &UIView);
83
84 #[cfg(all(
85 feature = "UIResponder",
86 feature = "UIView",
87 feature = "objc2-core-foundation"
88 ))]
89 #[unsafe(method(showMenuFromView:rect:))]
90 #[unsafe(method_family = none)]
91 pub unsafe fn showMenuFromView_rect(&self, target_view: &UIView, target_rect: CGRect);
92
93 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
94 #[unsafe(method(hideMenuFromView:))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn hideMenuFromView(&self, target_view: &UIView);
97
98 #[unsafe(method(hideMenu))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn hideMenu(&self);
101
102 #[unsafe(method(arrowDirection))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn arrowDirection(&self) -> UIMenuControllerArrowDirection;
105
106 #[unsafe(method(setArrowDirection:))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn setArrowDirection(&self, arrow_direction: UIMenuControllerArrowDirection);
110
111 #[unsafe(method(menuItems))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn menuItems(&self) -> Option<Retained<NSArray<UIMenuItem>>>;
114
115 #[unsafe(method(setMenuItems:))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn setMenuItems(&self, menu_items: Option<&NSArray<UIMenuItem>>);
119
120 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
121 #[unsafe(method(update))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn update(&self);
124
125 #[cfg(feature = "objc2-core-foundation")]
126 #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
127 #[unsafe(method(menuFrame))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn menuFrame(&self) -> CGRect;
130 );
131}
132
133impl UIMenuController {
135 extern_methods!(
136 #[unsafe(method(init))]
137 #[unsafe(method_family = init)]
138 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
139
140 #[unsafe(method(new))]
141 #[unsafe(method_family = new)]
142 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
143 );
144}
145
146extern "C" {
147 pub static UIMenuControllerWillShowMenuNotification: &'static NSNotificationName;
149}
150
151extern "C" {
152 pub static UIMenuControllerDidShowMenuNotification: &'static NSNotificationName;
154}
155
156extern "C" {
157 pub static UIMenuControllerWillHideMenuNotification: &'static NSNotificationName;
159}
160
161extern "C" {
162 pub static UIMenuControllerDidHideMenuNotification: &'static NSNotificationName;
164}
165
166extern "C" {
167 pub static UIMenuControllerMenuFrameDidChangeNotification: &'static NSNotificationName;
169}
170
171extern_class!(
172 #[unsafe(super(NSObject))]
174 #[thread_kind = MainThreadOnly]
175 #[derive(Debug, PartialEq, Eq, Hash)]
176 #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
177 pub struct UIMenuItem;
178);
179
180unsafe impl NSObjectProtocol for UIMenuItem {}
181
182impl UIMenuItem {
183 extern_methods!(
184 #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
185 #[unsafe(method(initWithTitle:action:))]
186 #[unsafe(method_family = init)]
187 pub unsafe fn initWithTitle_action(
188 this: Allocated<Self>,
189 title: &NSString,
190 action: Sel,
191 ) -> Retained<Self>;
192
193 #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
194 #[unsafe(method(title))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn title(&self) -> Retained<NSString>;
197
198 #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
200 #[unsafe(method(setTitle:))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn setTitle(&self, title: &NSString);
203
204 #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
205 #[unsafe(method(action))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn action(&self) -> Sel;
208
209 #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
211 #[unsafe(method(setAction:))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn setAction(&self, action: Sel);
214 );
215}
216
217impl UIMenuItem {
219 extern_methods!(
220 #[unsafe(method(init))]
221 #[unsafe(method_family = init)]
222 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
223
224 #[unsafe(method(new))]
225 #[unsafe(method_family = new)]
226 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
227 );
228}