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 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 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 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]
53 #[unsafe(method(popoverPresentationController:willRepositionPopoverToRect:inView:))]
54 #[unsafe(method_family = none)]
55 unsafe fn popoverPresentationController_willRepositionPopoverToRect_inView(
56 &self,
57 popover_presentation_controller: &UIPopoverPresentationController,
58 rect: NonNull<CGRect>,
59 view: &mut Retained<UIView>,
60 );
61 }
62);
63
64extern_class!(
65 #[unsafe(super(UIPresentationController, NSObject))]
67 #[thread_kind = MainThreadOnly]
68 #[derive(Debug, PartialEq, Eq, Hash)]
69 #[cfg(feature = "UIPresentationController")]
70 pub struct UIPopoverPresentationController;
71);
72
73#[cfg(feature = "UIPresentationController")]
74extern_conformance!(
75 unsafe impl NSObjectProtocol for UIPopoverPresentationController {}
76);
77
78#[cfg(all(feature = "UIAppearance", feature = "UIPresentationController"))]
79extern_conformance!(
80 unsafe impl UIAppearanceContainer for UIPopoverPresentationController {}
81);
82
83#[cfg(all(feature = "UIPresentationController", feature = "UIViewController"))]
84extern_conformance!(
85 unsafe impl UIContentContainer for UIPopoverPresentationController {}
86);
87
88#[cfg(all(feature = "UIFocus", feature = "UIPresentationController"))]
89extern_conformance!(
90 unsafe impl UIFocusEnvironment for UIPopoverPresentationController {}
91);
92
93#[cfg(all(feature = "UIPresentationController", feature = "UITraitCollection"))]
94extern_conformance!(
95 unsafe impl UITraitEnvironment for UIPopoverPresentationController {}
96);
97
98#[cfg(feature = "UIPresentationController")]
99impl UIPopoverPresentationController {
100 extern_methods!(
101 #[unsafe(method(delegate))]
102 #[unsafe(method_family = none)]
103 pub fn delegate(
104 &self,
105 ) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerDelegate>>>;
106
107 #[unsafe(method(setDelegate:))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn setDelegate(
113 &self,
114 delegate: Option<&ProtocolObject<dyn UIPopoverPresentationControllerDelegate>>,
115 );
116
117 #[cfg(feature = "UIPopoverSupport")]
118 #[unsafe(method(permittedArrowDirections))]
119 #[unsafe(method_family = none)]
120 pub fn permittedArrowDirections(&self) -> UIPopoverArrowDirection;
121
122 #[cfg(feature = "UIPopoverSupport")]
123 #[unsafe(method(setPermittedArrowDirections:))]
125 #[unsafe(method_family = none)]
126 pub fn setPermittedArrowDirections(
127 &self,
128 permitted_arrow_directions: UIPopoverArrowDirection,
129 );
130
131 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
132 #[unsafe(method(sourceView))]
133 #[unsafe(method_family = none)]
134 pub fn sourceView(&self) -> Option<Retained<UIView>>;
135
136 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
137 #[unsafe(method(setSourceView:))]
139 #[unsafe(method_family = none)]
140 pub fn setSourceView(&self, source_view: Option<&UIView>);
141
142 #[cfg(feature = "objc2-core-foundation")]
143 #[unsafe(method(sourceRect))]
144 #[unsafe(method_family = none)]
145 pub fn sourceRect(&self) -> CGRect;
146
147 #[cfg(feature = "objc2-core-foundation")]
148 #[unsafe(method(setSourceRect:))]
150 #[unsafe(method_family = none)]
151 pub fn setSourceRect(&self, source_rect: CGRect);
152
153 #[unsafe(method(canOverlapSourceViewRect))]
154 #[unsafe(method_family = none)]
155 pub fn canOverlapSourceViewRect(&self) -> bool;
156
157 #[unsafe(method(setCanOverlapSourceViewRect:))]
159 #[unsafe(method_family = none)]
160 pub fn setCanOverlapSourceViewRect(&self, can_overlap_source_view_rect: bool);
161
162 #[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
163 #[unsafe(method(sourceItem))]
164 #[unsafe(method_family = none)]
165 pub fn sourceItem(
166 &self,
167 ) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>>;
168
169 #[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
170 #[unsafe(method(setSourceItem:))]
172 #[unsafe(method_family = none)]
173 pub fn setSourceItem(
174 &self,
175 source_item: Option<&ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>,
176 );
177
178 #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
179 #[deprecated]
180 #[unsafe(method(barButtonItem))]
181 #[unsafe(method_family = none)]
182 pub fn barButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;
183
184 #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
185 #[deprecated]
187 #[unsafe(method(setBarButtonItem:))]
188 #[unsafe(method_family = none)]
189 pub fn setBarButtonItem(&self, bar_button_item: Option<&UIBarButtonItem>);
190
191 #[cfg(feature = "UIPopoverSupport")]
192 #[unsafe(method(arrowDirection))]
193 #[unsafe(method_family = none)]
194 pub fn arrowDirection(&self) -> UIPopoverArrowDirection;
195
196 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
197 #[unsafe(method(passthroughViews))]
198 #[unsafe(method_family = none)]
199 pub fn passthroughViews(&self) -> Option<Retained<NSArray<UIView>>>;
200
201 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
202 #[unsafe(method(setPassthroughViews:))]
206 #[unsafe(method_family = none)]
207 pub fn setPassthroughViews(&self, passthrough_views: Option<&NSArray<UIView>>);
208
209 #[cfg(feature = "UIColor")]
210 #[unsafe(method(backgroundColor))]
211 #[unsafe(method_family = none)]
212 pub fn backgroundColor(&self) -> Option<Retained<UIColor>>;
213
214 #[cfg(feature = "UIColor")]
215 #[unsafe(method(setBackgroundColor:))]
219 #[unsafe(method_family = none)]
220 pub fn setBackgroundColor(&self, background_color: Option<&UIColor>);
221
222 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
223 #[unsafe(method(popoverLayoutMargins))]
224 #[unsafe(method_family = none)]
225 pub fn popoverLayoutMargins(&self) -> UIEdgeInsets;
226
227 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
228 #[unsafe(method(setPopoverLayoutMargins:))]
230 #[unsafe(method_family = none)]
231 pub fn setPopoverLayoutMargins(&self, popover_layout_margins: UIEdgeInsets);
232
233 #[cfg(feature = "UIPopoverBackgroundView")]
234 #[unsafe(method(popoverBackgroundViewClass))]
235 #[unsafe(method_family = none)]
236 pub fn popoverBackgroundViewClass(&self) -> Option<&'static AnyClass>;
237
238 #[cfg(feature = "UIPopoverBackgroundView")]
239 #[unsafe(method(setPopoverBackgroundViewClass:))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn setPopoverBackgroundViewClass(
247 &self,
248 popover_background_view_class: Option<&AnyClass>,
249 );
250
251 #[cfg(feature = "UISheetPresentationController")]
252 #[unsafe(method(adaptiveSheetPresentationController))]
253 #[unsafe(method_family = none)]
254 pub fn adaptiveSheetPresentationController(
255 &self,
256 ) -> Retained<UISheetPresentationController>;
257 );
258}
259
260#[cfg(feature = "UIPresentationController")]
262impl UIPopoverPresentationController {
263 extern_methods!(
264 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
265 #[unsafe(method(initWithPresentedViewController:presentingViewController:))]
266 #[unsafe(method_family = init)]
267 pub fn initWithPresentedViewController_presentingViewController(
268 this: Allocated<Self>,
269 presented_view_controller: &UIViewController,
270 presenting_view_controller: Option<&UIViewController>,
271 ) -> Retained<Self>;
272
273 #[unsafe(method(init))]
274 #[unsafe(method_family = init)]
275 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
276 );
277}
278
279#[cfg(feature = "UIPresentationController")]
281impl UIPopoverPresentationController {
282 extern_methods!(
283 #[unsafe(method(new))]
284 #[unsafe(method_family = new)]
285 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
286 );
287}