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 unsafe 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 unsafe fn delegate(
45            &self,
46        ) -> Option<Retained<ProtocolObject<dyn UIPopoverControllerDelegate>>>;
47
48        /// This is a [weak property][objc2::topics::weak_property].
49        /// Setter for [`delegate`][Self::delegate].
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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe fn passthroughViews(&self) -> Option<Retained<NSArray<UIView>>>;
116
117        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
118        /// Setter for [`passthroughViews`][Self::passthroughViews].
119        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
120        #[unsafe(method(setPassthroughViews:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setPassthroughViews(&self, passthrough_views: Option<&NSArray<UIView>>);
123
124        #[cfg(all(
125            feature = "UIPopoverSupport",
126            feature = "UIResponder",
127            feature = "UIView",
128            feature = "objc2-core-foundation"
129        ))]
130        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
131        #[unsafe(method(presentPopoverFromRect:inView:permittedArrowDirections:animated:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn presentPopoverFromRect_inView_permittedArrowDirections_animated(
134            &self,
135            rect: CGRect,
136            view: &UIView,
137            arrow_directions: UIPopoverArrowDirection,
138            animated: bool,
139        );
140
141        #[cfg(all(
142            feature = "UIBarButtonItem",
143            feature = "UIBarItem",
144            feature = "UIPopoverSupport"
145        ))]
146        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
147        #[unsafe(method(presentPopoverFromBarButtonItem:permittedArrowDirections:animated:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn presentPopoverFromBarButtonItem_permittedArrowDirections_animated(
150            &self,
151            item: &UIBarButtonItem,
152            arrow_directions: UIPopoverArrowDirection,
153            animated: bool,
154        );
155
156        #[deprecated = "UIPopoverController is deprecated. Popovers are now implemented as UIViewController presentations. Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController."]
157        #[unsafe(method(dismissPopoverAnimated:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn dismissPopoverAnimated(&self, animated: bool);
160
161        #[cfg(feature = "UIColor")]
162        #[unsafe(method(backgroundColor))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn backgroundColor(&self) -> Option<Retained<UIColor>>;
165
166        #[cfg(feature = "UIColor")]
167        /// Setter for [`backgroundColor`][Self::backgroundColor].
168        #[unsafe(method(setBackgroundColor:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn setBackgroundColor(&self, background_color: Option<&UIColor>);
171
172        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
173        #[unsafe(method(popoverLayoutMargins))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn popoverLayoutMargins(&self) -> UIEdgeInsets;
176
177        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
178        /// Setter for [`popoverLayoutMargins`][Self::popoverLayoutMargins].
179        #[unsafe(method(setPopoverLayoutMargins:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setPopoverLayoutMargins(&self, popover_layout_margins: UIEdgeInsets);
182
183        #[unsafe(method(popoverBackgroundViewClass))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn popoverBackgroundViewClass(&self) -> Option<&'static AnyClass>;
186
187        /// Setter for [`popoverBackgroundViewClass`][Self::popoverBackgroundViewClass].
188        #[unsafe(method(setPopoverBackgroundViewClass:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn setPopoverBackgroundViewClass(
191            &self,
192            popover_background_view_class: Option<&AnyClass>,
193        );
194    );
195}
196
197/// Methods declared on superclass `NSObject`.
198impl UIPopoverController {
199    extern_methods!(
200        #[unsafe(method(init))]
201        #[unsafe(method_family = init)]
202        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
203
204        #[unsafe(method(new))]
205        #[unsafe(method_family = new)]
206        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
207    );
208}
209
210extern_protocol!(
211    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipopovercontrollerdelegate?language=objc)
212    pub unsafe trait UIPopoverControllerDelegate: NSObjectProtocol + MainThreadOnly {
213        #[deprecated]
214        #[optional]
215        #[unsafe(method(popoverControllerShouldDismissPopover:))]
216        #[unsafe(method_family = none)]
217        unsafe fn popoverControllerShouldDismissPopover(
218            &self,
219            popover_controller: &UIPopoverController,
220        ) -> bool;
221
222        #[deprecated]
223        #[optional]
224        #[unsafe(method(popoverControllerDidDismissPopover:))]
225        #[unsafe(method_family = none)]
226        unsafe fn popoverControllerDidDismissPopover(
227            &self,
228            popover_controller: &UIPopoverController,
229        );
230
231        #[cfg(all(
232            feature = "UIResponder",
233            feature = "UIView",
234            feature = "objc2-core-foundation"
235        ))]
236        #[deprecated]
237        #[optional]
238        #[unsafe(method(popoverController:willRepositionPopoverToRect:inView:))]
239        #[unsafe(method_family = none)]
240        unsafe fn popoverController_willRepositionPopoverToRect_inView(
241            &self,
242            popover_controller: &UIPopoverController,
243            rect: NonNull<CGRect>,
244            view: &mut Retained<UIView>,
245        );
246    }
247);