objc2_ui_kit/generated/UIFocusAnimationCoordinator.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_protocol!(
11 /// UIFocusAnimationContext is used to provide UIKit-determined context about animations that are related to a focus update.
12 ///
13 /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uifocusanimationcontext?language=objc)
14 pub unsafe trait UIFocusAnimationContext: NSObjectProtocol + MainThreadOnly {
15 /// The duration of the main animations in seconds.
16 #[unsafe(method(duration))]
17 #[unsafe(method_family = none)]
18 unsafe fn duration(&self) -> NSTimeInterval;
19 }
20);
21
22extern_class!(
23 /// UIFocusAnimationCoordinator is used to coordinate disparate animations that are related to a focus update.
24 ///
25 /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uifocusanimationcoordinator?language=objc)
26 #[unsafe(super(NSObject))]
27 #[thread_kind = MainThreadOnly]
28 #[derive(Debug, PartialEq, Eq, Hash)]
29 pub struct UIFocusAnimationCoordinator;
30);
31
32unsafe impl NSObjectProtocol for UIFocusAnimationCoordinator {}
33
34impl UIFocusAnimationCoordinator {
35 extern_methods!(
36 #[cfg(feature = "block2")]
37 /// Specifies focus-related animations that should be coordinated with the animations of the focusing or un-focusing view.
38 ///
39 /// Any animations specified will be run in the same animation context as the main animation. The completion block is invoked after the main animation completes.
40 /// (Note that this may not be after all the coordinated animations specified by the call complete if the duration is not inherited.)
41 ///
42 /// It is perfectly legitimate to only specify a completion block.
43 #[unsafe(method(addCoordinatedAnimations:completion:))]
44 #[unsafe(method_family = none)]
45 pub unsafe fn addCoordinatedAnimations_completion(
46 &self,
47 animations: Option<&block2::Block<dyn Fn()>>,
48 completion: Option<&block2::Block<dyn Fn()>>,
49 );
50
51 #[cfg(feature = "block2")]
52 /// Specifies focus-related animations that should be coordinated with the animations of the focusing item.
53 ///
54 /// Any animations specified will be run in the same animation context as the main animation. The completion block is invoked after the UIKit-defined animations complete.
55 ///
56 /// It is perfectly legitimate to only specify a completion block.
57 ///
58 /// A context object is provided in the animation block with details of the UIKit-defined animations being run for the focusing item.
59 #[unsafe(method(addCoordinatedFocusingAnimations:completion:))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn addCoordinatedFocusingAnimations_completion(
62 &self,
63 animations: Option<
64 &block2::Block<dyn Fn(NonNull<ProtocolObject<dyn UIFocusAnimationContext>>)>,
65 >,
66 completion: Option<&block2::Block<dyn Fn()>>,
67 );
68
69 #[cfg(feature = "block2")]
70 /// Specifies focus-related animations that should be coordinated with the animations of the un-focusing item.
71 ///
72 /// Any animations specified will be run in the same animation context as the main animation. The completion block is invoked after the UIKit-defined animations complete.
73 ///
74 /// It is perfectly legitimate to only specify a completion block.
75 ///
76 /// A context object is provided in the animation block with details of the UIKit-defined animations being run for the un-focusing item.
77 #[unsafe(method(addCoordinatedUnfocusingAnimations:completion:))]
78 #[unsafe(method_family = none)]
79 pub unsafe fn addCoordinatedUnfocusingAnimations_completion(
80 &self,
81 animations: Option<
82 &block2::Block<dyn Fn(NonNull<ProtocolObject<dyn UIFocusAnimationContext>>)>,
83 >,
84 completion: Option<&block2::Block<dyn Fn()>>,
85 );
86 );
87}
88
89/// Methods declared on superclass `NSObject`.
90impl UIFocusAnimationCoordinator {
91 extern_methods!(
92 #[unsafe(method(init))]
93 #[unsafe(method_family = init)]
94 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
95
96 #[unsafe(method(new))]
97 #[unsafe(method_family = new)]
98 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
99 );
100}