objc2_ui_kit/generated/
UIPopoverPresentationController.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
12extern_protocol!(
13 #[cfg(feature = "UIPresentationController")]
15 pub unsafe trait UIPopoverPresentationControllerDelegate:
16 UIAdaptivePresentationControllerDelegate + MainThreadOnly
17 {
18 #[optional]
19 #[unsafe(method(prepareForPopoverPresentation:))]
20 #[unsafe(method_family = none)]
21 unsafe fn prepareForPopoverPresentation(
22 &self,
23 popover_presentation_controller: &UIPopoverPresentationController,
24 );
25
26 #[deprecated]
27 #[optional]
28 #[unsafe(method(popoverPresentationControllerShouldDismissPopover:))]
29 #[unsafe(method_family = none)]
30 unsafe fn popoverPresentationControllerShouldDismissPopover(
31 &self,
32 popover_presentation_controller: &UIPopoverPresentationController,
33 ) -> bool;
34
35 #[deprecated]
36 #[optional]
37 #[unsafe(method(popoverPresentationControllerDidDismissPopover:))]
38 #[unsafe(method_family = none)]
39 unsafe fn popoverPresentationControllerDidDismissPopover(
40 &self,
41 popover_presentation_controller: &UIPopoverPresentationController,
42 );
43
44 #[cfg(all(
45 feature = "UIResponder",
46 feature = "UIView",
47 feature = "objc2-core-foundation"
48 ))]
49 #[optional]
50 #[unsafe(method(popoverPresentationController:willRepositionPopoverToRect:inView:))]
51 #[unsafe(method_family = none)]
52 unsafe fn popoverPresentationController_willRepositionPopoverToRect_inView(
53 &self,
54 popover_presentation_controller: &UIPopoverPresentationController,
55 rect: NonNull<CGRect>,
56 view: &mut Retained<UIView>,
57 );
58 }
59);
60
61extern_class!(
62 #[unsafe(super(UIPresentationController, NSObject))]
64 #[thread_kind = MainThreadOnly]
65 #[derive(Debug, PartialEq, Eq, Hash)]
66 #[cfg(feature = "UIPresentationController")]
67 pub struct UIPopoverPresentationController;
68);
69
70#[cfg(feature = "UIPresentationController")]
71extern_conformance!(
72 unsafe impl NSObjectProtocol for UIPopoverPresentationController {}
73);
74
75#[cfg(all(feature = "UIAppearance", feature = "UIPresentationController"))]
76extern_conformance!(
77 unsafe impl UIAppearanceContainer for UIPopoverPresentationController {}
78);
79
80#[cfg(all(feature = "UIPresentationController", feature = "UIViewController"))]
81extern_conformance!(
82 unsafe impl UIContentContainer for UIPopoverPresentationController {}
83);
84
85#[cfg(all(feature = "UIFocus", feature = "UIPresentationController"))]
86extern_conformance!(
87 unsafe impl UIFocusEnvironment for UIPopoverPresentationController {}
88);
89
90#[cfg(all(feature = "UIPresentationController", feature = "UITraitCollection"))]
91extern_conformance!(
92 unsafe impl UITraitEnvironment for UIPopoverPresentationController {}
93);
94
95#[cfg(feature = "UIPresentationController")]
96impl UIPopoverPresentationController {
97 extern_methods!(
98 #[unsafe(method(delegate))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn delegate(
101 &self,
102 ) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerDelegate>>>;
103
104 #[unsafe(method(setDelegate:))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn setDelegate(
109 &self,
110 delegate: Option<&ProtocolObject<dyn UIPopoverPresentationControllerDelegate>>,
111 );
112
113 #[cfg(feature = "UIPopoverSupport")]
114 #[unsafe(method(permittedArrowDirections))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn permittedArrowDirections(&self) -> UIPopoverArrowDirection;
117
118 #[cfg(feature = "UIPopoverSupport")]
119 #[unsafe(method(setPermittedArrowDirections:))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn setPermittedArrowDirections(
123 &self,
124 permitted_arrow_directions: UIPopoverArrowDirection,
125 );
126
127 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
128 #[unsafe(method(sourceView))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn sourceView(&self) -> Option<Retained<UIView>>;
131
132 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
133 #[unsafe(method(setSourceView:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn setSourceView(&self, source_view: Option<&UIView>);
137
138 #[cfg(feature = "objc2-core-foundation")]
139 #[unsafe(method(sourceRect))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn sourceRect(&self) -> CGRect;
142
143 #[cfg(feature = "objc2-core-foundation")]
144 #[unsafe(method(setSourceRect:))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn setSourceRect(&self, source_rect: CGRect);
148
149 #[unsafe(method(canOverlapSourceViewRect))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn canOverlapSourceViewRect(&self) -> bool;
152
153 #[unsafe(method(setCanOverlapSourceViewRect:))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn setCanOverlapSourceViewRect(&self, can_overlap_source_view_rect: bool);
157
158 #[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
159 #[unsafe(method(sourceItem))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn sourceItem(
162 &self,
163 ) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>>;
164
165 #[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
166 #[unsafe(method(setSourceItem:))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn setSourceItem(
170 &self,
171 source_item: Option<&ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>,
172 );
173
174 #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
175 #[deprecated]
176 #[unsafe(method(barButtonItem))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn barButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;
179
180 #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
181 #[deprecated]
183 #[unsafe(method(setBarButtonItem:))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn setBarButtonItem(&self, bar_button_item: Option<&UIBarButtonItem>);
186
187 #[cfg(feature = "UIPopoverSupport")]
188 #[unsafe(method(arrowDirection))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn arrowDirection(&self) -> UIPopoverArrowDirection;
191
192 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
193 #[unsafe(method(passthroughViews))]
194 #[unsafe(method_family = none)]
195 pub unsafe fn passthroughViews(&self) -> Option<Retained<NSArray<UIView>>>;
196
197 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
198 #[unsafe(method(setPassthroughViews:))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn setPassthroughViews(&self, passthrough_views: Option<&NSArray<UIView>>);
202
203 #[cfg(feature = "UIColor")]
204 #[unsafe(method(backgroundColor))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn backgroundColor(&self) -> Option<Retained<UIColor>>;
207
208 #[cfg(feature = "UIColor")]
209 #[unsafe(method(setBackgroundColor:))]
211 #[unsafe(method_family = none)]
212 pub unsafe fn setBackgroundColor(&self, background_color: Option<&UIColor>);
213
214 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
215 #[unsafe(method(popoverLayoutMargins))]
216 #[unsafe(method_family = none)]
217 pub unsafe fn popoverLayoutMargins(&self) -> UIEdgeInsets;
218
219 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
220 #[unsafe(method(setPopoverLayoutMargins:))]
222 #[unsafe(method_family = none)]
223 pub unsafe fn setPopoverLayoutMargins(&self, popover_layout_margins: UIEdgeInsets);
224
225 #[cfg(feature = "UIPopoverBackgroundView")]
226 #[unsafe(method(popoverBackgroundViewClass))]
227 #[unsafe(method_family = none)]
228 pub unsafe fn popoverBackgroundViewClass(&self) -> Option<&'static AnyClass>;
229
230 #[cfg(feature = "UIPopoverBackgroundView")]
231 #[unsafe(method(setPopoverBackgroundViewClass:))]
233 #[unsafe(method_family = none)]
234 pub unsafe fn setPopoverBackgroundViewClass(
235 &self,
236 popover_background_view_class: Option<&AnyClass>,
237 );
238
239 #[cfg(feature = "UISheetPresentationController")]
240 #[unsafe(method(adaptiveSheetPresentationController))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn adaptiveSheetPresentationController(
243 &self,
244 ) -> Retained<UISheetPresentationController>;
245 );
246}
247
248#[cfg(feature = "UIPresentationController")]
250impl UIPopoverPresentationController {
251 extern_methods!(
252 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
253 #[unsafe(method(initWithPresentedViewController:presentingViewController:))]
254 #[unsafe(method_family = init)]
255 pub unsafe fn initWithPresentedViewController_presentingViewController(
256 this: Allocated<Self>,
257 presented_view_controller: &UIViewController,
258 presenting_view_controller: Option<&UIViewController>,
259 ) -> Retained<Self>;
260
261 #[unsafe(method(init))]
262 #[unsafe(method_family = init)]
263 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
264 );
265}
266
267#[cfg(feature = "UIPresentationController")]
269impl UIPopoverPresentationController {
270 extern_methods!(
271 #[unsafe(method(new))]
272 #[unsafe(method_family = new)]
273 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
274 );
275}