icrate/generated/AppKit/
NSAnimation.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use crate::common::*;
4use crate::AppKit::*;
5use crate::CoreData::*;
6use crate::Foundation::*;
7
8ns_enum!(
9    #[underlying(NSUInteger)]
10    pub enum NSAnimationCurve {
11        NSAnimationEaseInOut = 0,
12        NSAnimationEaseIn = 1,
13        NSAnimationEaseOut = 2,
14        NSAnimationLinear = 3,
15    }
16);
17
18ns_enum!(
19    #[underlying(NSUInteger)]
20    pub enum NSAnimationBlockingMode {
21        NSAnimationBlocking = 0,
22        NSAnimationNonblocking = 1,
23        NSAnimationNonblockingThreaded = 2,
24    }
25);
26
27pub type NSAnimationProgress = c_float;
28
29extern_static!(NSAnimationProgressMarkNotification: &'static NSNotificationName);
30
31extern_static!(NSAnimationProgressMark: &'static NSString);
32
33extern_class!(
34    #[derive(Debug, PartialEq, Eq, Hash)]
35    #[cfg(feature = "AppKit_NSAnimation")]
36    pub struct NSAnimation;
37
38    #[cfg(feature = "AppKit_NSAnimation")]
39    unsafe impl ClassType for NSAnimation {
40        type Super = NSObject;
41        type Mutability = InteriorMutable;
42    }
43);
44
45#[cfg(feature = "AppKit_NSAnimation")]
46unsafe impl NSCoding for NSAnimation {}
47
48#[cfg(feature = "AppKit_NSAnimation")]
49unsafe impl NSCopying for NSAnimation {}
50
51#[cfg(feature = "AppKit_NSAnimation")]
52unsafe impl NSObjectProtocol for NSAnimation {}
53
54extern_methods!(
55    #[cfg(feature = "AppKit_NSAnimation")]
56    unsafe impl NSAnimation {
57        #[method_id(@__retain_semantics Init initWithDuration:animationCurve:)]
58        pub unsafe fn initWithDuration_animationCurve(
59            this: Allocated<Self>,
60            duration: NSTimeInterval,
61            animation_curve: NSAnimationCurve,
62        ) -> Id<Self>;
63
64        #[cfg(feature = "Foundation_NSCoder")]
65        #[method_id(@__retain_semantics Init initWithCoder:)]
66        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Option<Id<Self>>;
67
68        #[method(startAnimation)]
69        pub unsafe fn startAnimation(&self);
70
71        #[method(stopAnimation)]
72        pub unsafe fn stopAnimation(&self);
73
74        #[method(isAnimating)]
75        pub unsafe fn isAnimating(&self) -> bool;
76
77        #[method(currentProgress)]
78        pub unsafe fn currentProgress(&self) -> NSAnimationProgress;
79
80        #[method(setCurrentProgress:)]
81        pub unsafe fn setCurrentProgress(&self, current_progress: NSAnimationProgress);
82
83        #[method(duration)]
84        pub unsafe fn duration(&self) -> NSTimeInterval;
85
86        #[method(setDuration:)]
87        pub unsafe fn setDuration(&self, duration: NSTimeInterval);
88
89        #[method(animationBlockingMode)]
90        pub unsafe fn animationBlockingMode(&self) -> NSAnimationBlockingMode;
91
92        #[method(setAnimationBlockingMode:)]
93        pub unsafe fn setAnimationBlockingMode(
94            &self,
95            animation_blocking_mode: NSAnimationBlockingMode,
96        );
97
98        #[method(frameRate)]
99        pub unsafe fn frameRate(&self) -> c_float;
100
101        #[method(setFrameRate:)]
102        pub unsafe fn setFrameRate(&self, frame_rate: c_float);
103
104        #[method(animationCurve)]
105        pub unsafe fn animationCurve(&self) -> NSAnimationCurve;
106
107        #[method(setAnimationCurve:)]
108        pub unsafe fn setAnimationCurve(&self, animation_curve: NSAnimationCurve);
109
110        #[method(currentValue)]
111        pub unsafe fn currentValue(&self) -> c_float;
112
113        #[method_id(@__retain_semantics Other delegate)]
114        pub unsafe fn delegate(&self) -> Option<Id<ProtocolObject<dyn NSAnimationDelegate>>>;
115
116        #[method(setDelegate:)]
117        pub unsafe fn setDelegate(
118            &self,
119            delegate: Option<&ProtocolObject<dyn NSAnimationDelegate>>,
120        );
121
122        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSNumber"))]
123        #[method_id(@__retain_semantics Other progressMarks)]
124        pub unsafe fn progressMarks(&self) -> Id<NSArray<NSNumber>>;
125
126        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSNumber"))]
127        #[method(setProgressMarks:)]
128        pub unsafe fn setProgressMarks(&self, progress_marks: &NSArray<NSNumber>);
129
130        #[method(addProgressMark:)]
131        pub unsafe fn addProgressMark(&self, progress_mark: NSAnimationProgress);
132
133        #[method(removeProgressMark:)]
134        pub unsafe fn removeProgressMark(&self, progress_mark: NSAnimationProgress);
135
136        #[method(startWhenAnimation:reachesProgress:)]
137        pub unsafe fn startWhenAnimation_reachesProgress(
138            &self,
139            animation: &NSAnimation,
140            start_progress: NSAnimationProgress,
141        );
142
143        #[method(stopWhenAnimation:reachesProgress:)]
144        pub unsafe fn stopWhenAnimation_reachesProgress(
145            &self,
146            animation: &NSAnimation,
147            stop_progress: NSAnimationProgress,
148        );
149
150        #[method(clearStartAnimation)]
151        pub unsafe fn clearStartAnimation(&self);
152
153        #[method(clearStopAnimation)]
154        pub unsafe fn clearStopAnimation(&self);
155
156        #[cfg(feature = "Foundation_NSArray")]
157        #[method_id(@__retain_semantics Other runLoopModesForAnimating)]
158        pub unsafe fn runLoopModesForAnimating(&self) -> Option<Id<NSArray<NSRunLoopMode>>>;
159    }
160);
161
162extern_methods!(
163    /// Methods declared on superclass `NSObject`
164    #[cfg(feature = "AppKit_NSAnimation")]
165    unsafe impl NSAnimation {
166        #[method_id(@__retain_semantics Init init)]
167        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
168
169        #[method_id(@__retain_semantics New new)]
170        pub unsafe fn new() -> Id<Self>;
171    }
172);
173
174extern_protocol!(
175    pub unsafe trait NSAnimationDelegate: NSObjectProtocol {
176        #[cfg(feature = "AppKit_NSAnimation")]
177        #[optional]
178        #[method(animationShouldStart:)]
179        unsafe fn animationShouldStart(&self, animation: &NSAnimation) -> bool;
180
181        #[cfg(feature = "AppKit_NSAnimation")]
182        #[optional]
183        #[method(animationDidStop:)]
184        unsafe fn animationDidStop(&self, animation: &NSAnimation);
185
186        #[cfg(feature = "AppKit_NSAnimation")]
187        #[optional]
188        #[method(animationDidEnd:)]
189        unsafe fn animationDidEnd(&self, animation: &NSAnimation);
190
191        #[cfg(feature = "AppKit_NSAnimation")]
192        #[optional]
193        #[method(animation:valueForProgress:)]
194        unsafe fn animation_valueForProgress(
195            &self,
196            animation: &NSAnimation,
197            progress: NSAnimationProgress,
198        ) -> c_float;
199
200        #[cfg(feature = "AppKit_NSAnimation")]
201        #[optional]
202        #[method(animation:didReachProgressMark:)]
203        unsafe fn animation_didReachProgressMark(
204            &self,
205            animation: &NSAnimation,
206            progress: NSAnimationProgress,
207        );
208    }
209
210    unsafe impl ProtocolType for dyn NSAnimationDelegate {}
211);
212
213typed_enum!(
214    pub type NSViewAnimationKey = NSString;
215);
216
217extern_static!(NSViewAnimationTargetKey: &'static NSViewAnimationKey);
218
219extern_static!(NSViewAnimationStartFrameKey: &'static NSViewAnimationKey);
220
221extern_static!(NSViewAnimationEndFrameKey: &'static NSViewAnimationKey);
222
223extern_static!(NSViewAnimationEffectKey: &'static NSViewAnimationKey);
224
225typed_enum!(
226    pub type NSViewAnimationEffectName = NSString;
227);
228
229extern_static!(NSViewAnimationFadeInEffect: &'static NSViewAnimationEffectName);
230
231extern_static!(NSViewAnimationFadeOutEffect: &'static NSViewAnimationEffectName);
232
233extern_class!(
234    #[derive(Debug, PartialEq, Eq, Hash)]
235    #[cfg(feature = "AppKit_NSViewAnimation")]
236    pub struct NSViewAnimation;
237
238    #[cfg(feature = "AppKit_NSViewAnimation")]
239    unsafe impl ClassType for NSViewAnimation {
240        #[inherits(NSObject)]
241        type Super = NSAnimation;
242        type Mutability = InteriorMutable;
243    }
244);
245
246#[cfg(feature = "AppKit_NSViewAnimation")]
247unsafe impl NSCoding for NSViewAnimation {}
248
249#[cfg(feature = "AppKit_NSViewAnimation")]
250unsafe impl NSCopying for NSViewAnimation {}
251
252#[cfg(feature = "AppKit_NSViewAnimation")]
253unsafe impl NSObjectProtocol for NSViewAnimation {}
254
255extern_methods!(
256    #[cfg(feature = "AppKit_NSViewAnimation")]
257    unsafe impl NSViewAnimation {
258        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSDictionary"))]
259        #[method_id(@__retain_semantics Init initWithViewAnimations:)]
260        pub unsafe fn initWithViewAnimations(
261            this: Allocated<Self>,
262            view_animations: &NSArray<NSDictionary<NSViewAnimationKey, AnyObject>>,
263        ) -> Id<Self>;
264
265        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSDictionary"))]
266        #[method_id(@__retain_semantics Other viewAnimations)]
267        pub unsafe fn viewAnimations(
268            &self,
269        ) -> Id<NSArray<NSDictionary<NSViewAnimationKey, AnyObject>>>;
270
271        #[cfg(all(feature = "Foundation_NSArray", feature = "Foundation_NSDictionary"))]
272        #[method(setViewAnimations:)]
273        pub unsafe fn setViewAnimations(
274            &self,
275            view_animations: &NSArray<NSDictionary<NSViewAnimationKey, AnyObject>>,
276        );
277    }
278);
279
280extern_methods!(
281    /// Methods declared on superclass `NSAnimation`
282    #[cfg(feature = "AppKit_NSViewAnimation")]
283    unsafe impl NSViewAnimation {
284        #[method_id(@__retain_semantics Init initWithDuration:animationCurve:)]
285        pub unsafe fn initWithDuration_animationCurve(
286            this: Allocated<Self>,
287            duration: NSTimeInterval,
288            animation_curve: NSAnimationCurve,
289        ) -> Id<Self>;
290
291        #[cfg(feature = "Foundation_NSCoder")]
292        #[method_id(@__retain_semantics Init initWithCoder:)]
293        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Option<Id<Self>>;
294    }
295);
296
297extern_methods!(
298    /// Methods declared on superclass `NSObject`
299    #[cfg(feature = "AppKit_NSViewAnimation")]
300    unsafe impl NSViewAnimation {
301        #[method_id(@__retain_semantics Init init)]
302        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
303
304        #[method_id(@__retain_semantics New new)]
305        pub unsafe fn new() -> Id<Self>;
306    }
307);
308
309pub type NSAnimatablePropertyKey = NSString;
310
311extern_protocol!(
312    pub unsafe trait NSAnimatablePropertyContainer {
313        #[method_id(@__retain_semantics Other animator)]
314        unsafe fn animator(&self) -> Id<Self>;
315
316        #[cfg(feature = "Foundation_NSDictionary")]
317        #[method_id(@__retain_semantics Other animations)]
318        unsafe fn animations(&self) -> Id<NSDictionary<NSAnimatablePropertyKey, AnyObject>>;
319
320        #[cfg(feature = "Foundation_NSDictionary")]
321        #[method(setAnimations:)]
322        unsafe fn setAnimations(
323            &self,
324            animations: &NSDictionary<NSAnimatablePropertyKey, AnyObject>,
325        );
326
327        #[method_id(@__retain_semantics Other animationForKey:)]
328        unsafe fn animationForKey(&self, key: &NSAnimatablePropertyKey) -> Option<Id<AnyObject>>;
329
330        #[method_id(@__retain_semantics Other defaultAnimationForKey:)]
331        unsafe fn defaultAnimationForKey(key: &NSAnimatablePropertyKey) -> Option<Id<AnyObject>>;
332    }
333
334    unsafe impl ProtocolType for dyn NSAnimatablePropertyContainer {}
335);
336
337extern_static!(NSAnimationTriggerOrderIn: &'static NSAnimatablePropertyKey);
338
339extern_static!(NSAnimationTriggerOrderOut: &'static NSAnimatablePropertyKey);