objc2_ui_kit/generated/
UIPopoverController.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_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipopovercontroller?language=objc)
14    #[unsafe(super(NSObject))]
15    #[thread_kind = MainThreadOnly]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
18    pub struct UIPopoverController;
19);
20
21extern_conformance!(
22    unsafe impl NSObjectProtocol for UIPopoverController {}
23);
24
25#[cfg(feature = "UIAppearance")]
26extern_conformance!(
27    unsafe impl UIAppearanceContainer for UIPopoverController {}
28);
29
30impl UIPopoverController {
31    extern_methods!(
32        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
33        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
34        #[unsafe(method(initWithContentViewController:))]
35        #[unsafe(method_family = init)]
36        pub fn initWithContentViewController(
37            this: Allocated<Self>,
38            view_controller: &UIViewController,
39        ) -> Retained<Self>;
40
41        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
42        #[unsafe(method(delegate))]
43        #[unsafe(method_family = none)]
44        pub fn delegate(&self)
45            -> Option<Retained<ProtocolObject<dyn UIPopoverControllerDelegate>>>;
46
47        /// Setter for [`delegate`][Self::delegate].
48        ///
49        /// This is a [weak property][objc2::topics::weak_property].
50        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
51        #[unsafe(method(setDelegate:))]
52        #[unsafe(method_family = none)]
53        pub fn setDelegate(
54            &self,
55            delegate: Option<&ProtocolObject<dyn UIPopoverControllerDelegate>>,
56        );
57
58        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
59        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
60        #[unsafe(method(contentViewController))]
61        #[unsafe(method_family = none)]
62        pub fn contentViewController(&self) -> Retained<UIViewController>;
63
64        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
65        /// Setter for [`contentViewController`][Self::contentViewController].
66        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
67        #[unsafe(method(setContentViewController:))]
68        #[unsafe(method_family = none)]
69        pub fn setContentViewController(&self, content_view_controller: &UIViewController);
70
71        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
72        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
73        #[unsafe(method(setContentViewController:animated:))]
74        #[unsafe(method_family = none)]
75        pub fn setContentViewController_animated(
76            &self,
77            view_controller: &UIViewController,
78            animated: bool,
79        );
80
81        #[cfg(feature = "objc2-core-foundation")]
82        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
83        #[unsafe(method(popoverContentSize))]
84        #[unsafe(method_family = none)]
85        pub fn popoverContentSize(&self) -> CGSize;
86
87        #[cfg(feature = "objc2-core-foundation")]
88        /// Setter for [`popoverContentSize`][Self::popoverContentSize].
89        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
90        #[unsafe(method(setPopoverContentSize:))]
91        #[unsafe(method_family = none)]
92        pub fn setPopoverContentSize(&self, popover_content_size: CGSize);
93
94        #[cfg(feature = "objc2-core-foundation")]
95        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
96        #[unsafe(method(setPopoverContentSize:animated:))]
97        #[unsafe(method_family = none)]
98        pub fn setPopoverContentSize_animated(&self, size: CGSize, animated: bool);
99
100        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
101        #[unsafe(method(isPopoverVisible))]
102        #[unsafe(method_family = none)]
103        pub fn isPopoverVisible(&self) -> bool;
104
105        #[cfg(feature = "UIPopoverSupport")]
106        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
107        #[unsafe(method(popoverArrowDirection))]
108        #[unsafe(method_family = none)]
109        pub fn popoverArrowDirection(&self) -> UIPopoverArrowDirection;
110
111        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
112        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
113        #[unsafe(method(passthroughViews))]
114        #[unsafe(method_family = none)]
115        pub fn passthroughViews(&self) -> Option<Retained<NSArray<UIView>>>;
116
117        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
118        /// Setter for [`passthroughViews`][Self::passthroughViews].
119        ///
120        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
121        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
122        #[unsafe(method(setPassthroughViews:))]
123        #[unsafe(method_family = none)]
124        pub fn setPassthroughViews(&self, passthrough_views: Option<&NSArray<UIView>>);
125
126        #[cfg(all(
127            feature = "UIPopoverSupport",
128            feature = "UIResponder",
129            feature = "UIView",
130            feature = "objc2-core-foundation"
131        ))]
132        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
133        #[unsafe(method(presentPopoverFromRect:inView:permittedArrowDirections:animated:))]
134        #[unsafe(method_family = none)]
135        pub fn presentPopoverFromRect_inView_permittedArrowDirections_animated(
136            &self,
137            rect: CGRect,
138            view: &UIView,
139            arrow_directions: UIPopoverArrowDirection,
140            animated: bool,
141        );
142
143        #[cfg(all(
144            feature = "UIBarButtonItem",
145            feature = "UIBarItem",
146            feature = "UIPopoverSupport"
147        ))]
148        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
149        #[unsafe(method(presentPopoverFromBarButtonItem:permittedArrowDirections:animated:))]
150        #[unsafe(method_family = none)]
151        pub fn presentPopoverFromBarButtonItem_permittedArrowDirections_animated(
152            &self,
153            item: &UIBarButtonItem,
154            arrow_directions: UIPopoverArrowDirection,
155            animated: bool,
156        );
157
158        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
159        #[unsafe(method(dismissPopoverAnimated:))]
160        #[unsafe(method_family = none)]
161        pub fn dismissPopoverAnimated(&self, animated: bool);
162
163        #[cfg(feature = "UIColor")]
164        #[unsafe(method(backgroundColor))]
165        #[unsafe(method_family = none)]
166        pub fn backgroundColor(&self) -> Option<Retained<UIColor>>;
167
168        #[cfg(feature = "UIColor")]
169        /// Setter for [`backgroundColor`][Self::backgroundColor].
170        ///
171        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
172        #[unsafe(method(setBackgroundColor:))]
173        #[unsafe(method_family = none)]
174        pub fn setBackgroundColor(&self, background_color: Option<&UIColor>);
175
176        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
177        #[unsafe(method(popoverLayoutMargins))]
178        #[unsafe(method_family = none)]
179        pub fn popoverLayoutMargins(&self) -> UIEdgeInsets;
180
181        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
182        /// Setter for [`popoverLayoutMargins`][Self::popoverLayoutMargins].
183        #[unsafe(method(setPopoverLayoutMargins:))]
184        #[unsafe(method_family = none)]
185        pub fn setPopoverLayoutMargins(&self, popover_layout_margins: UIEdgeInsets);
186
187        #[unsafe(method(popoverBackgroundViewClass))]
188        #[unsafe(method_family = none)]
189        pub fn popoverBackgroundViewClass(&self) -> Option<&'static AnyClass>;
190
191        /// Setter for [`popoverBackgroundViewClass`][Self::popoverBackgroundViewClass].
192        ///
193        /// # Safety
194        ///
195        /// `popover_background_view_class` probably has further requirements.
196        #[unsafe(method(setPopoverBackgroundViewClass:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn setPopoverBackgroundViewClass(
199            &self,
200            popover_background_view_class: Option<&AnyClass>,
201        );
202    );
203}
204
205/// Methods declared on superclass `NSObject`.
206impl UIPopoverController {
207    extern_methods!(
208        #[unsafe(method(init))]
209        #[unsafe(method_family = init)]
210        pub fn init(this: Allocated<Self>) -> Retained<Self>;
211
212        #[unsafe(method(new))]
213        #[unsafe(method_family = new)]
214        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
215    );
216}
217
218extern_protocol!(
219    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipopovercontrollerdelegate?language=objc)
220    pub unsafe trait UIPopoverControllerDelegate: NSObjectProtocol + MainThreadOnly {
221        #[deprecated]
222        #[optional]
223        #[unsafe(method(popoverControllerShouldDismissPopover:))]
224        #[unsafe(method_family = none)]
225        fn popoverControllerShouldDismissPopover(
226            &self,
227            popover_controller: &UIPopoverController,
228        ) -> bool;
229
230        #[deprecated]
231        #[optional]
232        #[unsafe(method(popoverControllerDidDismissPopover:))]
233        #[unsafe(method_family = none)]
234        fn popoverControllerDidDismissPopover(&self, popover_controller: &UIPopoverController);
235
236        #[cfg(all(
237            feature = "UIResponder",
238            feature = "UIView",
239            feature = "objc2-core-foundation"
240        ))]
241        /// # Safety
242        ///
243        /// `rect` must be a valid pointer.
244        #[deprecated]
245        #[optional]
246        #[unsafe(method(popoverController:willRepositionPopoverToRect:inView:))]
247        #[unsafe(method_family = none)]
248        unsafe fn popoverController_willRepositionPopoverToRect_inView(
249            &self,
250            popover_controller: &UIPopoverController,
251            rect: NonNull<CGRect>,
252            view: &mut Retained<UIView>,
253        );
254    }
255);