objc2_ui_kit/generated/
UIViewAnimating.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct UIViewAnimatingState(pub NSInteger);
17impl UIViewAnimatingState {
18 #[doc(alias = "UIViewAnimatingStateInactive")]
19 pub const Inactive: Self = Self(0);
20 #[doc(alias = "UIViewAnimatingStateActive")]
21 pub const Active: Self = Self(1);
22 #[doc(alias = "UIViewAnimatingStateStopped")]
23 pub const Stopped: Self = Self(2);
24}
25
26unsafe impl Encode for UIViewAnimatingState {
27 const ENCODING: Encoding = NSInteger::ENCODING;
28}
29
30unsafe impl RefEncode for UIViewAnimatingState {
31 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34#[repr(transparent)]
37#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
38pub struct UIViewAnimatingPosition(pub NSInteger);
39impl UIViewAnimatingPosition {
40 #[doc(alias = "UIViewAnimatingPositionEnd")]
41 pub const End: Self = Self(0);
42 #[doc(alias = "UIViewAnimatingPositionStart")]
43 pub const Start: Self = Self(1);
44 #[doc(alias = "UIViewAnimatingPositionCurrent")]
45 pub const Current: Self = Self(2);
46}
47
48unsafe impl Encode for UIViewAnimatingPosition {
49 const ENCODING: Encoding = NSInteger::ENCODING;
50}
51
52unsafe impl RefEncode for UIViewAnimatingPosition {
53 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
54}
55
56extern_protocol!(
57 pub unsafe trait UIViewAnimating: NSObjectProtocol + MainThreadOnly {
59 #[unsafe(method(state))]
60 #[unsafe(method_family = none)]
61 fn state(&self) -> UIViewAnimatingState;
62
63 #[unsafe(method(isRunning))]
64 #[unsafe(method_family = none)]
65 fn isRunning(&self) -> bool;
66
67 #[unsafe(method(isReversed))]
68 #[unsafe(method_family = none)]
69 fn isReversed(&self) -> bool;
70
71 #[unsafe(method(setReversed:))]
73 #[unsafe(method_family = none)]
74 fn setReversed(&self, reversed: bool);
75
76 #[cfg(feature = "objc2-core-foundation")]
77 #[unsafe(method(fractionComplete))]
78 #[unsafe(method_family = none)]
79 fn fractionComplete(&self) -> CGFloat;
80
81 #[cfg(feature = "objc2-core-foundation")]
82 #[unsafe(method(setFractionComplete:))]
84 #[unsafe(method_family = none)]
85 fn setFractionComplete(&self, fraction_complete: CGFloat);
86
87 #[unsafe(method(startAnimation))]
88 #[unsafe(method_family = none)]
89 fn startAnimation(&self);
90
91 #[unsafe(method(startAnimationAfterDelay:))]
92 #[unsafe(method_family = none)]
93 fn startAnimationAfterDelay(&self, delay: NSTimeInterval);
94
95 #[unsafe(method(pauseAnimation))]
96 #[unsafe(method_family = none)]
97 fn pauseAnimation(&self);
98
99 #[unsafe(method(stopAnimation:))]
100 #[unsafe(method_family = none)]
101 fn stopAnimation(&self, without_finishing: bool);
102
103 #[unsafe(method(finishAnimationAtPosition:))]
104 #[unsafe(method_family = none)]
105 fn finishAnimationAtPosition(&self, final_position: UIViewAnimatingPosition);
106 }
107);
108
109extern_protocol!(
110 pub unsafe trait UIViewImplicitlyAnimating: UIViewAnimating + MainThreadOnly {
112 #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
113 #[optional]
114 #[unsafe(method(addAnimations:delayFactor:))]
115 #[unsafe(method_family = none)]
116 fn addAnimations_delayFactor(
117 &self,
118 animation: &block2::DynBlock<dyn Fn()>,
119 delay_factor: CGFloat,
120 );
121
122 #[cfg(feature = "block2")]
123 #[optional]
124 #[unsafe(method(addAnimations:))]
125 #[unsafe(method_family = none)]
126 fn addAnimations(&self, animation: &block2::DynBlock<dyn Fn()>);
127
128 #[cfg(feature = "block2")]
129 #[optional]
130 #[unsafe(method(addCompletion:))]
131 #[unsafe(method_family = none)]
132 fn addCompletion(&self, completion: &block2::DynBlock<dyn Fn(UIViewAnimatingPosition)>);
133
134 #[cfg(all(feature = "UITimingCurveProvider", feature = "objc2-core-foundation"))]
135 #[optional]
136 #[unsafe(method(continueAnimationWithTimingParameters:durationFactor:))]
137 #[unsafe(method_family = none)]
138 fn continueAnimationWithTimingParameters_durationFactor(
139 &self,
140 parameters: Option<&ProtocolObject<dyn UITimingCurveProvider>>,
141 duration_factor: CGFloat,
142 );
143 }
144);