objc2_app_kit/generated/
NSProgressIndicator.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/nsprogressindicatorstyle?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSProgressIndicatorStyle(pub NSUInteger);
15impl NSProgressIndicatorStyle {
16    #[doc(alias = "NSProgressIndicatorStyleBar")]
17    pub const Bar: Self = Self(0);
18    #[doc(alias = "NSProgressIndicatorStyleSpinning")]
19    pub const Spinning: Self = Self(1);
20}
21
22unsafe impl Encode for NSProgressIndicatorStyle {
23    const ENCODING: Encoding = NSUInteger::ENCODING;
24}
25
26unsafe impl RefEncode for NSProgressIndicatorStyle {
27    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
28}
29
30extern_class!(
31    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprogressindicator?language=objc)
32    #[unsafe(super(NSView, NSResponder, NSObject))]
33    #[derive(Debug, PartialEq, Eq, Hash)]
34    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
35    pub struct NSProgressIndicator;
36);
37
38#[cfg(all(
39    feature = "NSAccessibilityProtocols",
40    feature = "NSResponder",
41    feature = "NSView"
42))]
43extern_conformance!(
44    unsafe impl NSAccessibility for NSProgressIndicator {}
45);
46
47#[cfg(all(
48    feature = "NSAccessibilityProtocols",
49    feature = "NSResponder",
50    feature = "NSView"
51))]
52extern_conformance!(
53    unsafe impl NSAccessibilityElementProtocol for NSProgressIndicator {}
54);
55
56#[cfg(all(
57    feature = "NSAccessibilityProtocols",
58    feature = "NSResponder",
59    feature = "NSView"
60))]
61extern_conformance!(
62    unsafe impl NSAccessibilityGroup for NSProgressIndicator {}
63);
64
65#[cfg(all(
66    feature = "NSAccessibilityProtocols",
67    feature = "NSResponder",
68    feature = "NSView"
69))]
70extern_conformance!(
71    unsafe impl NSAccessibilityProgressIndicator for NSProgressIndicator {}
72);
73
74#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
75extern_conformance!(
76    unsafe impl NSAnimatablePropertyContainer for NSProgressIndicator {}
77);
78
79#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
80extern_conformance!(
81    unsafe impl NSAppearanceCustomization for NSProgressIndicator {}
82);
83
84#[cfg(all(feature = "NSResponder", feature = "NSView"))]
85extern_conformance!(
86    unsafe impl NSCoding for NSProgressIndicator {}
87);
88
89#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
90extern_conformance!(
91    unsafe impl NSDraggingDestination for NSProgressIndicator {}
92);
93
94#[cfg(all(feature = "NSResponder", feature = "NSView"))]
95extern_conformance!(
96    unsafe impl NSObjectProtocol for NSProgressIndicator {}
97);
98
99#[cfg(all(
100    feature = "NSResponder",
101    feature = "NSUserInterfaceItemIdentification",
102    feature = "NSView"
103))]
104extern_conformance!(
105    unsafe impl NSUserInterfaceItemIdentification for NSProgressIndicator {}
106);
107
108#[cfg(all(feature = "NSResponder", feature = "NSView"))]
109impl NSProgressIndicator {
110    extern_methods!(
111        #[unsafe(method(isIndeterminate))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn isIndeterminate(&self) -> bool;
114
115        /// Setter for [`isIndeterminate`][Self::isIndeterminate].
116        #[unsafe(method(setIndeterminate:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn setIndeterminate(&self, indeterminate: bool);
119
120        #[cfg(feature = "NSCell")]
121        #[unsafe(method(controlSize))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn controlSize(&self) -> NSControlSize;
124
125        #[cfg(feature = "NSCell")]
126        /// Setter for [`controlSize`][Self::controlSize].
127        #[unsafe(method(setControlSize:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn setControlSize(&self, control_size: NSControlSize);
130
131        #[unsafe(method(doubleValue))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn doubleValue(&self) -> c_double;
134
135        /// Setter for [`doubleValue`][Self::doubleValue].
136        #[unsafe(method(setDoubleValue:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setDoubleValue(&self, double_value: c_double);
139
140        #[unsafe(method(incrementBy:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn incrementBy(&self, delta: c_double);
143
144        #[unsafe(method(minValue))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn minValue(&self) -> c_double;
147
148        /// Setter for [`minValue`][Self::minValue].
149        #[unsafe(method(setMinValue:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn setMinValue(&self, min_value: c_double);
152
153        #[unsafe(method(maxValue))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn maxValue(&self) -> c_double;
156
157        /// Setter for [`maxValue`][Self::maxValue].
158        #[unsafe(method(setMaxValue:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn setMaxValue(&self, max_value: c_double);
161
162        #[unsafe(method(observedProgress))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn observedProgress(&self) -> Option<Retained<NSProgress>>;
165
166        /// Setter for [`observedProgress`][Self::observedProgress].
167        #[unsafe(method(setObservedProgress:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn setObservedProgress(&self, observed_progress: Option<&NSProgress>);
170
171        #[unsafe(method(usesThreadedAnimation))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn usesThreadedAnimation(&self) -> bool;
174
175        /// Setter for [`usesThreadedAnimation`][Self::usesThreadedAnimation].
176        #[unsafe(method(setUsesThreadedAnimation:))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn setUsesThreadedAnimation(&self, uses_threaded_animation: bool);
179
180        #[unsafe(method(startAnimation:))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn startAnimation(&self, sender: Option<&AnyObject>);
183
184        #[unsafe(method(stopAnimation:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn stopAnimation(&self, sender: Option<&AnyObject>);
187
188        #[unsafe(method(style))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn style(&self) -> NSProgressIndicatorStyle;
191
192        /// Setter for [`style`][Self::style].
193        #[unsafe(method(setStyle:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn setStyle(&self, style: NSProgressIndicatorStyle);
196
197        #[unsafe(method(sizeToFit))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn sizeToFit(&self);
200
201        #[unsafe(method(isDisplayedWhenStopped))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn isDisplayedWhenStopped(&self) -> bool;
204
205        /// Setter for [`isDisplayedWhenStopped`][Self::isDisplayedWhenStopped].
206        #[unsafe(method(setDisplayedWhenStopped:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn setDisplayedWhenStopped(&self, displayed_when_stopped: bool);
209    );
210}
211
212/// Methods declared on superclass `NSView`.
213#[cfg(all(feature = "NSResponder", feature = "NSView"))]
214impl NSProgressIndicator {
215    extern_methods!(
216        #[unsafe(method(initWithFrame:))]
217        #[unsafe(method_family = init)]
218        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
219
220        #[unsafe(method(initWithCoder:))]
221        #[unsafe(method_family = init)]
222        pub unsafe fn initWithCoder(
223            this: Allocated<Self>,
224            coder: &NSCoder,
225        ) -> Option<Retained<Self>>;
226    );
227}
228
229/// Methods declared on superclass `NSResponder`.
230#[cfg(all(feature = "NSResponder", feature = "NSView"))]
231impl NSProgressIndicator {
232    extern_methods!(
233        #[unsafe(method(init))]
234        #[unsafe(method_family = init)]
235        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
236    );
237}
238
239/// Methods declared on superclass `NSObject`.
240#[cfg(all(feature = "NSResponder", feature = "NSView"))]
241impl NSProgressIndicator {
242    extern_methods!(
243        #[unsafe(method(new))]
244        #[unsafe(method_family = new)]
245        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
246    );
247}
248
249/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprogressindicatorthickness?language=objc)
250// NS_ENUM
251#[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
252#[repr(transparent)]
253#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
254pub struct NSProgressIndicatorThickness(pub NSUInteger);
255impl NSProgressIndicatorThickness {
256    #[doc(alias = "NSProgressIndicatorPreferredThickness")]
257    #[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
258    pub const PreferredThickness: Self = Self(14);
259    #[doc(alias = "NSProgressIndicatorPreferredSmallThickness")]
260    #[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
261    pub const PreferredSmallThickness: Self = Self(10);
262    #[doc(alias = "NSProgressIndicatorPreferredLargeThickness")]
263    #[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
264    pub const PreferredLargeThickness: Self = Self(18);
265    #[doc(alias = "NSProgressIndicatorPreferredAquaThickness")]
266    #[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
267    pub const PreferredAquaThickness: Self = Self(12);
268}
269
270unsafe impl Encode for NSProgressIndicatorThickness {
271    const ENCODING: Encoding = NSUInteger::ENCODING;
272}
273
274unsafe impl RefEncode for NSProgressIndicatorThickness {
275    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
276}
277
278/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprogressindicatorbarstyle?language=objc)
279pub static NSProgressIndicatorBarStyle: NSProgressIndicatorStyle =
280    NSProgressIndicatorStyle(NSProgressIndicatorStyle::Bar.0);
281
282/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprogressindicatorspinningstyle?language=objc)
283pub static NSProgressIndicatorSpinningStyle: NSProgressIndicatorStyle =
284    NSProgressIndicatorStyle(NSProgressIndicatorStyle::Spinning.0);
285
286/// NSProgressIndicatorDeprecated.
287#[cfg(all(feature = "NSResponder", feature = "NSView"))]
288impl NSProgressIndicator {
289    extern_methods!(
290        #[deprecated = "The animationDelay property does nothing."]
291        #[unsafe(method(animationDelay))]
292        #[unsafe(method_family = none)]
293        pub unsafe fn animationDelay(&self) -> NSTimeInterval;
294
295        #[deprecated = "The animationDelay property does nothing."]
296        #[unsafe(method(setAnimationDelay:))]
297        #[unsafe(method_family = none)]
298        pub unsafe fn setAnimationDelay(&self, delay: NSTimeInterval);
299
300        #[deprecated = "Use -startAnimation and -stopAnimation instead."]
301        #[unsafe(method(animate:))]
302        #[unsafe(method_family = none)]
303        pub unsafe fn animate(&self, sender: Option<&AnyObject>);
304
305        #[deprecated = "The bezeled property is not respected on 10.15 and later"]
306        #[unsafe(method(isBezeled))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn isBezeled(&self) -> bool;
309
310        /// Setter for [`isBezeled`][Self::isBezeled].
311        #[deprecated = "The bezeled property is not respected on 10.15 and later"]
312        #[unsafe(method(setBezeled:))]
313        #[unsafe(method_family = none)]
314        pub unsafe fn setBezeled(&self, bezeled: bool);
315
316        #[cfg(feature = "NSCell")]
317        #[deprecated = "The controlTint property is not respected on 10.15 and later"]
318        #[unsafe(method(controlTint))]
319        #[unsafe(method_family = none)]
320        pub unsafe fn controlTint(&self) -> NSControlTint;
321
322        #[cfg(feature = "NSCell")]
323        /// Setter for [`controlTint`][Self::controlTint].
324        #[deprecated = "The controlTint property is not respected on 10.15 and later"]
325        #[unsafe(method(setControlTint:))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn setControlTint(&self, control_tint: NSControlTint);
328    );
329}