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