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        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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipopoverpresentationcontroller?language=objc)
63    #[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")]
71unsafe impl NSObjectProtocol for UIPopoverPresentationController {}
72
73#[cfg(all(feature = "UIAppearance", feature = "UIPresentationController"))]
74unsafe impl UIAppearanceContainer for UIPopoverPresentationController {}
75
76#[cfg(all(feature = "UIPresentationController", feature = "UIViewController"))]
77unsafe impl UIContentContainer for UIPopoverPresentationController {}
78
79#[cfg(all(feature = "UIFocus", feature = "UIPresentationController"))]
80unsafe impl UIFocusEnvironment for UIPopoverPresentationController {}
81
82#[cfg(all(feature = "UIPresentationController", feature = "UITraitCollection"))]
83unsafe impl UITraitEnvironment for UIPopoverPresentationController {}
84
85#[cfg(feature = "UIPresentationController")]
86impl UIPopoverPresentationController {
87    extern_methods!(
88        #[unsafe(method(delegate))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn delegate(
91            &self,
92        ) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerDelegate>>>;
93
94        /// This is a [weak property][objc2::topics::weak_property].
95        /// Setter for [`delegate`][Self::delegate].
96        #[unsafe(method(setDelegate:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn setDelegate(
99            &self,
100            delegate: Option<&ProtocolObject<dyn UIPopoverPresentationControllerDelegate>>,
101        );
102
103        #[cfg(feature = "UIPopoverSupport")]
104        #[unsafe(method(permittedArrowDirections))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn permittedArrowDirections(&self) -> UIPopoverArrowDirection;
107
108        #[cfg(feature = "UIPopoverSupport")]
109        /// Setter for [`permittedArrowDirections`][Self::permittedArrowDirections].
110        #[unsafe(method(setPermittedArrowDirections:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn setPermittedArrowDirections(
113            &self,
114            permitted_arrow_directions: UIPopoverArrowDirection,
115        );
116
117        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
118        #[unsafe(method(sourceView))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn sourceView(&self) -> Option<Retained<UIView>>;
121
122        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
123        /// Setter for [`sourceView`][Self::sourceView].
124        #[unsafe(method(setSourceView:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn setSourceView(&self, source_view: Option<&UIView>);
127
128        #[cfg(feature = "objc2-core-foundation")]
129        #[unsafe(method(sourceRect))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn sourceRect(&self) -> CGRect;
132
133        #[cfg(feature = "objc2-core-foundation")]
134        /// Setter for [`sourceRect`][Self::sourceRect].
135        #[unsafe(method(setSourceRect:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn setSourceRect(&self, source_rect: CGRect);
138
139        #[unsafe(method(canOverlapSourceViewRect))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn canOverlapSourceViewRect(&self) -> bool;
142
143        /// Setter for [`canOverlapSourceViewRect`][Self::canOverlapSourceViewRect].
144        #[unsafe(method(setCanOverlapSourceViewRect:))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn setCanOverlapSourceViewRect(&self, can_overlap_source_view_rect: bool);
147
148        #[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
149        #[unsafe(method(sourceItem))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn sourceItem(
152            &self,
153        ) -> Option<Retained<ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>>;
154
155        #[cfg(feature = "UIPopoverPresentationControllerSourceItem")]
156        /// Setter for [`sourceItem`][Self::sourceItem].
157        #[unsafe(method(setSourceItem:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn setSourceItem(
160            &self,
161            source_item: Option<&ProtocolObject<dyn UIPopoverPresentationControllerSourceItem>>,
162        );
163
164        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
165        #[deprecated]
166        #[unsafe(method(barButtonItem))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn barButtonItem(&self) -> Option<Retained<UIBarButtonItem>>;
169
170        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
171        /// Setter for [`barButtonItem`][Self::barButtonItem].
172        #[deprecated]
173        #[unsafe(method(setBarButtonItem:))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn setBarButtonItem(&self, bar_button_item: Option<&UIBarButtonItem>);
176
177        #[cfg(feature = "UIPopoverSupport")]
178        #[unsafe(method(arrowDirection))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn arrowDirection(&self) -> UIPopoverArrowDirection;
181
182        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
183        #[unsafe(method(passthroughViews))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn passthroughViews(&self) -> Option<Retained<NSArray<UIView>>>;
186
187        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
188        /// Setter for [`passthroughViews`][Self::passthroughViews].
189        #[unsafe(method(setPassthroughViews:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn setPassthroughViews(&self, passthrough_views: Option<&NSArray<UIView>>);
192
193        #[cfg(feature = "UIColor")]
194        #[unsafe(method(backgroundColor))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn backgroundColor(&self) -> Option<Retained<UIColor>>;
197
198        #[cfg(feature = "UIColor")]
199        /// Setter for [`backgroundColor`][Self::backgroundColor].
200        #[unsafe(method(setBackgroundColor:))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn setBackgroundColor(&self, background_color: Option<&UIColor>);
203
204        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
205        #[unsafe(method(popoverLayoutMargins))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn popoverLayoutMargins(&self) -> UIEdgeInsets;
208
209        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
210        /// Setter for [`popoverLayoutMargins`][Self::popoverLayoutMargins].
211        #[unsafe(method(setPopoverLayoutMargins:))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn setPopoverLayoutMargins(&self, popover_layout_margins: UIEdgeInsets);
214
215        #[cfg(feature = "UIPopoverBackgroundView")]
216        #[unsafe(method(popoverBackgroundViewClass))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn popoverBackgroundViewClass(&self) -> Option<&'static AnyClass>;
219
220        #[cfg(feature = "UIPopoverBackgroundView")]
221        /// Setter for [`popoverBackgroundViewClass`][Self::popoverBackgroundViewClass].
222        #[unsafe(method(setPopoverBackgroundViewClass:))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn setPopoverBackgroundViewClass(
225            &self,
226            popover_background_view_class: Option<&AnyClass>,
227        );
228
229        #[cfg(feature = "UISheetPresentationController")]
230        #[unsafe(method(adaptiveSheetPresentationController))]
231        #[unsafe(method_family = none)]
232        pub unsafe fn adaptiveSheetPresentationController(
233            &self,
234        ) -> Retained<UISheetPresentationController>;
235    );
236}
237
238/// Methods declared on superclass `UIPresentationController`.
239#[cfg(feature = "UIPresentationController")]
240impl UIPopoverPresentationController {
241    extern_methods!(
242        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
243        #[unsafe(method(initWithPresentedViewController:presentingViewController:))]
244        #[unsafe(method_family = init)]
245        pub unsafe fn initWithPresentedViewController_presentingViewController(
246            this: Allocated<Self>,
247            presented_view_controller: &UIViewController,
248            presenting_view_controller: Option<&UIViewController>,
249        ) -> Retained<Self>;
250
251        #[unsafe(method(init))]
252        #[unsafe(method_family = init)]
253        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
254    );
255}
256
257/// Methods declared on superclass `NSObject`.
258#[cfg(feature = "UIPresentationController")]
259impl UIPopoverPresentationController {
260    extern_methods!(
261        #[unsafe(method(new))]
262        #[unsafe(method_family = new)]
263        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
264    );
265}