objc2_ui_kit/generated/
UIImageView.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#[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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiimageview?language=objc)
19    #[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 fn initWithImage(this: Allocated<Self>, image: Option<&UIImage>) -> Retained<Self>;
106
107        #[cfg(feature = "UIImage")]
108        #[unsafe(method(initWithImage:highlightedImage:))]
109        #[unsafe(method_family = init)]
110        pub fn initWithImage_highlightedImage(
111            this: Allocated<Self>,
112            image: Option<&UIImage>,
113            highlighted_image: Option<&UIImage>,
114        ) -> Retained<Self>;
115
116        #[cfg(feature = "UIImage")]
117        #[unsafe(method(image))]
118        #[unsafe(method_family = none)]
119        pub fn image(&self) -> Option<Retained<UIImage>>;
120
121        #[cfg(feature = "UIImage")]
122        /// Setter for [`image`][Self::image].
123        #[unsafe(method(setImage:))]
124        #[unsafe(method_family = none)]
125        pub fn setImage(&self, image: Option<&UIImage>);
126
127        #[cfg(feature = "UIImage")]
128        #[unsafe(method(highlightedImage))]
129        #[unsafe(method_family = none)]
130        pub fn highlightedImage(&self) -> Option<Retained<UIImage>>;
131
132        #[cfg(feature = "UIImage")]
133        /// Setter for [`highlightedImage`][Self::highlightedImage].
134        #[unsafe(method(setHighlightedImage:))]
135        #[unsafe(method_family = none)]
136        pub fn setHighlightedImage(&self, highlighted_image: Option<&UIImage>);
137
138        #[cfg(all(
139            feature = "UIImageConfiguration",
140            feature = "UIImageSymbolConfiguration"
141        ))]
142        #[unsafe(method(preferredSymbolConfiguration))]
143        #[unsafe(method_family = none)]
144        pub fn preferredSymbolConfiguration(&self) -> Option<Retained<UIImageSymbolConfiguration>>;
145
146        #[cfg(all(
147            feature = "UIImageConfiguration",
148            feature = "UIImageSymbolConfiguration"
149        ))]
150        /// Setter for [`preferredSymbolConfiguration`][Self::preferredSymbolConfiguration].
151        #[unsafe(method(setPreferredSymbolConfiguration:))]
152        #[unsafe(method_family = none)]
153        pub fn setPreferredSymbolConfiguration(
154            &self,
155            preferred_symbol_configuration: Option<&UIImageSymbolConfiguration>,
156        );
157
158        #[unsafe(method(isUserInteractionEnabled))]
159        #[unsafe(method_family = none)]
160        pub fn isUserInteractionEnabled(&self) -> bool;
161
162        /// Setter for [`isUserInteractionEnabled`][Self::isUserInteractionEnabled].
163        #[unsafe(method(setUserInteractionEnabled:))]
164        #[unsafe(method_family = none)]
165        pub fn setUserInteractionEnabled(&self, user_interaction_enabled: bool);
166
167        #[unsafe(method(isHighlighted))]
168        #[unsafe(method_family = none)]
169        pub fn isHighlighted(&self) -> bool;
170
171        /// Setter for [`isHighlighted`][Self::isHighlighted].
172        #[unsafe(method(setHighlighted:))]
173        #[unsafe(method_family = none)]
174        pub fn setHighlighted(&self, highlighted: bool);
175
176        #[cfg(feature = "UIImage")]
177        #[unsafe(method(animationImages))]
178        #[unsafe(method_family = none)]
179        pub fn animationImages(&self) -> Option<Retained<NSArray<UIImage>>>;
180
181        #[cfg(feature = "UIImage")]
182        /// Setter for [`animationImages`][Self::animationImages].
183        ///
184        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
185        #[unsafe(method(setAnimationImages:))]
186        #[unsafe(method_family = none)]
187        pub fn setAnimationImages(&self, animation_images: Option<&NSArray<UIImage>>);
188
189        #[cfg(feature = "UIImage")]
190        #[unsafe(method(highlightedAnimationImages))]
191        #[unsafe(method_family = none)]
192        pub fn highlightedAnimationImages(&self) -> Option<Retained<NSArray<UIImage>>>;
193
194        #[cfg(feature = "UIImage")]
195        /// Setter for [`highlightedAnimationImages`][Self::highlightedAnimationImages].
196        ///
197        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
198        #[unsafe(method(setHighlightedAnimationImages:))]
199        #[unsafe(method_family = none)]
200        pub fn setHighlightedAnimationImages(
201            &self,
202            highlighted_animation_images: Option<&NSArray<UIImage>>,
203        );
204
205        #[unsafe(method(animationDuration))]
206        #[unsafe(method_family = none)]
207        pub fn animationDuration(&self) -> NSTimeInterval;
208
209        /// Setter for [`animationDuration`][Self::animationDuration].
210        #[unsafe(method(setAnimationDuration:))]
211        #[unsafe(method_family = none)]
212        pub fn setAnimationDuration(&self, animation_duration: NSTimeInterval);
213
214        #[unsafe(method(animationRepeatCount))]
215        #[unsafe(method_family = none)]
216        pub fn animationRepeatCount(&self) -> NSInteger;
217
218        /// Setter for [`animationRepeatCount`][Self::animationRepeatCount].
219        #[unsafe(method(setAnimationRepeatCount:))]
220        #[unsafe(method_family = none)]
221        pub fn setAnimationRepeatCount(&self, animation_repeat_count: NSInteger);
222
223        #[cfg(feature = "UIColor")]
224        #[unsafe(method(tintColor))]
225        #[unsafe(method_family = none)]
226        pub fn tintColor(&self) -> Option<Retained<UIColor>>;
227
228        #[cfg(feature = "UIColor")]
229        /// Setter for [`tintColor`][Self::tintColor].
230        ///
231        /// # Safety
232        ///
233        /// `tint_color` might not allow `None`.
234        #[unsafe(method(setTintColor:))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn setTintColor(&self, tint_color: Option<&UIColor>);
237
238        #[unsafe(method(startAnimating))]
239        #[unsafe(method_family = none)]
240        pub fn startAnimating(&self);
241
242        #[unsafe(method(stopAnimating))]
243        #[unsafe(method_family = none)]
244        pub fn stopAnimating(&self);
245
246        #[unsafe(method(isAnimating))]
247        #[unsafe(method_family = none)]
248        pub fn isAnimating(&self) -> bool;
249
250        #[cfg(feature = "UIInterface")]
251        /// The preferred treatment to use for HDR images. By default the image view will defer to the value from its traitCollection.
252        #[unsafe(method(preferredImageDynamicRange))]
253        #[unsafe(method_family = none)]
254        pub fn preferredImageDynamicRange(&self) -> UIImageDynamicRange;
255
256        #[cfg(feature = "UIInterface")]
257        /// Setter for [`preferredImageDynamicRange`][Self::preferredImageDynamicRange].
258        #[unsafe(method(setPreferredImageDynamicRange:))]
259        #[unsafe(method_family = none)]
260        pub fn setPreferredImageDynamicRange(
261            &self,
262            preferred_image_dynamic_range: UIImageDynamicRange,
263        );
264
265        #[cfg(feature = "UIInterface")]
266        /// The resolved treatment to use for HDR images.
267        #[unsafe(method(imageDynamicRange))]
268        #[unsafe(method_family = none)]
269        pub fn imageDynamicRange(&self) -> UIImageDynamicRange;
270
271        #[unsafe(method(adjustsImageWhenAncestorFocused))]
272        #[unsafe(method_family = none)]
273        pub fn adjustsImageWhenAncestorFocused(&self) -> bool;
274
275        /// Setter for [`adjustsImageWhenAncestorFocused`][Self::adjustsImageWhenAncestorFocused].
276        #[unsafe(method(setAdjustsImageWhenAncestorFocused:))]
277        #[unsafe(method_family = none)]
278        pub fn setAdjustsImageWhenAncestorFocused(&self, adjusts_image_when_ancestor_focused: bool);
279
280        #[cfg(feature = "UILayoutGuide")]
281        #[unsafe(method(focusedFrameGuide))]
282        #[unsafe(method_family = none)]
283        pub fn focusedFrameGuide(&self) -> Retained<UILayoutGuide>;
284
285        #[unsafe(method(overlayContentView))]
286        #[unsafe(method_family = none)]
287        pub fn overlayContentView(&self) -> Retained<UIView>;
288
289        #[unsafe(method(masksFocusEffectToContents))]
290        #[unsafe(method_family = none)]
291        pub fn masksFocusEffectToContents(&self) -> bool;
292
293        /// Setter for [`masksFocusEffectToContents`][Self::masksFocusEffectToContents].
294        #[unsafe(method(setMasksFocusEffectToContents:))]
295        #[unsafe(method_family = none)]
296        pub fn setMasksFocusEffectToContents(&self, masks_focus_effect_to_contents: bool);
297    );
298}
299
300/// Methods declared on superclass `UIView`.
301#[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 fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
308
309        /// # Safety
310        ///
311        /// `coder` possibly has further requirements.
312        #[unsafe(method(initWithCoder:))]
313        #[unsafe(method_family = init)]
314        pub unsafe fn initWithCoder(
315            this: Allocated<Self>,
316            coder: &NSCoder,
317        ) -> Option<Retained<Self>>;
318
319        #[unsafe(method(init))]
320        #[unsafe(method_family = init)]
321        pub fn init(this: Allocated<Self>) -> Retained<Self>;
322    );
323}
324
325/// Methods declared on superclass `NSObject`.
326#[cfg(all(feature = "UIResponder", feature = "UIView"))]
327impl UIImageView {
328    extern_methods!(
329        #[unsafe(method(new))]
330        #[unsafe(method_family = new)]
331        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
332    );
333}
334
335#[cfg(all(feature = "UIResponder", feature = "UIView"))]
336impl UIImageView {
337    extern_methods!(
338        #[cfg(feature = "objc2-symbols")]
339        /// Adds a symbol effect to the image view with default options and animation.
340        #[unsafe(method(addSymbolEffect:))]
341        #[unsafe(method_family = none)]
342        pub fn addSymbolEffect(&self, symbol_effect: &NSSymbolEffect);
343
344        #[cfg(feature = "objc2-symbols")]
345        /// Adds a symbol effect to the image view with specified options and default animation.
346        #[unsafe(method(addSymbolEffect:options:))]
347        #[unsafe(method_family = none)]
348        pub fn addSymbolEffect_options(
349            &self,
350            symbol_effect: &NSSymbolEffect,
351            options: &NSSymbolEffectOptions,
352        );
353
354        #[cfg(feature = "objc2-symbols")]
355        /// Adds a symbol effect to the image view with specified options and animation.
356        #[unsafe(method(addSymbolEffect:options:animated:))]
357        #[unsafe(method_family = none)]
358        pub fn addSymbolEffect_options_animated(
359            &self,
360            symbol_effect: &NSSymbolEffect,
361            options: &NSSymbolEffectOptions,
362            animated: bool,
363        );
364
365        #[cfg(all(
366            feature = "UISymbolEffectCompletion",
367            feature = "block2",
368            feature = "objc2-symbols"
369        ))]
370        /// Adds a symbol effect to the image view with specified options, animation, and completion handler.
371        ///
372        /// # Safety
373        ///
374        /// `completion_handler` must be a valid pointer or null.
375        #[unsafe(method(addSymbolEffect:options:animated:completion:))]
376        #[unsafe(method_family = none)]
377        pub unsafe fn addSymbolEffect_options_animated_completion(
378            &self,
379            symbol_effect: &NSSymbolEffect,
380            options: &NSSymbolEffectOptions,
381            animated: bool,
382            completion_handler: UISymbolEffectCompletion,
383        );
384
385        #[cfg(feature = "objc2-symbols")]
386        /// Removes from the image view the symbol effect matching the type of effect passed in, with default options and animation.
387        #[unsafe(method(removeSymbolEffectOfType:))]
388        #[unsafe(method_family = none)]
389        pub fn removeSymbolEffectOfType(&self, symbol_effect: &NSSymbolEffect);
390
391        #[cfg(feature = "objc2-symbols")]
392        /// Removes from the image view the symbol effect matching the type of effect passed in, with specified options and default animation.
393        #[unsafe(method(removeSymbolEffectOfType:options:))]
394        #[unsafe(method_family = none)]
395        pub fn removeSymbolEffectOfType_options(
396            &self,
397            symbol_effect: &NSSymbolEffect,
398            options: &NSSymbolEffectOptions,
399        );
400
401        #[cfg(feature = "objc2-symbols")]
402        /// Removes from the image view the symbol effect matching the type of effect passed in, with specified options and animation.
403        #[unsafe(method(removeSymbolEffectOfType:options:animated:))]
404        #[unsafe(method_family = none)]
405        pub fn removeSymbolEffectOfType_options_animated(
406            &self,
407            symbol_effect: &NSSymbolEffect,
408            options: &NSSymbolEffectOptions,
409            animated: bool,
410        );
411
412        #[cfg(all(
413            feature = "UISymbolEffectCompletion",
414            feature = "block2",
415            feature = "objc2-symbols"
416        ))]
417        /// Removes from the image view the symbol effect matching the type of effect passed in, with specified options, animation, and completion handler.
418        ///
419        /// # Safety
420        ///
421        /// `completion_handler` must be a valid pointer or null.
422        #[unsafe(method(removeSymbolEffectOfType:options:animated:completion:))]
423        #[unsafe(method_family = none)]
424        pub unsafe fn removeSymbolEffectOfType_options_animated_completion(
425            &self,
426            symbol_effect: &NSSymbolEffect,
427            options: &NSSymbolEffectOptions,
428            animated: bool,
429            completion_handler: UISymbolEffectCompletion,
430        );
431
432        /// Removes all symbol effects from the image view with default options and animation.
433        #[unsafe(method(removeAllSymbolEffects))]
434        #[unsafe(method_family = none)]
435        pub fn removeAllSymbolEffects(&self);
436
437        #[cfg(feature = "objc2-symbols")]
438        /// Removes all symbol effects from the image view with specified options and default animation.
439        #[unsafe(method(removeAllSymbolEffectsWithOptions:))]
440        #[unsafe(method_family = none)]
441        pub fn removeAllSymbolEffectsWithOptions(&self, options: &NSSymbolEffectOptions);
442
443        #[cfg(feature = "objc2-symbols")]
444        /// Removes all symbol effects from the image view with specified options and animation.
445        #[unsafe(method(removeAllSymbolEffectsWithOptions:animated:))]
446        #[unsafe(method_family = none)]
447        pub fn removeAllSymbolEffectsWithOptions_animated(
448            &self,
449            options: &NSSymbolEffectOptions,
450            animated: bool,
451        );
452
453        #[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
454        /// Sets the symbol image on the image view with a symbol content transition and default options.
455        /// Passing in a non-symbol image will result in undefined behavior.
456        #[unsafe(method(setSymbolImage:withContentTransition:))]
457        #[unsafe(method_family = none)]
458        pub fn setSymbolImage_withContentTransition(
459            &self,
460            symbol_image: &UIImage,
461            transition: &NSSymbolContentTransition,
462        );
463
464        #[cfg(all(feature = "UIImage", feature = "objc2-symbols"))]
465        /// Sets the symbol image on the image view with a symbol content transition and specified options.
466        /// Passing in a non-symbol image will result in undefined behavior.
467        #[unsafe(method(setSymbolImage:withContentTransition:options:))]
468        #[unsafe(method_family = none)]
469        pub fn setSymbolImage_withContentTransition_options(
470            &self,
471            symbol_image: &UIImage,
472            transition: &NSSymbolContentTransition,
473            options: &NSSymbolEffectOptions,
474        );
475
476        #[cfg(all(
477            feature = "UIImage",
478            feature = "UISymbolEffectCompletion",
479            feature = "block2",
480            feature = "objc2-symbols"
481        ))]
482        /// Sets the symbol image on the image view with a symbol content transition, options, and completion handler.
483        /// Passing in a non-symbol image will result in undefined behavior.
484        ///
485        /// # Safety
486        ///
487        /// `completion_handler` must be a valid pointer or null.
488        #[unsafe(method(setSymbolImage:withContentTransition:options:completion:))]
489        #[unsafe(method_family = none)]
490        pub unsafe fn setSymbolImage_withContentTransition_options_completion(
491            &self,
492            symbol_image: &UIImage,
493            transition: &NSSymbolContentTransition,
494            options: &NSSymbolEffectOptions,
495            completion_handler: UISymbolEffectCompletion,
496        );
497    );
498}