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
42unsafe impl NSObjectProtocol for NSWritingToolsCoordinatorAnimationParameters {}
43
44impl NSWritingToolsCoordinatorAnimationParameters {
45    extern_methods!(
46        #[unsafe(method(init))]
47        #[unsafe(method_family = init)]
48        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
49
50        #[cfg(feature = "objc2-core-foundation")]
51        /// The number of seconds it takes the system animations to run.
52        #[unsafe(method(duration))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn duration(&self) -> CGFloat;
55
56        #[cfg(feature = "objc2-core-foundation")]
57        /// The number of seconds the system waits before starting its animations.
58        #[unsafe(method(delay))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn delay(&self) -> CGFloat;
61
62        #[cfg(feature = "block2")]
63        /// A custom block that runs at the same time as the system animations.
64        ///
65        /// If you have animations you want to run at the same time as the system
66        /// animations, assign a block to this property and use it to run your
67        /// animations. The block you provide must have no return value and take
68        /// a floating-point value as a parameter. The parameter indicates the
69        /// current progress of the animations as a percentage value between
70        /// `0.0` to `1.0`. The system executes your block multiple times during
71        /// the course of the animations, providing an updated completion value each time.
72        #[unsafe(method(progressHandler))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn progressHandler(&self) -> *mut block2::Block<dyn Fn(c_float)>;
75
76        #[cfg(feature = "block2")]
77        /// Setter for [`progressHandler`][Self::progressHandler].
78        #[unsafe(method(setProgressHandler:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn setProgressHandler(
81            &self,
82            progress_handler: Option<&block2::Block<dyn Fn(c_float)>>,
83        );
84
85        #[cfg(feature = "block2")]
86        /// A custom block to run when the system animations finish.
87        ///
88        /// Set this property to a block that you want the system to run when any
89        /// animations finish. The block you provide must have no return value
90        /// and no parameters. The system executes this block once when the current
91        /// animation finish.
92        #[unsafe(method(completionHandler))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn completionHandler(&self) -> *mut block2::Block<dyn Fn()>;
95
96        #[cfg(feature = "block2")]
97        /// Setter for [`completionHandler`][Self::completionHandler].
98        #[unsafe(method(setCompletionHandler:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn setCompletionHandler(
101            &self,
102            completion_handler: Option<&block2::Block<dyn Fn()>>,
103        );
104    );
105}
106
107/// Methods declared on superclass `NSObject`.
108impl NSWritingToolsCoordinatorAnimationParameters {
109    extern_methods!(
110        #[unsafe(method(new))]
111        #[unsafe(method_family = new)]
112        pub unsafe fn new() -> Retained<Self>;
113    );
114}