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