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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_protocol!(
    #[cfg(feature = "UIPresentationController")]
    pub unsafe trait UIPopoverPresentationControllerDelegate:
        UIAdaptivePresentationControllerDelegate + IsMainThreadOnly
    {
        #[optional]
        #[method(prepareForPopoverPresentation:)]
        unsafe fn prepareForPopoverPresentation(
            &self,
            popover_presentation_controller: &UIPopoverPresentationController,
        );

        #[deprecated]
        #[optional]
        #[method(popoverPresentationControllerShouldDismissPopover:)]
        unsafe fn popoverPresentationControllerShouldDismissPopover(
            &self,
            popover_presentation_controller: &UIPopoverPresentationController,
        ) -> bool;

        #[deprecated]
        #[optional]
        #[method(popoverPresentationControllerDidDismissPopover:)]
        unsafe fn popoverPresentationControllerDidDismissPopover(
            &self,
            popover_presentation_controller: &UIPopoverPresentationController,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[method(popoverPresentationController:willRepositionPopoverToRect:inView:)]
        unsafe fn popoverPresentationController_willRepositionPopoverToRect_inView(
            &self,
            popover_presentation_controller: &UIPopoverPresentationController,
            rect: NonNull<CGRect>,
            view: &mut Retained<UIView>,
        );
    }

    #[cfg(feature = "UIPresentationController")]
    unsafe impl ProtocolType for dyn UIPopoverPresentationControllerDelegate {}
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "UIPresentationController")]
    pub struct UIPopoverPresentationController;

    #[cfg(feature = "UIPresentationController")]
    unsafe impl ClassType for UIPopoverPresentationController {
        #[inherits(NSObject)]
        type Super = UIPresentationController;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(feature = "UIPresentationController")]
unsafe impl NSObjectProtocol for UIPopoverPresentationController {}

#[cfg(all(feature = "UIAppearance", feature = "UIPresentationController"))]
unsafe impl UIAppearanceContainer for UIPopoverPresentationController {}

#[cfg(all(feature = "UIPresentationController", feature = "UIViewController"))]
unsafe impl UIContentContainer for UIPopoverPresentationController {}

#[cfg(all(feature = "UIFocus", feature = "UIPresentationController"))]
unsafe impl UIFocusEnvironment for UIPopoverPresentationController {}

#[cfg(all(feature = "UIPresentationController", feature = "UITraitCollection"))]
unsafe impl UITraitEnvironment for UIPopoverPresentationController {}

extern_methods!(
    #[cfg(feature = "UIPresentationController")]
    unsafe impl UIPopoverPresentationController {
        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn UIPopoverPresentationControllerDelegate>>,
        );

        #[cfg(feature = "UIPopoverSupport")]
        #[method(permittedArrowDirections)]
        pub unsafe fn permittedArrowDirections(&self) -> UIPopoverArrowDirection;

        #[cfg(feature = "UIPopoverSupport")]
        #[method(setPermittedArrowDirections:)]
        pub unsafe fn setPermittedArrowDirections(
            &self,
            permitted_arrow_directions: UIPopoverArrowDirection,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[method_id(@__retain_semantics Other sourceView)]
        pub unsafe fn sourceView(&self) -> Option<Retained<UIView>>;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[method(setSourceView:)]
        pub unsafe fn setSourceView(&self, source_view: Option<&UIView>);

        #[method(sourceRect)]
        pub unsafe fn sourceRect(&self) -> CGRect;

        #[method(setSourceRect:)]
        pub unsafe fn setSourceRect(&self, source_rect: CGRect);

        #[method(canOverlapSourceViewRect)]
        pub unsafe fn canOverlapSourceViewRect(&self) -> bool;

        #[method(setCanOverlapSourceViewRect:)]
        pub unsafe fn setCanOverlapSourceViewRect(&self, can_overlap_source_view_rect: bool);

        #[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
        #[method_id(@__retain_semantics Other sourceItem)]
        pub unsafe fn sourceItem(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>>;

        #[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
        #[method(setSourceItem:)]
        pub unsafe fn setSourceItem(
            &self,
            source_item: Option<&ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>,
        );

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[deprecated]
        #[method_id(@__retain_semantics Other barButtonItem)]
        pub unsafe fn barButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[deprecated]
        #[method(setBarButtonItem:)]
        pub unsafe fn setBarButtonItem(&self, bar_button_item: Option<&UIBarButtonItem>);

        #[cfg(feature = "UIPopoverSupport")]
        #[method(arrowDirection)]
        pub unsafe fn arrowDirection(&self) -> UIPopoverArrowDirection;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[method_id(@__retain_semantics Other passthroughViews)]
        pub unsafe fn passthroughViews(&self) -> Option<Retained<NSArray<UIView>>>;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[method(setPassthroughViews:)]
        pub unsafe fn setPassthroughViews(&self, passthrough_views: Option<&NSArray<UIView>>);

        #[cfg(feature = "UIColor")]
        #[method_id(@__retain_semantics Other backgroundColor)]
        pub unsafe fn backgroundColor(&self) -> Option<Retained<UIColor>>;

        #[cfg(feature = "UIColor")]
        #[method(setBackgroundColor:)]
        pub unsafe fn setBackgroundColor(&self, background_color: Option<&UIColor>);

        #[cfg(feature = "UIGeometry")]
        #[method(popoverLayoutMargins)]
        pub unsafe fn popoverLayoutMargins(&self) -> UIEdgeInsets;

        #[cfg(feature = "UIGeometry")]
        #[method(setPopoverLayoutMargins:)]
        pub unsafe fn setPopoverLayoutMargins(&self, popover_layout_margins: UIEdgeInsets);

        #[cfg(feature = "UIPopoverBackgroundView")]
        #[method(popoverBackgroundViewClass)]
        pub unsafe fn popoverBackgroundViewClass(&self) -> Option<&'static AnyClass>;

        #[cfg(feature = "UIPopoverBackgroundView")]
        #[method(setPopoverBackgroundViewClass:)]
        pub unsafe fn setPopoverBackgroundViewClass(
            &self,
            popover_background_view_class: Option<&AnyClass>,
        );

        #[cfg(feature = "UISheetPresentationController")]
        #[method_id(@__retain_semantics Other adaptiveSheetPresentationController)]
        pub unsafe fn adaptiveSheetPresentationController(
            &self,
        ) -> Retained<UISheetPresentationController>;
    }
);

extern_methods!(
    /// Methods declared on superclass `UIPresentationController`
    #[cfg(feature = "UIPresentationController")]
    unsafe impl UIPopoverPresentationController {
        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[method_id(@__retain_semantics Init initWithPresentedViewController:presentingViewController:)]
        pub unsafe fn initWithPresentedViewController_presentingViewController(
            this: Allocated<Self>,
            presented_view_controller: &UIViewController,
            presenting_view_controller: Option<&UIViewController>,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "UIPresentationController")]
    unsafe impl UIPopoverPresentationController {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);