1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIMenuControllerArrowDirection(pub NSInteger);
impl UIMenuControllerArrowDirection {
    #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
    pub const UIMenuControllerArrowDefault: Self = Self(0);
    pub const UIMenuControllerArrowUp: Self = Self(1);
    pub const UIMenuControllerArrowDown: Self = Self(2);
    pub const UIMenuControllerArrowLeft: Self = Self(3);
    pub const UIMenuControllerArrowRight: Self = Self(4);
}

unsafe impl Encode for UIMenuControllerArrowDirection {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIMenuControllerArrowDirection {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
    pub struct UIMenuController;

    unsafe impl ClassType for UIMenuController {
        type Super = NSObject;
        type Mutability = MainThreadOnly;
    }
);

unsafe impl NSObjectProtocol for UIMenuController {}

extern_methods!(
    unsafe impl UIMenuController {
        #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
        #[method_id(@__retain_semantics Other sharedMenuController)]
        pub unsafe fn sharedMenuController(mtm: MainThreadMarker) -> Retained<UIMenuController>;

        #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
        #[method(isMenuVisible)]
        pub unsafe fn isMenuVisible(&self) -> bool;

        #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
        #[method(setMenuVisible:)]
        pub unsafe fn setMenuVisible(&self, menu_visible: bool);

        #[deprecated = "Use showMenuFromView:rect: or hideMenuFromView: instead."]
        #[method(setMenuVisible:animated:)]
        pub unsafe fn setMenuVisible_animated(&self, menu_visible: bool, animated: bool);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[deprecated = "Use showMenuFromView:rect: instead."]
        #[method(setTargetRect:inView:)]
        pub unsafe fn setTargetRect_inView(&self, target_rect: CGRect, target_view: &UIView);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[method(showMenuFromView:rect:)]
        pub unsafe fn showMenuFromView_rect(&self, target_view: &UIView, target_rect: CGRect);

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[method(hideMenuFromView:)]
        pub unsafe fn hideMenuFromView(&self, target_view: &UIView);

        #[method(hideMenu)]
        pub unsafe fn hideMenu(&self);

        #[method(arrowDirection)]
        pub unsafe fn arrowDirection(&self) -> UIMenuControllerArrowDirection;

        #[method(setArrowDirection:)]
        pub unsafe fn setArrowDirection(&self, arrow_direction: UIMenuControllerArrowDirection);

        #[method_id(@__retain_semantics Other menuItems)]
        pub unsafe fn menuItems(&self) -> Option<Retained<NSArray<UIMenuItem>>>;

        #[method(setMenuItems:)]
        pub unsafe fn setMenuItems(&self, menu_items: Option<&NSArray<UIMenuItem>>);

        #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
        #[method(update)]
        pub unsafe fn update(&self);

        #[deprecated = "UIMenuController is deprecated. Use UIEditMenuInteraction instead."]
        #[method(menuFrame)]
        pub unsafe fn menuFrame(&self) -> CGRect;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl UIMenuController {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);

extern "C" {
    pub static UIMenuControllerWillShowMenuNotification: &'static NSNotificationName;
}

extern "C" {
    pub static UIMenuControllerDidShowMenuNotification: &'static NSNotificationName;
}

extern "C" {
    pub static UIMenuControllerWillHideMenuNotification: &'static NSNotificationName;
}

extern "C" {
    pub static UIMenuControllerDidHideMenuNotification: &'static NSNotificationName;
}

extern "C" {
    pub static UIMenuControllerMenuFrameDidChangeNotification: &'static NSNotificationName;
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
    pub struct UIMenuItem;

    unsafe impl ClassType for UIMenuItem {
        type Super = NSObject;
        type Mutability = MainThreadOnly;
    }
);

unsafe impl NSObjectProtocol for UIMenuItem {}

extern_methods!(
    unsafe impl UIMenuItem {
        #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
        #[method_id(@__retain_semantics Init initWithTitle:action:)]
        pub unsafe fn initWithTitle_action(
            this: Allocated<Self>,
            title: &NSString,
            action: Sel,
        ) -> Retained<Self>;

        #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
        #[method_id(@__retain_semantics Other title)]
        pub unsafe fn title(&self) -> Retained<NSString>;

        #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
        #[method(setTitle:)]
        pub unsafe fn setTitle(&self, title: &NSString);

        #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
        #[method(action)]
        pub unsafe fn action(&self) -> Sel;

        #[deprecated = "UIMenuItem is deprecated. Use UIEditMenuInteraction instead."]
        #[method(setAction:)]
        pub unsafe fn setAction(&self, action: Sel);
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl UIMenuItem {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);