objc2_ui_kit/generated/
UIPopoverPresentationController.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use 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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipopoverpresentationcontrollerdelegate?language=objc)
14    #[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        /// # Safety
50        ///
51        /// `rect` must be a valid pointer.
52        #[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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipopoverpresentationcontroller?language=objc)
66    #[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        /// Setter for [`delegate`][Self::delegate].
108        ///
109        /// This is a [weak property][objc2::topics::weak_property].
110        #[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        /// Setter for [`permittedArrowDirections`][Self::permittedArrowDirections].
124        #[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        /// Setter for [`sourceView`][Self::sourceView].
138        #[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        /// Setter for [`sourceRect`][Self::sourceRect].
149        #[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        /// Setter for [`canOverlapSourceViewRect`][Self::canOverlapSourceViewRect].
158        #[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        /// Setter for [`sourceItem`][Self::sourceItem].
171        #[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        /// Setter for [`barButtonItem`][Self::barButtonItem].
186        #[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        /// Setter for [`passthroughViews`][Self::passthroughViews].
203        ///
204        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
205        #[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        /// Setter for [`backgroundColor`][Self::backgroundColor].
216        ///
217        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
218        #[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        /// Setter for [`popoverLayoutMargins`][Self::popoverLayoutMargins].
229        #[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        /// Setter for [`popoverBackgroundViewClass`][Self::popoverBackgroundViewClass].
240        ///
241        /// # Safety
242        ///
243        /// `popover_background_view_class` must implement UIPopoverBackgroundViewMethods.
244        #[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/// Methods declared on superclass `UIPresentationController`.
261#[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/// Methods declared on superclass `NSObject`.
280#[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}