1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12#[cfg(feature = "objc2-symbols")]
13use objc2_symbols::*;
14
15use crate::*;
16
17extern_class!(
18 #[unsafe(super(UIView, UIResponder, NSObject))]
20 #[thread_kind = MainThreadOnly]
21 #[derive(Debug, PartialEq, Eq, Hash)]
22 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
23 pub struct UIImageView;
24);
25
26#[cfg(all(
27 feature = "UIResponder",
28 feature = "UIView",
29 feature = "objc2-quartz-core"
30))]
31#[cfg(not(target_os = "watchos"))]
32unsafe impl CALayerDelegate for UIImageView {}
33
34#[cfg(all(feature = "UIResponder", feature = "UIView"))]
35unsafe impl NSCoding for UIImageView {}
36
37#[cfg(all(feature = "UIResponder", feature = "UIView"))]
38unsafe impl NSObjectProtocol for UIImageView {}
39
40#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
41unsafe impl UIAppearance for UIImageView {}
42
43#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
44unsafe impl UIAppearanceContainer for UIImageView {}
45
46#[cfg(all(feature = "UIResponder", feature = "UIView"))]
47unsafe impl UICoordinateSpace for UIImageView {}
48
49#[cfg(all(
50 feature = "UIDynamicBehavior",
51 feature = "UIResponder",
52 feature = "UIView"
53))]
54unsafe impl UIDynamicItem for UIImageView {}
55
56#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
57unsafe impl UIFocusEnvironment for UIImageView {}
58
59#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
60unsafe impl UIFocusItem for UIImageView {}
61
62#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
63unsafe impl UIFocusItemContainer for UIImageView {}
64
65#[cfg(all(feature = "UIResponder", feature = "UIView"))]
66unsafe impl UIResponderStandardEditActions for UIImageView {}
67
68#[cfg(all(
69 feature = "UIResponder",
70 feature = "UITraitCollection",
71 feature = "UIView"
72))]
73unsafe impl UITraitEnvironment for UIImageView {}
74
75#[cfg(all(feature = "UIResponder", feature = "UIView"))]
76impl UIImageView {
77 extern_methods!(
78 #[cfg(feature = "UIImage")]
79 #[unsafe(method(initWithImage:))]
80 #[unsafe(method_family = init)]
81 pub unsafe fn initWithImage(
82 this: Allocated<Self>,
83 image: Option<&UIImage>,
84 ) -> Retained<Self>;
85
86 #[cfg(feature = "UIImage")]
87 #[unsafe(method(initWithImage:highlightedImage:))]
88 #[unsafe(method_family = init)]
89 pub unsafe fn initWithImage_highlightedImage(
90 this: Allocated<Self>,
91 image: Option<&UIImage>,
92 highlighted_image: Option<&UIImage>,
93 ) -> Retained<Self>;
94
95 #[cfg(feature = "UIImage")]
96 #[unsafe(method(image))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
99
100 #[cfg(feature = "UIImage")]
101 #[unsafe(method(setImage:))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn setImage(&self, image: Option<&UIImage>);
105
106 #[cfg(feature = "UIImage")]
107 #[unsafe(method(highlightedImage))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn highlightedImage(&self) -> Option<Retained<UIImage>>;
110
111 #[cfg(feature = "UIImage")]
112 #[unsafe(method(setHighlightedImage:))]
114 #[unsafe(method_family = none)]
115 pub unsafe fn setHighlightedImage(&self, highlighted_image: Option<&UIImage>);
116
117 #[cfg(all(
118 feature = "UIImageConfiguration",
119 feature = "UIImageSymbolConfiguration"
120 ))]
121 #[unsafe(method(preferredSymbolConfiguration))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn preferredSymbolConfiguration(
124 &self,
125 ) -> Option<Retained<UIImageSymbolConfiguration>>;
126
127 #[cfg(all(
128 feature = "UIImageConfiguration",
129 feature = "UIImageSymbolConfiguration"
130 ))]
131 #[unsafe(method(setPreferredSymbolConfiguration:))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn setPreferredSymbolConfiguration(
135 &self,
136 preferred_symbol_configuration: Option<&UIImageSymbolConfiguration>,
137 );
138
139 #[unsafe(method(isUserInteractionEnabled))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn isUserInteractionEnabled(&self) -> bool;
142
143 #[unsafe(method(setUserInteractionEnabled:))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn setUserInteractionEnabled(&self, user_interaction_enabled: bool);
147
148 #[unsafe(method(isHighlighted))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn isHighlighted(&self) -> bool;
151
152 #[unsafe(method(setHighlighted:))]
154 #[unsafe(method_family = none)]
155 pub unsafe fn setHighlighted(&self, highlighted: bool);
156
157 #[cfg(feature = "UIImage")]
158 #[unsafe(method(animationImages))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn animationImages(&self) -> Option<Retained<NSArray<UIImage>>>;
161
162 #[cfg(feature = "UIImage")]
163 #[unsafe(method(setAnimationImages:))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn setAnimationImages(&self, animation_images: Option<&NSArray<UIImage>>);
167
168 #[cfg(feature = "UIImage")]
169 #[unsafe(method(highlightedAnimationImages))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn highlightedAnimationImages(&self) -> Option<Retained<NSArray<UIImage>>>;
172
173 #[cfg(feature = "UIImage")]
174 #[unsafe(method(setHighlightedAnimationImages:))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn setHighlightedAnimationImages(
178 &self,
179 highlighted_animation_images: Option<&NSArray<UIImage>>,
180 );
181
182 #[unsafe(method(animationDuration))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn animationDuration(&self) -> NSTimeInterval;
185
186 #[unsafe(method(setAnimationDuration:))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn setAnimationDuration(&self, animation_duration: NSTimeInterval);
190
191 #[unsafe(method(animationRepeatCount))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn animationRepeatCount(&self) -> NSInteger;
194
195 #[unsafe(method(setAnimationRepeatCount:))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn setAnimationRepeatCount(&self, animation_repeat_count: NSInteger);
199
200 #[cfg(feature = "UIColor")]
201 #[unsafe(method(tintColor))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
204
205 #[cfg(feature = "UIColor")]
206 #[unsafe(method(setTintColor:))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
210
211 #[unsafe(method(startAnimating))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn startAnimating(&self);
214
215 #[unsafe(method(stopAnimating))]
216 #[unsafe(method_family = none)]
217 pub unsafe fn stopAnimating(&self);
218
219 #[unsafe(method(isAnimating))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn isAnimating(&self) -> bool;
222
223 #[cfg(feature = "UIInterface")]
224 #[unsafe(method(preferredImageDynamicRange))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn preferredImageDynamicRange(&self) -> UIImageDynamicRange;
228
229 #[cfg(feature = "UIInterface")]
230 #[unsafe(method(setPreferredImageDynamicRange:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn setPreferredImageDynamicRange(
234 &self,
235 preferred_image_dynamic_range: UIImageDynamicRange,
236 );
237
238 #[cfg(feature = "UIInterface")]
239 #[unsafe(method(imageDynamicRange))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn imageDynamicRange(&self) -> UIImageDynamicRange;
243
244 #[unsafe(method(adjustsImageWhenAncestorFocused))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn adjustsImageWhenAncestorFocused(&self) -> bool;
247
248 #[unsafe(method(setAdjustsImageWhenAncestorFocused:))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn setAdjustsImageWhenAncestorFocused(
252 &self,
253 adjusts_image_when_ancestor_focused: bool,
254 );
255
256 #[cfg(feature = "UILayoutGuide")]
257 #[unsafe(method(focusedFrameGuide))]
258 #[unsafe(method_family = none)]
259 pub unsafe fn focusedFrameGuide(&self) -> Retained<UILayoutGuide>;
260
261 #[unsafe(method(overlayContentView))]
262 #[unsafe(method_family = none)]
263 pub unsafe fn overlayContentView(&self) -> Retained<UIView>;
264
265 #[unsafe(method(masksFocusEffectToContents))]
266 #[unsafe(method_family = none)]
267 pub unsafe fn masksFocusEffectToContents(&self) -> bool;
268
269 #[unsafe(method(setMasksFocusEffectToContents:))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn setMasksFocusEffectToContents(&self, masks_focus_effect_to_contents: bool);
273 );
274}
275
276#[cfg(all(feature = "UIResponder", feature = "UIView"))]
278impl UIImageView {
279 extern_methods!(
280 #[cfg(feature = "objc2-core-foundation")]
281 #[unsafe(method(initWithFrame:))]
282 #[unsafe(method_family = init)]
283 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
284
285 #[unsafe(method(initWithCoder:))]
286 #[unsafe(method_family = init)]
287 pub unsafe fn initWithCoder(
288 this: Allocated<Self>,
289 coder: &NSCoder,
290 ) -> Option<Retained<Self>>;
291 );
292}
293
294#[cfg(all(feature = "UIResponder", feature = "UIView"))]
296impl UIImageView {
297 extern_methods!(
298 #[unsafe(method(init))]
299 #[unsafe(method_family = init)]
300 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
301
302 #[unsafe(method(new))]
303 #[unsafe(method_family = new)]
304 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
305 );
306}
307
308#[cfg(all(feature = "UIResponder", feature = "UIView"))]
309impl UIImageView {
310 extern_methods!(
311 #[cfg(feature = "objc2-symbols")]
312 #[unsafe(method(addSymbolEffect:))]
314 #[unsafe(method_family = none)]
315 pub unsafe fn addSymbolEffect(&self, symbol_effect: &NSSymbolEffect);
316
317 #[cfg(feature = "objc2-symbols")]
318 #[unsafe(method(addSymbolEffect:options:))]
320 #[unsafe(method_family = none)]
321 pub unsafe fn addSymbolEffect_options(
322 &self,
323 symbol_effect: &NSSymbolEffect,
324 options: &NSSymbolEffectOptions,
325 );
326
327 #[cfg(feature = "objc2-symbols")]
328 #[unsafe(method(addSymbolEffect:options:animated:))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn addSymbolEffect_options_animated(
332 &self,
333 symbol_effect: &NSSymbolEffect,
334 options: &NSSymbolEffectOptions,
335 animated: bool,
336 );
337
338 #[cfg(all(
339 feature = "UISymbolEffectCompletion",
340 feature = "block2",
341 feature = "objc2-symbols"
342 ))]
343 #[unsafe(method(addSymbolEffect:options:animated:completion:))]
345 #[unsafe(method_family = none)]
346 pub unsafe fn addSymbolEffect_options_animated_completion(
347 &self,
348 symbol_effect: &NSSymbolEffect,
349 options: &NSSymbolEffectOptions,
350 animated: bool,
351 completion_handler: UISymbolEffectCompletion,
352 );
353
354 #[cfg(feature = "objc2-symbols")]
355 #[unsafe(method(removeSymbolEffectOfType:))]
357 #[unsafe(method_family = none)]
358 pub unsafe fn removeSymbolEffectOfType(&self, symbol_effect: &NSSymbolEffect);
359
360 #[cfg(feature = "objc2-symbols")]
361 #[unsafe(method(removeSymbolEffectOfType:options:))]
363 #[unsafe(method_family = none)]
364 pub unsafe fn removeSymbolEffectOfType_options(
365 &self,
366 symbol_effect: &NSSymbolEffect,
367 options: &NSSymbolEffectOptions,
368 );
369
370 #[cfg(feature = "objc2-symbols")]
371 #[unsafe(method(removeSymbolEffectOfType:options:animated:))]
373 #[unsafe(method_family = none)]
374 pub unsafe fn removeSymbolEffectOfType_options_animated(
375 &self,
376 symbol_effect: &NSSymbolEffect,
377 options: &NSSymbolEffectOptions,
378 animated: bool,
379 );
380
381 #[cfg(all(
382 feature = "UISymbolEffectCompletion",
383 feature = "block2",
384 feature = "objc2-symbols"
385 ))]
386 #[unsafe(method(removeSymbolEffectOfType:options:animated:completion:))]
388 #[unsafe(method_family = none)]
389 pub unsafe fn removeSymbolEffectOfType_options_animated_completion(
390 &self,
391 symbol_effect: &NSSymbolEffect,
392 options: &NSSymbolEffectOptions,
393 animated: bool,
394 completion_handler: UISymbolEffectCompletion,
395 );
396
397 #[unsafe(method(removeAllSymbolEffects))]
399 #[unsafe(method_family = none)]
400 pub unsafe fn removeAllSymbolEffects(&self);
401
402 #[cfg(feature = "objc2-symbols")]
403 #[unsafe(method(removeAllSymbolEffectsWithOptions:))]
405 #[unsafe(method_family = none)]
406 pub unsafe fn removeAllSymbolEffectsWithOptions(&self, options: &NSSymbolEffectOptions);
407
408 #[cfg(feature = "objc2-symbols")]
409 #[unsafe(method(removeAllSymbolEffectsWithOptions:animated:))]
411 #[unsafe(method_family = none)]
412 pub unsafe fn removeAllSymbolEffectsWithOptions_animated(
413 &self,
414 options: &NSSymbolEffectOptions,
415 animated: bool,
416 );
417
418 #[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
419 #[unsafe(method(setSymbolImage:withContentTransition:))]
422 #[unsafe(method_family = none)]
423 pub unsafe fn setSymbolImage_withContentTransition(
424 &self,
425 symbol_image: &UIImage,
426 transition: &NSSymbolContentTransition,
427 );
428
429 #[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
430 #[unsafe(method(setSymbolImage:withContentTransition:options:))]
433 #[unsafe(method_family = none)]
434 pub unsafe fn setSymbolImage_withContentTransition_options(
435 &self,
436 symbol_image: &UIImage,
437 transition: &NSSymbolContentTransition,
438 options: &NSSymbolEffectOptions,
439 );
440
441 #[cfg(all(
442 feature = "UIImage",
443 feature = "UISymbolEffectCompletion",
444 feature = "block2",
445 feature = "objc2-symbols"
446 ))]
447 #[unsafe(method(setSymbolImage:withContentTransition:options:completion:))]
450 #[unsafe(method_family = none)]
451 pub unsafe fn setSymbolImage_withContentTransition_options_completion(
452 &self,
453 symbol_image: &UIImage,
454 transition: &NSSymbolContentTransition,
455 options: &NSSymbolEffectOptions,
456 completion_handler: UISymbolEffectCompletion,
457 );
458 );
459}