objc2_app_kit/generated/
NSWritingToolsCoordinatorAnimationParameters.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::*;
8
9use crate::*;
10
11extern_class!(
12    /// An object you use to configure additional tasks or animations to
13    /// run alongside the Writing Tools animations.
14    ///
15    /// When Writing Tools replaces text in one of your context objects,
16    /// it provides an `NSWritingToolsCoordinator.AnimationParameters` object for
17    /// you to use to configure any additional animations. During a Writing
18    /// Tools session, you hide the text under evaluation and provide a
19    /// targeted preview of your content. Writing Tools animations changes
20    /// to that preview, but you might need to provide additional animations
21    /// for other parts of your view’s content. For example, you might
22    /// need to animate any layout changes caused by the insertion or
23    /// removal of text in other parts of your view. Use this object to
24    /// configure those animations.
25    ///
26    /// You don’t create an `NSWritingToolsCoordinator.AnimationParameters`
27    /// object directly. Instead, the system creates one and passes it to the
28    /// ``NSWritingToolsCoordinator/writingToolsCoordinator(_:replaceRange:inContext:proposedText:reason:animationParameters:completion:)``
29    /// method of your ``NSWritingToolsCoordinator/Delegate`` object. Use that
30    /// object to specify the blocks to run during and after the system animations.
31    ///
32    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nswritingtoolscoordinatoranimationparameters?language=objc)
33    #[unsafe(super(NSObject))]
34    #[derive(Debug, PartialEq, Eq, Hash)]
35    pub struct NSWritingToolsCoordinatorAnimationParameters;
36);
37
38unsafe impl Send for NSWritingToolsCoordinatorAnimationParameters {}
39
40unsafe impl Sync for NSWritingToolsCoordinatorAnimationParameters {}
41
42extern_conformance!(
43    unsafe impl NSObjectProtocol for NSWritingToolsCoordinatorAnimationParameters {}
44);
45
46impl NSWritingToolsCoordinatorAnimationParameters {
47    extern_methods!(
48        #[unsafe(method(init))]
49        #[unsafe(method_family = init)]
50        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
51
52        #[cfg(feature = "objc2-core-foundation")]
53        /// The number of seconds it takes the system animations to run.
54        #[unsafe(method(duration))]
55        #[unsafe(method_family = none)]
56        pub fn duration(&self) -> CGFloat;
57
58        #[cfg(feature = "objc2-core-foundation")]
59        /// The number of seconds the system waits before starting its animations.
60        #[unsafe(method(delay))]
61        #[unsafe(method_family = none)]
62        pub fn delay(&self) -> CGFloat;
63
64        #[cfg(feature = "block2")]
65        /// A custom block that runs at the same time as the system animations.
66        ///
67        /// If you have animations you want to run at the same time as the system
68        /// animations, assign a block to this property and use it to run your
69        /// animations. The block you provide must have no return value and take
70        /// a floating-point value as a parameter. The parameter indicates the
71        /// current progress of the animations as a percentage value between
72        /// `0.0` to `1.0`. The system executes your block multiple times during
73        /// the course of the animations, providing an updated completion value each time.
74        #[unsafe(method(progressHandler))]
75        #[unsafe(method_family = none)]
76        pub fn progressHandler(&self) -> *mut block2::DynBlock<dyn Fn(c_float)>;
77
78        #[cfg(feature = "block2")]
79        /// Setter for [`progressHandler`][Self::progressHandler].
80        ///
81        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
82        #[unsafe(method(setProgressHandler:))]
83        #[unsafe(method_family = none)]
84        pub fn setProgressHandler(
85            &self,
86            progress_handler: Option<&block2::DynBlock<dyn Fn(c_float)>>,
87        );
88
89        #[cfg(feature = "block2")]
90        /// A custom block to run when the system animations finish.
91        ///
92        /// Set this property to a block that you want the system to run when any
93        /// animations finish. The block you provide must have no return value
94        /// and no parameters. The system executes this block once when the current
95        /// animation finish.
96        #[unsafe(method(completionHandler))]
97        #[unsafe(method_family = none)]
98        pub fn completionHandler(&self) -> *mut block2::DynBlock<dyn Fn()>;
99
100        #[cfg(feature = "block2")]
101        /// Setter for [`completionHandler`][Self::completionHandler].
102        ///
103        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
104        #[unsafe(method(setCompletionHandler:))]
105        #[unsafe(method_family = none)]
106        pub fn setCompletionHandler(&self, completion_handler: Option<&block2::DynBlock<dyn Fn()>>);
107    );
108}
109
110/// Methods declared on superclass `NSObject`.
111impl NSWritingToolsCoordinatorAnimationParameters {
112    extern_methods!(
113        #[unsafe(method(new))]
114        #[unsafe(method_family = new)]
115        pub unsafe fn new() -> Retained<Self>;
116    );
117}