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"))]
32extern_conformance!(
33 unsafe impl CALayerDelegate for UIImageView {}
34);
35
36#[cfg(all(feature = "UIResponder", feature = "UIView"))]
37extern_conformance!(
38 unsafe impl NSCoding for UIImageView {}
39);
40
41#[cfg(all(feature = "UIResponder", feature = "UIView"))]
42extern_conformance!(
43 unsafe impl NSObjectProtocol for UIImageView {}
44);
45
46#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
47extern_conformance!(
48 unsafe impl UIAppearance for UIImageView {}
49);
50
51#[cfg(all(feature = "UIAppearance", feature = "UIResponder", feature = "UIView"))]
52extern_conformance!(
53 unsafe impl UIAppearanceContainer for UIImageView {}
54);
55
56#[cfg(all(feature = "UIResponder", feature = "UIView"))]
57extern_conformance!(
58 unsafe impl UICoordinateSpace for UIImageView {}
59);
60
61#[cfg(all(
62 feature = "UIDynamicBehavior",
63 feature = "UIResponder",
64 feature = "UIView"
65))]
66extern_conformance!(
67 unsafe impl UIDynamicItem for UIImageView {}
68);
69
70#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
71extern_conformance!(
72 unsafe impl UIFocusEnvironment for UIImageView {}
73);
74
75#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
76extern_conformance!(
77 unsafe impl UIFocusItem for UIImageView {}
78);
79
80#[cfg(all(feature = "UIFocus", feature = "UIResponder", feature = "UIView"))]
81extern_conformance!(
82 unsafe impl UIFocusItemContainer for UIImageView {}
83);
84
85#[cfg(all(feature = "UIResponder", feature = "UIView"))]
86extern_conformance!(
87 unsafe impl UIResponderStandardEditActions for UIImageView {}
88);
89
90#[cfg(all(
91 feature = "UIResponder",
92 feature = "UITraitCollection",
93 feature = "UIView"
94))]
95extern_conformance!(
96 unsafe impl UITraitEnvironment for UIImageView {}
97);
98
99#[cfg(all(feature = "UIResponder", feature = "UIView"))]
100impl UIImageView {
101 extern_methods!(
102 #[cfg(feature = "UIImage")]
103 #[unsafe(method(initWithImage:))]
104 #[unsafe(method_family = init)]
105 pub unsafe fn initWithImage(
106 this: Allocated<Self>,
107 image: Option<&UIImage>,
108 ) -> Retained<Self>;
109
110 #[cfg(feature = "UIImage")]
111 #[unsafe(method(initWithImage:highlightedImage:))]
112 #[unsafe(method_family = init)]
113 pub unsafe fn initWithImage_highlightedImage(
114 this: Allocated<Self>,
115 image: Option<&UIImage>,
116 highlighted_image: Option<&UIImage>,
117 ) -> Retained<Self>;
118
119 #[cfg(feature = "UIImage")]
120 #[unsafe(method(image))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn image(&self) -> Option<Retained<UIImage>>;
123
124 #[cfg(feature = "UIImage")]
125 #[unsafe(method(setImage:))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn setImage(&self, image: Option<&UIImage>);
129
130 #[cfg(feature = "UIImage")]
131 #[unsafe(method(highlightedImage))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn highlightedImage(&self) -> Option<Retained<UIImage>>;
134
135 #[cfg(feature = "UIImage")]
136 #[unsafe(method(setHighlightedImage:))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn setHighlightedImage(&self, highlighted_image: Option<&UIImage>);
140
141 #[cfg(all(
142 feature = "UIImageConfiguration",
143 feature = "UIImageSymbolConfiguration"
144 ))]
145 #[unsafe(method(preferredSymbolConfiguration))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn preferredSymbolConfiguration(
148 &self,
149 ) -> Option<Retained<UIImageSymbolConfiguration>>;
150
151 #[cfg(all(
152 feature = "UIImageConfiguration",
153 feature = "UIImageSymbolConfiguration"
154 ))]
155 #[unsafe(method(setPreferredSymbolConfiguration:))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn setPreferredSymbolConfiguration(
159 &self,
160 preferred_symbol_configuration: Option<&UIImageSymbolConfiguration>,
161 );
162
163 #[unsafe(method(isUserInteractionEnabled))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn isUserInteractionEnabled(&self) -> bool;
166
167 #[unsafe(method(setUserInteractionEnabled:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn setUserInteractionEnabled(&self, user_interaction_enabled: bool);
171
172 #[unsafe(method(isHighlighted))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn isHighlighted(&self) -> bool;
175
176 #[unsafe(method(setHighlighted:))]
178 #[unsafe(method_family = none)]
179 pub unsafe fn setHighlighted(&self, highlighted: bool);
180
181 #[cfg(feature = "UIImage")]
182 #[unsafe(method(animationImages))]
183 #[unsafe(method_family = none)]
184 pub unsafe fn animationImages(&self) -> Option<Retained<NSArray<UIImage>>>;
185
186 #[cfg(feature = "UIImage")]
187 #[unsafe(method(setAnimationImages:))]
189 #[unsafe(method_family = none)]
190 pub unsafe fn setAnimationImages(&self, animation_images: Option<&NSArray<UIImage>>);
191
192 #[cfg(feature = "UIImage")]
193 #[unsafe(method(highlightedAnimationImages))]
194 #[unsafe(method_family = none)]
195 pub unsafe fn highlightedAnimationImages(&self) -> Option<Retained<NSArray<UIImage>>>;
196
197 #[cfg(feature = "UIImage")]
198 #[unsafe(method(setHighlightedAnimationImages:))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn setHighlightedAnimationImages(
202 &self,
203 highlighted_animation_images: Option<&NSArray<UIImage>>,
204 );
205
206 #[unsafe(method(animationDuration))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn animationDuration(&self) -> NSTimeInterval;
209
210 #[unsafe(method(setAnimationDuration:))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn setAnimationDuration(&self, animation_duration: NSTimeInterval);
214
215 #[unsafe(method(animationRepeatCount))]
216 #[unsafe(method_family = none)]
217 pub unsafe fn animationRepeatCount(&self) -> NSInteger;
218
219 #[unsafe(method(setAnimationRepeatCount:))]
221 #[unsafe(method_family = none)]
222 pub unsafe fn setAnimationRepeatCount(&self, animation_repeat_count: NSInteger);
223
224 #[cfg(feature = "UIColor")]
225 #[unsafe(method(tintColor))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn tintColor(&self) -> Option<Retained<UIColor>>;
228
229 #[cfg(feature = "UIColor")]
230 #[unsafe(method(setTintColor:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
234
235 #[unsafe(method(startAnimating))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn startAnimating(&self);
238
239 #[unsafe(method(stopAnimating))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn stopAnimating(&self);
242
243 #[unsafe(method(isAnimating))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn isAnimating(&self) -> bool;
246
247 #[cfg(feature = "UIInterface")]
248 #[unsafe(method(preferredImageDynamicRange))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn preferredImageDynamicRange(&self) -> UIImageDynamicRange;
252
253 #[cfg(feature = "UIInterface")]
254 #[unsafe(method(setPreferredImageDynamicRange:))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn setPreferredImageDynamicRange(
258 &self,
259 preferred_image_dynamic_range: UIImageDynamicRange,
260 );
261
262 #[cfg(feature = "UIInterface")]
263 #[unsafe(method(imageDynamicRange))]
265 #[unsafe(method_family = none)]
266 pub unsafe fn imageDynamicRange(&self) -> UIImageDynamicRange;
267
268 #[unsafe(method(adjustsImageWhenAncestorFocused))]
269 #[unsafe(method_family = none)]
270 pub unsafe fn adjustsImageWhenAncestorFocused(&self) -> bool;
271
272 #[unsafe(method(setAdjustsImageWhenAncestorFocused:))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn setAdjustsImageWhenAncestorFocused(
276 &self,
277 adjusts_image_when_ancestor_focused: bool,
278 );
279
280 #[cfg(feature = "UILayoutGuide")]
281 #[unsafe(method(focusedFrameGuide))]
282 #[unsafe(method_family = none)]
283 pub unsafe fn focusedFrameGuide(&self) -> Retained<UILayoutGuide>;
284
285 #[unsafe(method(overlayContentView))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn overlayContentView(&self) -> Retained<UIView>;
288
289 #[unsafe(method(masksFocusEffectToContents))]
290 #[unsafe(method_family = none)]
291 pub unsafe fn masksFocusEffectToContents(&self) -> bool;
292
293 #[unsafe(method(setMasksFocusEffectToContents:))]
295 #[unsafe(method_family = none)]
296 pub unsafe fn setMasksFocusEffectToContents(&self, masks_focus_effect_to_contents: bool);
297 );
298}
299
300#[cfg(all(feature = "UIResponder", feature = "UIView"))]
302impl UIImageView {
303 extern_methods!(
304 #[cfg(feature = "objc2-core-foundation")]
305 #[unsafe(method(initWithFrame:))]
306 #[unsafe(method_family = init)]
307 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
308
309 #[unsafe(method(initWithCoder:))]
310 #[unsafe(method_family = init)]
311 pub unsafe fn initWithCoder(
312 this: Allocated<Self>,
313 coder: &NSCoder,
314 ) -> Option<Retained<Self>>;
315 );
316}
317
318#[cfg(all(feature = "UIResponder", feature = "UIView"))]
320impl UIImageView {
321 extern_methods!(
322 #[unsafe(method(init))]
323 #[unsafe(method_family = init)]
324 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
325
326 #[unsafe(method(new))]
327 #[unsafe(method_family = new)]
328 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
329 );
330}
331
332#[cfg(all(feature = "UIResponder", feature = "UIView"))]
333impl UIImageView {
334 extern_methods!(
335 #[cfg(feature = "objc2-symbols")]
336 #[unsafe(method(addSymbolEffect:))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn addSymbolEffect(&self, symbol_effect: &NSSymbolEffect);
340
341 #[cfg(feature = "objc2-symbols")]
342 #[unsafe(method(addSymbolEffect:options:))]
344 #[unsafe(method_family = none)]
345 pub unsafe fn addSymbolEffect_options(
346 &self,
347 symbol_effect: &NSSymbolEffect,
348 options: &NSSymbolEffectOptions,
349 );
350
351 #[cfg(feature = "objc2-symbols")]
352 #[unsafe(method(addSymbolEffect:options:animated:))]
354 #[unsafe(method_family = none)]
355 pub unsafe fn addSymbolEffect_options_animated(
356 &self,
357 symbol_effect: &NSSymbolEffect,
358 options: &NSSymbolEffectOptions,
359 animated: bool,
360 );
361
362 #[cfg(all(
363 feature = "UISymbolEffectCompletion",
364 feature = "block2",
365 feature = "objc2-symbols"
366 ))]
367 #[unsafe(method(addSymbolEffect:options:animated:completion:))]
369 #[unsafe(method_family = none)]
370 pub unsafe fn addSymbolEffect_options_animated_completion(
371 &self,
372 symbol_effect: &NSSymbolEffect,
373 options: &NSSymbolEffectOptions,
374 animated: bool,
375 completion_handler: UISymbolEffectCompletion,
376 );
377
378 #[cfg(feature = "objc2-symbols")]
379 #[unsafe(method(removeSymbolEffectOfType:))]
381 #[unsafe(method_family = none)]
382 pub unsafe fn removeSymbolEffectOfType(&self, symbol_effect: &NSSymbolEffect);
383
384 #[cfg(feature = "objc2-symbols")]
385 #[unsafe(method(removeSymbolEffectOfType:options:))]
387 #[unsafe(method_family = none)]
388 pub unsafe fn removeSymbolEffectOfType_options(
389 &self,
390 symbol_effect: &NSSymbolEffect,
391 options: &NSSymbolEffectOptions,
392 );
393
394 #[cfg(feature = "objc2-symbols")]
395 #[unsafe(method(removeSymbolEffectOfType:options:animated:))]
397 #[unsafe(method_family = none)]
398 pub unsafe fn removeSymbolEffectOfType_options_animated(
399 &self,
400 symbol_effect: &NSSymbolEffect,
401 options: &NSSymbolEffectOptions,
402 animated: bool,
403 );
404
405 #[cfg(all(
406 feature = "UISymbolEffectCompletion",
407 feature = "block2",
408 feature = "objc2-symbols"
409 ))]
410 #[unsafe(method(removeSymbolEffectOfType:options:animated:completion:))]
412 #[unsafe(method_family = none)]
413 pub unsafe fn removeSymbolEffectOfType_options_animated_completion(
414 &self,
415 symbol_effect: &NSSymbolEffect,
416 options: &NSSymbolEffectOptions,
417 animated: bool,
418 completion_handler: UISymbolEffectCompletion,
419 );
420
421 #[unsafe(method(removeAllSymbolEffects))]
423 #[unsafe(method_family = none)]
424 pub unsafe fn removeAllSymbolEffects(&self);
425
426 #[cfg(feature = "objc2-symbols")]
427 #[unsafe(method(removeAllSymbolEffectsWithOptions:))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn removeAllSymbolEffectsWithOptions(&self, options: &NSSymbolEffectOptions);
431
432 #[cfg(feature = "objc2-symbols")]
433 #[unsafe(method(removeAllSymbolEffectsWithOptions:animated:))]
435 #[unsafe(method_family = none)]
436 pub unsafe fn removeAllSymbolEffectsWithOptions_animated(
437 &self,
438 options: &NSSymbolEffectOptions,
439 animated: bool,
440 );
441
442 #[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
443 #[unsafe(method(setSymbolImage:withContentTransition:))]
446 #[unsafe(method_family = none)]
447 pub unsafe fn setSymbolImage_withContentTransition(
448 &self,
449 symbol_image: &UIImage,
450 transition: &NSSymbolContentTransition,
451 );
452
453 #[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
454 #[unsafe(method(setSymbolImage:withContentTransition:options:))]
457 #[unsafe(method_family = none)]
458 pub unsafe fn setSymbolImage_withContentTransition_options(
459 &self,
460 symbol_image: &UIImage,
461 transition: &NSSymbolContentTransition,
462 options: &NSSymbolEffectOptions,
463 );
464
465 #[cfg(all(
466 feature = "UIImage",
467 feature = "UISymbolEffectCompletion",
468 feature = "block2",
469 feature = "objc2-symbols"
470 ))]
471 #[unsafe(method(setSymbolImage:withContentTransition:options:completion:))]
474 #[unsafe(method_family = none)]
475 pub unsafe fn setSymbolImage_withContentTransition_options_completion(
476 &self,
477 symbol_image: &UIImage,
478 transition: &NSSymbolContentTransition,
479 options: &NSSymbolEffectOptions,
480 completion_handler: UISymbolEffectCompletion,
481 );
482 );
483}