objc2_ui_kit/generated/
UILargeContentViewer.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/uilargecontentvieweritem?language=objc)
14    pub unsafe trait UILargeContentViewerItem: NSObjectProtocol + MainThreadOnly {
15        /// Returns whether the item shows the large content viewer.
16        /// In general, only views that cannot scale for the full range of Dynamic Type sizes should return YES.
17        /// For this property to take effect, the item or an ancestor view must have a UILargeContentViewerInteraction.
18        #[unsafe(method(showsLargeContentViewer))]
19        #[unsafe(method_family = none)]
20        unsafe fn showsLargeContentViewer(&self) -> bool;
21
22        /// Returns a title that should be shown in the large content viewer.
23        #[unsafe(method(largeContentTitle))]
24        #[unsafe(method_family = none)]
25        unsafe fn largeContentTitle(&self) -> Option<Retained<NSString>>;
26
27        #[cfg(feature = "UIImage")]
28        /// Returns an image that should be shown in the large content viewer.
29        #[unsafe(method(largeContentImage))]
30        #[unsafe(method_family = none)]
31        unsafe fn largeContentImage(&self) -> Option<Retained<UIImage>>;
32
33        /// Returns whether the image should be scaled to a larger size appropriate for the viewer.
34        /// If not, the image will be shown at its intrinsic size.
35        /// For best results when scaling, use a PDF asset with its "Preserve Vector Data" checkbox checked.
36        #[unsafe(method(scalesLargeContentImage))]
37        #[unsafe(method_family = none)]
38        unsafe fn scalesLargeContentImage(&self) -> bool;
39
40        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
41        /// Returns insets appropriate for positioning the image in the viewer so that it appears visually centered.
42        #[unsafe(method(largeContentImageInsets))]
43        #[unsafe(method_family = none)]
44        unsafe fn largeContentImageInsets(&self) -> UIEdgeInsets;
45    }
46);
47
48/// UILargeContentViewer.
49#[cfg(all(feature = "UIResponder", feature = "UIView"))]
50impl UIView {
51    extern_methods!(
52        #[unsafe(method(showsLargeContentViewer))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn showsLargeContentViewer(&self) -> bool;
55
56        /// Setter for [`showsLargeContentViewer`][Self::showsLargeContentViewer].
57        #[unsafe(method(setShowsLargeContentViewer:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn setShowsLargeContentViewer(&self, shows_large_content_viewer: bool);
60
61        #[unsafe(method(largeContentTitle))]
62        #[unsafe(method_family = none)]
63        pub unsafe fn largeContentTitle(&self) -> Option<Retained<NSString>>;
64
65        /// Setter for [`largeContentTitle`][Self::largeContentTitle].
66        #[unsafe(method(setLargeContentTitle:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn setLargeContentTitle(&self, large_content_title: Option<&NSString>);
69
70        #[cfg(feature = "UIImage")]
71        #[unsafe(method(largeContentImage))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn largeContentImage(&self) -> Option<Retained<UIImage>>;
74
75        #[cfg(feature = "UIImage")]
76        /// Setter for [`largeContentImage`][Self::largeContentImage].
77        #[unsafe(method(setLargeContentImage:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn setLargeContentImage(&self, large_content_image: Option<&UIImage>);
80
81        #[unsafe(method(scalesLargeContentImage))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn scalesLargeContentImage(&self) -> bool;
84
85        /// Setter for [`scalesLargeContentImage`][Self::scalesLargeContentImage].
86        #[unsafe(method(setScalesLargeContentImage:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn setScalesLargeContentImage(&self, scales_large_content_image: bool);
89
90        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
91        #[unsafe(method(largeContentImageInsets))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn largeContentImageInsets(&self) -> UIEdgeInsets;
94
95        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
96        /// Setter for [`largeContentImageInsets`][Self::largeContentImageInsets].
97        #[unsafe(method(setLargeContentImageInsets:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn setLargeContentImageInsets(&self, large_content_image_insets: UIEdgeInsets);
100    );
101}
102
103#[cfg(all(feature = "UIResponder", feature = "UIView"))]
104unsafe impl UILargeContentViewerItem for UIView {}
105
106extern_class!(
107    /// UILargeContentViewerInteraction enables a gesture to present and dismiss the large content viewer on a device with relevant settings.
108    /// Use methods in
109    /// <UIKit
110    /// /UIInteraction.h> to add the interaction to an appropriate view, such as a custom tab bar.
111    ///
112    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uilargecontentviewerinteraction?language=objc)
113    #[unsafe(super(NSObject))]
114    #[thread_kind = MainThreadOnly]
115    #[derive(Debug, PartialEq, Eq, Hash)]
116    pub struct UILargeContentViewerInteraction;
117);
118
119unsafe impl NSObjectProtocol for UILargeContentViewerInteraction {}
120
121#[cfg(feature = "UIInteraction")]
122unsafe impl UIInteraction for UILargeContentViewerInteraction {}
123
124impl UILargeContentViewerInteraction {
125    extern_methods!(
126        #[unsafe(method(initWithDelegate:))]
127        #[unsafe(method_family = init)]
128        pub unsafe fn initWithDelegate(
129            this: Allocated<Self>,
130            delegate: Option<&ProtocolObject<dyn UILargeContentViewerInteractionDelegate>>,
131        ) -> Retained<Self>;
132
133        #[unsafe(method(delegate))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn delegate(
136            &self,
137        ) -> Option<Retained<ProtocolObject<dyn UILargeContentViewerInteractionDelegate>>>;
138
139        #[cfg(feature = "UIGestureRecognizer")]
140        /// Returns a gesture recognizer that can be used to set up simultaneous recognition or failure relationships with other gesture recognizers.
141        #[unsafe(method(gestureRecognizerForExclusionRelationship))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn gestureRecognizerForExclusionRelationship(
144            &self,
145        ) -> Retained<UIGestureRecognizer>;
146
147        /// Returns whether the large content viewer is enabled on the device.
148        /// It is not necessary to check this value before adding a UILargeContentViewerInteraction to a view,
149        /// but it may be helpful if you need to adjust the behavior of coexisting gesture handlers.
150        /// For example, a button with a long press handler might increase its long press duration,
151        /// so that a user can read text in the large content viewer first.
152        #[unsafe(method(isEnabled))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn isEnabled(mtm: MainThreadMarker) -> bool;
155    );
156}
157
158/// Methods declared on superclass `NSObject`.
159impl UILargeContentViewerInteraction {
160    extern_methods!(
161        #[unsafe(method(init))]
162        #[unsafe(method_family = init)]
163        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
164
165        #[unsafe(method(new))]
166        #[unsafe(method_family = new)]
167        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
168    );
169}
170
171extern_protocol!(
172    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilargecontentviewerinteractiondelegate?language=objc)
173    pub unsafe trait UILargeContentViewerInteractionDelegate:
174        NSObjectProtocol + MainThreadOnly
175    {
176        #[cfg(feature = "objc2-core-foundation")]
177        /// Performs an action when the large content viewer gesture ends at the location of the given item.
178        /// (The point in the interaction's view's coordinate system is also provided.)
179        /// For example, you may wish to perform the action that would have occurred if the user had tapped on that item.
180        /// If you don’t implement this method and are using standard UIKit controls, the system performs a default action, such as sending a touchUpInside event to the control.
181        /// This method is called only if the gesture ends successfully (not if it fails or gets canceled).
182        #[optional]
183        #[unsafe(method(largeContentViewerInteraction:didEndOnItem:atPoint:))]
184        #[unsafe(method_family = none)]
185        unsafe fn largeContentViewerInteraction_didEndOnItem_atPoint(
186            &self,
187            interaction: &UILargeContentViewerInteraction,
188            item: Option<&ProtocolObject<dyn UILargeContentViewerItem>>,
189            point: CGPoint,
190        );
191
192        #[cfg(feature = "objc2-core-foundation")]
193        /// Returns the item at a given point in the interaction's view's coordinate system.
194        /// If this is not implemented, -[UIView pointInside:withEvent:] will be called recursively on the interaction's view to find an appropriate view.
195        #[optional]
196        #[unsafe(method(largeContentViewerInteraction:itemAtPoint:))]
197        #[unsafe(method_family = none)]
198        unsafe fn largeContentViewerInteraction_itemAtPoint(
199            &self,
200            interaction: &UILargeContentViewerInteraction,
201            point: CGPoint,
202        ) -> Option<Retained<ProtocolObject<dyn UILargeContentViewerItem>>>;
203
204        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
205        /// Returns the view controller whose region of the screen should be used to display the large content viewer.
206        /// If this is not implemented, a view controller that contains the interaction's view will be chosen.
207        #[optional]
208        #[unsafe(method(viewControllerForLargeContentViewerInteraction:))]
209        #[unsafe(method_family = none)]
210        unsafe fn viewControllerForLargeContentViewerInteraction(
211            &self,
212            interaction: &UILargeContentViewerInteraction,
213        ) -> Retained<UIViewController>;
214    }
215);
216
217extern "C" {
218    /// Posted when the large content viewer gets enabled or disabled on the device.
219    ///
220    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uilargecontentviewerinteractionenabledstatusdidchangenotification?language=objc)
221    pub static UILargeContentViewerInteractionEnabledStatusDidChangeNotification:
222        &'static NSNotificationName;
223}