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