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