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        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        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        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        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        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 fn showsLargeContentViewer(&self) -> bool;
55
56        /// Setter for [`showsLargeContentViewer`][Self::showsLargeContentViewer].
57        #[unsafe(method(setShowsLargeContentViewer:))]
58        #[unsafe(method_family = none)]
59        pub fn setShowsLargeContentViewer(&self, shows_large_content_viewer: bool);
60
61        #[unsafe(method(largeContentTitle))]
62        #[unsafe(method_family = none)]
63        pub fn largeContentTitle(&self) -> Option<Retained<NSString>>;
64
65        /// Setter for [`largeContentTitle`][Self::largeContentTitle].
66        ///
67        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
68        #[unsafe(method(setLargeContentTitle:))]
69        #[unsafe(method_family = none)]
70        pub fn setLargeContentTitle(&self, large_content_title: Option<&NSString>);
71
72        #[cfg(feature = "UIImage")]
73        #[unsafe(method(largeContentImage))]
74        #[unsafe(method_family = none)]
75        pub fn largeContentImage(&self) -> Option<Retained<UIImage>>;
76
77        #[cfg(feature = "UIImage")]
78        /// Setter for [`largeContentImage`][Self::largeContentImage].
79        #[unsafe(method(setLargeContentImage:))]
80        #[unsafe(method_family = none)]
81        pub fn setLargeContentImage(&self, large_content_image: Option<&UIImage>);
82
83        #[unsafe(method(scalesLargeContentImage))]
84        #[unsafe(method_family = none)]
85        pub fn scalesLargeContentImage(&self) -> bool;
86
87        /// Setter for [`scalesLargeContentImage`][Self::scalesLargeContentImage].
88        #[unsafe(method(setScalesLargeContentImage:))]
89        #[unsafe(method_family = none)]
90        pub fn setScalesLargeContentImage(&self, scales_large_content_image: bool);
91
92        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
93        #[unsafe(method(largeContentImageInsets))]
94        #[unsafe(method_family = none)]
95        pub fn largeContentImageInsets(&self) -> UIEdgeInsets;
96
97        #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
98        /// Setter for [`largeContentImageInsets`][Self::largeContentImageInsets].
99        #[unsafe(method(setLargeContentImageInsets:))]
100        #[unsafe(method_family = none)]
101        pub fn setLargeContentImageInsets(&self, large_content_image_insets: UIEdgeInsets);
102    );
103}
104
105#[cfg(all(feature = "UIResponder", feature = "UIView"))]
106extern_conformance!(
107    unsafe impl UILargeContentViewerItem for UIView {}
108);
109
110extern_class!(
111    /// UILargeContentViewerInteraction enables a gesture to present and dismiss the large content viewer on a device with relevant settings.
112    /// Use methods in
113    /// <UIKit
114    /// /UIInteraction.h> to add the interaction to an appropriate view, such as a custom tab bar.
115    ///
116    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uilargecontentviewerinteraction?language=objc)
117    #[unsafe(super(NSObject))]
118    #[thread_kind = MainThreadOnly]
119    #[derive(Debug, PartialEq, Eq, Hash)]
120    pub struct UILargeContentViewerInteraction;
121);
122
123extern_conformance!(
124    unsafe impl NSObjectProtocol for UILargeContentViewerInteraction {}
125);
126
127#[cfg(feature = "UIInteraction")]
128extern_conformance!(
129    unsafe impl UIInteraction for UILargeContentViewerInteraction {}
130);
131
132impl UILargeContentViewerInteraction {
133    extern_methods!(
134        #[unsafe(method(initWithDelegate:))]
135        #[unsafe(method_family = init)]
136        pub fn initWithDelegate(
137            this: Allocated<Self>,
138            delegate: Option<&ProtocolObject<dyn UILargeContentViewerInteractionDelegate>>,
139        ) -> Retained<Self>;
140
141        #[unsafe(method(delegate))]
142        #[unsafe(method_family = none)]
143        pub fn delegate(
144            &self,
145        ) -> Option<Retained<ProtocolObject<dyn UILargeContentViewerInteractionDelegate>>>;
146
147        #[cfg(feature = "UIGestureRecognizer")]
148        /// Returns a gesture recognizer that can be used to set up simultaneous recognition or failure relationships with other gesture recognizers.
149        #[unsafe(method(gestureRecognizerForExclusionRelationship))]
150        #[unsafe(method_family = none)]
151        pub fn gestureRecognizerForExclusionRelationship(&self) -> Retained<UIGestureRecognizer>;
152
153        /// Returns whether the large content viewer is enabled on the device.
154        /// It is not necessary to check this value before adding a UILargeContentViewerInteraction to a view,
155        /// but it may be helpful if you need to adjust the behavior of coexisting gesture handlers.
156        /// For example, a button with a long press handler might increase its long press duration,
157        /// so that a user can read text in the large content viewer first.
158        #[unsafe(method(isEnabled))]
159        #[unsafe(method_family = none)]
160        pub fn isEnabled(mtm: MainThreadMarker) -> bool;
161    );
162}
163
164/// Methods declared on superclass `NSObject`.
165impl UILargeContentViewerInteraction {
166    extern_methods!(
167        #[unsafe(method(init))]
168        #[unsafe(method_family = init)]
169        pub fn init(this: Allocated<Self>) -> Retained<Self>;
170
171        #[unsafe(method(new))]
172        #[unsafe(method_family = new)]
173        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
174    );
175}
176
177extern_protocol!(
178    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uilargecontentviewerinteractiondelegate?language=objc)
179    pub unsafe trait UILargeContentViewerInteractionDelegate:
180        NSObjectProtocol + MainThreadOnly
181    {
182        #[cfg(feature = "objc2-core-foundation")]
183        /// Performs an action when the large content viewer gesture ends at the location of the given item.
184        /// (The point in the interaction's view's coordinate system is also provided.)
185        /// For example, you may wish to perform the action that would have occurred if the user had tapped on that item.
186        /// 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.
187        /// This method is called only if the gesture ends successfully (not if it fails or gets canceled).
188        #[optional]
189        #[unsafe(method(largeContentViewerInteraction:didEndOnItem:atPoint:))]
190        #[unsafe(method_family = none)]
191        fn largeContentViewerInteraction_didEndOnItem_atPoint(
192            &self,
193            interaction: &UILargeContentViewerInteraction,
194            item: Option<&ProtocolObject<dyn UILargeContentViewerItem>>,
195            point: CGPoint,
196        );
197
198        #[cfg(feature = "objc2-core-foundation")]
199        /// Returns the item at a given point in the interaction's view's coordinate system.
200        /// If this is not implemented, -[UIView pointInside:withEvent:] will be called recursively on the interaction's view to find an appropriate view.
201        #[optional]
202        #[unsafe(method(largeContentViewerInteraction:itemAtPoint:))]
203        #[unsafe(method_family = none)]
204        fn largeContentViewerInteraction_itemAtPoint(
205            &self,
206            interaction: &UILargeContentViewerInteraction,
207            point: CGPoint,
208        ) -> Option<Retained<ProtocolObject<dyn UILargeContentViewerItem>>>;
209
210        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
211        /// Returns the view controller whose region of the screen should be used to display the large content viewer.
212        /// If this is not implemented, a view controller that contains the interaction's view will be chosen.
213        #[optional]
214        #[unsafe(method(viewControllerForLargeContentViewerInteraction:))]
215        #[unsafe(method_family = none)]
216        fn viewControllerForLargeContentViewerInteraction(
217            &self,
218            interaction: &UILargeContentViewerInteraction,
219        ) -> Retained<UIViewController>;
220    }
221);
222
223extern "C" {
224    /// Posted when the large content viewer gets enabled or disabled on the device.
225    ///
226    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uilargecontentviewerinteractionenabledstatusdidchangenotification?language=objc)
227    pub static UILargeContentViewerInteractionEnabledStatusDidChangeNotification:
228        &'static NSNotificationName;
229}