objc2_app_kit/generated/
NSAnimation.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
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsanimationcurve?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSAnimationCurve(pub NSUInteger);
15impl NSAnimationCurve {
16    #[doc(alias = "NSAnimationEaseInOut")]
17    pub const EaseInOut: Self = Self(0);
18    #[doc(alias = "NSAnimationEaseIn")]
19    pub const EaseIn: Self = Self(1);
20    #[doc(alias = "NSAnimationEaseOut")]
21    pub const EaseOut: Self = Self(2);
22    #[doc(alias = "NSAnimationLinear")]
23    pub const Linear: Self = Self(3);
24}
25
26unsafe impl Encode for NSAnimationCurve {
27    const ENCODING: Encoding = NSUInteger::ENCODING;
28}
29
30unsafe impl RefEncode for NSAnimationCurve {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsanimationblockingmode?language=objc)
35// NS_ENUM
36#[repr(transparent)]
37#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
38pub struct NSAnimationBlockingMode(pub NSUInteger);
39impl NSAnimationBlockingMode {
40    #[doc(alias = "NSAnimationBlocking")]
41    pub const Blocking: Self = Self(0);
42    #[doc(alias = "NSAnimationNonblocking")]
43    pub const Nonblocking: Self = Self(1);
44    #[doc(alias = "NSAnimationNonblockingThreaded")]
45    pub const NonblockingThreaded: Self = Self(2);
46}
47
48unsafe impl Encode for NSAnimationBlockingMode {
49    const ENCODING: Encoding = NSUInteger::ENCODING;
50}
51
52unsafe impl RefEncode for NSAnimationBlockingMode {
53    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
54}
55
56/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsanimationprogress?language=objc)
57pub type NSAnimationProgress = c_float;
58
59extern "C" {
60    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsanimationprogressmarknotification?language=objc)
61    pub static NSAnimationProgressMarkNotification: &'static NSNotificationName;
62}
63
64extern "C" {
65    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsanimationprogressmark?language=objc)
66    pub static NSAnimationProgressMark: &'static NSString;
67}
68
69extern_class!(
70    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsanimation?language=objc)
71    #[unsafe(super(NSObject))]
72    #[derive(Debug, PartialEq, Eq, Hash)]
73    pub struct NSAnimation;
74);
75
76unsafe impl NSCoding for NSAnimation {}
77
78unsafe impl NSCopying for NSAnimation {}
79
80unsafe impl CopyingHelper for NSAnimation {
81    type Result = Self;
82}
83
84unsafe impl NSObjectProtocol for NSAnimation {}
85
86impl NSAnimation {
87    extern_methods!(
88        #[unsafe(method(initWithDuration:animationCurve:))]
89        #[unsafe(method_family = init)]
90        pub unsafe fn initWithDuration_animationCurve(
91            this: Allocated<Self>,
92            duration: NSTimeInterval,
93            animation_curve: NSAnimationCurve,
94        ) -> Retained<Self>;
95
96        #[unsafe(method(initWithCoder:))]
97        #[unsafe(method_family = init)]
98        pub unsafe fn initWithCoder(
99            this: Allocated<Self>,
100            coder: &NSCoder,
101        ) -> Option<Retained<Self>>;
102
103        #[unsafe(method(startAnimation))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn startAnimation(&self);
106
107        #[unsafe(method(stopAnimation))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn stopAnimation(&self);
110
111        #[unsafe(method(isAnimating))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn isAnimating(&self) -> bool;
114
115        #[unsafe(method(currentProgress))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn currentProgress(&self) -> NSAnimationProgress;
118
119        /// Setter for [`currentProgress`][Self::currentProgress].
120        #[unsafe(method(setCurrentProgress:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setCurrentProgress(&self, current_progress: NSAnimationProgress);
123
124        #[unsafe(method(duration))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn duration(&self) -> NSTimeInterval;
127
128        /// Setter for [`duration`][Self::duration].
129        #[unsafe(method(setDuration:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn setDuration(&self, duration: NSTimeInterval);
132
133        #[unsafe(method(animationBlockingMode))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn animationBlockingMode(&self) -> NSAnimationBlockingMode;
136
137        /// Setter for [`animationBlockingMode`][Self::animationBlockingMode].
138        #[unsafe(method(setAnimationBlockingMode:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn setAnimationBlockingMode(
141            &self,
142            animation_blocking_mode: NSAnimationBlockingMode,
143        );
144
145        #[unsafe(method(frameRate))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn frameRate(&self) -> c_float;
148
149        /// Setter for [`frameRate`][Self::frameRate].
150        #[unsafe(method(setFrameRate:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setFrameRate(&self, frame_rate: c_float);
153
154        #[unsafe(method(animationCurve))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn animationCurve(&self) -> NSAnimationCurve;
157
158        /// Setter for [`animationCurve`][Self::animationCurve].
159        #[unsafe(method(setAnimationCurve:))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn setAnimationCurve(&self, animation_curve: NSAnimationCurve);
162
163        #[unsafe(method(currentValue))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn currentValue(&self) -> c_float;
166
167        #[unsafe(method(delegate))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSAnimationDelegate>>>;
170
171        /// This is a [weak property][objc2::topics::weak_property].
172        /// Setter for [`delegate`][Self::delegate].
173        #[unsafe(method(setDelegate:))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn setDelegate(
176            &self,
177            delegate: Option<&ProtocolObject<dyn NSAnimationDelegate>>,
178        );
179
180        #[unsafe(method(progressMarks))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn progressMarks(&self) -> Retained<NSArray<NSNumber>>;
183
184        /// Setter for [`progressMarks`][Self::progressMarks].
185        #[unsafe(method(setProgressMarks:))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn setProgressMarks(&self, progress_marks: &NSArray<NSNumber>);
188
189        #[unsafe(method(addProgressMark:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn addProgressMark(&self, progress_mark: NSAnimationProgress);
192
193        #[unsafe(method(removeProgressMark:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn removeProgressMark(&self, progress_mark: NSAnimationProgress);
196
197        #[unsafe(method(startWhenAnimation:reachesProgress:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn startWhenAnimation_reachesProgress(
200            &self,
201            animation: &NSAnimation,
202            start_progress: NSAnimationProgress,
203        );
204
205        #[unsafe(method(stopWhenAnimation:reachesProgress:))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn stopWhenAnimation_reachesProgress(
208            &self,
209            animation: &NSAnimation,
210            stop_progress: NSAnimationProgress,
211        );
212
213        #[unsafe(method(clearStartAnimation))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn clearStartAnimation(&self);
216
217        #[unsafe(method(clearStopAnimation))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn clearStopAnimation(&self);
220
221        #[unsafe(method(runLoopModesForAnimating))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn runLoopModesForAnimating(&self) -> Option<Retained<NSArray<NSRunLoopMode>>>;
224    );
225}
226
227/// Methods declared on superclass `NSObject`.
228impl NSAnimation {
229    extern_methods!(
230        #[unsafe(method(init))]
231        #[unsafe(method_family = init)]
232        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
233
234        #[unsafe(method(new))]
235        #[unsafe(method_family = new)]
236        pub unsafe fn new() -> Retained<Self>;
237    );
238}
239
240extern_protocol!(
241    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsanimationdelegate?language=objc)
242    pub unsafe trait NSAnimationDelegate: NSObjectProtocol {
243        #[optional]
244        #[unsafe(method(animationShouldStart:))]
245        #[unsafe(method_family = none)]
246        unsafe fn animationShouldStart(&self, animation: &NSAnimation) -> bool;
247
248        #[optional]
249        #[unsafe(method(animationDidStop:))]
250        #[unsafe(method_family = none)]
251        unsafe fn animationDidStop(&self, animation: &NSAnimation);
252
253        #[optional]
254        #[unsafe(method(animationDidEnd:))]
255        #[unsafe(method_family = none)]
256        unsafe fn animationDidEnd(&self, animation: &NSAnimation);
257
258        #[optional]
259        #[unsafe(method(animation:valueForProgress:))]
260        #[unsafe(method_family = none)]
261        unsafe fn animation_valueForProgress(
262            &self,
263            animation: &NSAnimation,
264            progress: NSAnimationProgress,
265        ) -> c_float;
266
267        #[optional]
268        #[unsafe(method(animation:didReachProgressMark:))]
269        #[unsafe(method_family = none)]
270        unsafe fn animation_didReachProgressMark(
271            &self,
272            animation: &NSAnimation,
273            progress: NSAnimationProgress,
274        );
275    }
276);
277
278/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewanimationkey?language=objc)
279// NS_TYPED_ENUM
280pub type NSViewAnimationKey = NSString;
281
282extern "C" {
283    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewanimationtargetkey?language=objc)
284    pub static NSViewAnimationTargetKey: &'static NSViewAnimationKey;
285}
286
287extern "C" {
288    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewanimationstartframekey?language=objc)
289    pub static NSViewAnimationStartFrameKey: &'static NSViewAnimationKey;
290}
291
292extern "C" {
293    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewanimationendframekey?language=objc)
294    pub static NSViewAnimationEndFrameKey: &'static NSViewAnimationKey;
295}
296
297extern "C" {
298    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewanimationeffectkey?language=objc)
299    pub static NSViewAnimationEffectKey: &'static NSViewAnimationKey;
300}
301
302/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewanimationeffectname?language=objc)
303// NS_TYPED_ENUM
304pub type NSViewAnimationEffectName = NSString;
305
306extern "C" {
307    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewanimationfadeineffect?language=objc)
308    pub static NSViewAnimationFadeInEffect: &'static NSViewAnimationEffectName;
309}
310
311extern "C" {
312    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewanimationfadeouteffect?language=objc)
313    pub static NSViewAnimationFadeOutEffect: &'static NSViewAnimationEffectName;
314}
315
316extern_class!(
317    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewanimation?language=objc)
318    #[unsafe(super(NSAnimation, NSObject))]
319    #[derive(Debug, PartialEq, Eq, Hash)]
320    pub struct NSViewAnimation;
321);
322
323unsafe impl NSCoding for NSViewAnimation {}
324
325unsafe impl NSCopying for NSViewAnimation {}
326
327unsafe impl CopyingHelper for NSViewAnimation {
328    type Result = Self;
329}
330
331unsafe impl NSObjectProtocol for NSViewAnimation {}
332
333impl NSViewAnimation {
334    extern_methods!(
335        #[unsafe(method(initWithViewAnimations:))]
336        #[unsafe(method_family = init)]
337        pub unsafe fn initWithViewAnimations(
338            this: Allocated<Self>,
339            view_animations: &NSArray<NSDictionary<NSViewAnimationKey, AnyObject>>,
340        ) -> Retained<Self>;
341
342        #[unsafe(method(viewAnimations))]
343        #[unsafe(method_family = none)]
344        pub unsafe fn viewAnimations(
345            &self,
346        ) -> Retained<NSArray<NSDictionary<NSViewAnimationKey, AnyObject>>>;
347
348        /// Setter for [`viewAnimations`][Self::viewAnimations].
349        #[unsafe(method(setViewAnimations:))]
350        #[unsafe(method_family = none)]
351        pub unsafe fn setViewAnimations(
352            &self,
353            view_animations: &NSArray<NSDictionary<NSViewAnimationKey, AnyObject>>,
354        );
355    );
356}
357
358/// Methods declared on superclass `NSAnimation`.
359impl NSViewAnimation {
360    extern_methods!(
361        #[unsafe(method(initWithDuration:animationCurve:))]
362        #[unsafe(method_family = init)]
363        pub unsafe fn initWithDuration_animationCurve(
364            this: Allocated<Self>,
365            duration: NSTimeInterval,
366            animation_curve: NSAnimationCurve,
367        ) -> Retained<Self>;
368
369        #[unsafe(method(initWithCoder:))]
370        #[unsafe(method_family = init)]
371        pub unsafe fn initWithCoder(
372            this: Allocated<Self>,
373            coder: &NSCoder,
374        ) -> Option<Retained<Self>>;
375    );
376}
377
378/// Methods declared on superclass `NSObject`.
379impl NSViewAnimation {
380    extern_methods!(
381        #[unsafe(method(init))]
382        #[unsafe(method_family = init)]
383        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
384
385        #[unsafe(method(new))]
386        #[unsafe(method_family = new)]
387        pub unsafe fn new() -> Retained<Self>;
388    );
389}
390
391/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsanimatablepropertykey?language=objc)
392pub type NSAnimatablePropertyKey = NSString;
393
394extern_protocol!(
395    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsanimatablepropertycontainer?language=objc)
396    pub unsafe trait NSAnimatablePropertyContainer {
397        #[unsafe(method(animator))]
398        #[unsafe(method_family = none)]
399        unsafe fn animator(&self) -> Retained<Self>;
400
401        #[unsafe(method(animations))]
402        #[unsafe(method_family = none)]
403        unsafe fn animations(&self) -> Retained<NSDictionary<NSAnimatablePropertyKey, AnyObject>>;
404
405        /// Setter for [`animations`][Self::animations].
406        #[unsafe(method(setAnimations:))]
407        #[unsafe(method_family = none)]
408        unsafe fn setAnimations(
409            &self,
410            animations: &NSDictionary<NSAnimatablePropertyKey, AnyObject>,
411        );
412
413        #[unsafe(method(animationForKey:))]
414        #[unsafe(method_family = none)]
415        unsafe fn animationForKey(
416            &self,
417            key: &NSAnimatablePropertyKey,
418        ) -> Option<Retained<AnyObject>>;
419
420        #[unsafe(method(defaultAnimationForKey:))]
421        #[unsafe(method_family = none)]
422        unsafe fn defaultAnimationForKey(
423            key: &NSAnimatablePropertyKey,
424        ) -> Option<Retained<AnyObject>>;
425    }
426);
427
428extern "C" {
429    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsanimationtriggerorderin?language=objc)
430    pub static NSAnimationTriggerOrderIn: &'static NSAnimatablePropertyKey;
431}
432
433extern "C" {
434    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsanimationtriggerorderout?language=objc)
435    pub static NSAnimationTriggerOrderOut: &'static NSAnimatablePropertyKey;
436}