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 fn isIndeterminate(&self) -> bool;
114
115        /// Setter for [`isIndeterminate`][Self::isIndeterminate].
116        #[unsafe(method(setIndeterminate:))]
117        #[unsafe(method_family = none)]
118        pub fn setIndeterminate(&self, indeterminate: bool);
119
120        #[cfg(feature = "NSCell")]
121        #[unsafe(method(controlSize))]
122        #[unsafe(method_family = none)]
123        pub 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 fn setControlSize(&self, control_size: NSControlSize);
130
131        #[unsafe(method(doubleValue))]
132        #[unsafe(method_family = none)]
133        pub fn doubleValue(&self) -> c_double;
134
135        /// Setter for [`doubleValue`][Self::doubleValue].
136        #[unsafe(method(setDoubleValue:))]
137        #[unsafe(method_family = none)]
138        pub fn setDoubleValue(&self, double_value: c_double);
139
140        #[unsafe(method(incrementBy:))]
141        #[unsafe(method_family = none)]
142        pub fn incrementBy(&self, delta: c_double);
143
144        #[unsafe(method(minValue))]
145        #[unsafe(method_family = none)]
146        pub fn minValue(&self) -> c_double;
147
148        /// Setter for [`minValue`][Self::minValue].
149        #[unsafe(method(setMinValue:))]
150        #[unsafe(method_family = none)]
151        pub fn setMinValue(&self, min_value: c_double);
152
153        #[unsafe(method(maxValue))]
154        #[unsafe(method_family = none)]
155        pub fn maxValue(&self) -> c_double;
156
157        /// Setter for [`maxValue`][Self::maxValue].
158        #[unsafe(method(setMaxValue:))]
159        #[unsafe(method_family = none)]
160        pub fn setMaxValue(&self, max_value: c_double);
161
162        #[unsafe(method(observedProgress))]
163        #[unsafe(method_family = none)]
164        pub fn observedProgress(&self) -> Option<Retained<NSProgress>>;
165
166        /// Setter for [`observedProgress`][Self::observedProgress].
167        #[unsafe(method(setObservedProgress:))]
168        #[unsafe(method_family = none)]
169        pub fn setObservedProgress(&self, observed_progress: Option<&NSProgress>);
170
171        #[unsafe(method(usesThreadedAnimation))]
172        #[unsafe(method_family = none)]
173        pub 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        /// # Safety
181        ///
182        /// `sender` should be of the correct type.
183        #[unsafe(method(startAnimation:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn startAnimation(&self, sender: Option<&AnyObject>);
186
187        /// # Safety
188        ///
189        /// `sender` should be of the correct type.
190        #[unsafe(method(stopAnimation:))]
191        #[unsafe(method_family = none)]
192        pub unsafe fn stopAnimation(&self, sender: Option<&AnyObject>);
193
194        #[unsafe(method(style))]
195        #[unsafe(method_family = none)]
196        pub fn style(&self) -> NSProgressIndicatorStyle;
197
198        /// Setter for [`style`][Self::style].
199        #[unsafe(method(setStyle:))]
200        #[unsafe(method_family = none)]
201        pub fn setStyle(&self, style: NSProgressIndicatorStyle);
202
203        #[unsafe(method(sizeToFit))]
204        #[unsafe(method_family = none)]
205        pub fn sizeToFit(&self);
206
207        #[unsafe(method(isDisplayedWhenStopped))]
208        #[unsafe(method_family = none)]
209        pub fn isDisplayedWhenStopped(&self) -> bool;
210
211        /// Setter for [`isDisplayedWhenStopped`][Self::isDisplayedWhenStopped].
212        #[unsafe(method(setDisplayedWhenStopped:))]
213        #[unsafe(method_family = none)]
214        pub fn setDisplayedWhenStopped(&self, displayed_when_stopped: bool);
215    );
216}
217
218/// Methods declared on superclass `NSView`.
219#[cfg(all(feature = "NSResponder", feature = "NSView"))]
220impl NSProgressIndicator {
221    extern_methods!(
222        #[unsafe(method(initWithFrame:))]
223        #[unsafe(method_family = init)]
224        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
225
226        /// # Safety
227        ///
228        /// `coder` possibly has further requirements.
229        #[unsafe(method(initWithCoder:))]
230        #[unsafe(method_family = init)]
231        pub unsafe fn initWithCoder(
232            this: Allocated<Self>,
233            coder: &NSCoder,
234        ) -> Option<Retained<Self>>;
235    );
236}
237
238/// Methods declared on superclass `NSResponder`.
239#[cfg(all(feature = "NSResponder", feature = "NSView"))]
240impl NSProgressIndicator {
241    extern_methods!(
242        #[unsafe(method(init))]
243        #[unsafe(method_family = init)]
244        pub fn init(this: Allocated<Self>) -> Retained<Self>;
245    );
246}
247
248/// Methods declared on superclass `NSObject`.
249#[cfg(all(feature = "NSResponder", feature = "NSView"))]
250impl NSProgressIndicator {
251    extern_methods!(
252        #[unsafe(method(new))]
253        #[unsafe(method_family = new)]
254        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
255    );
256}
257
258/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprogressindicatorthickness?language=objc)
259// NS_ENUM
260#[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
261#[repr(transparent)]
262#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
263pub struct NSProgressIndicatorThickness(pub NSUInteger);
264impl NSProgressIndicatorThickness {
265    #[doc(alias = "NSProgressIndicatorPreferredThickness")]
266    #[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
267    pub const PreferredThickness: Self = Self(14);
268    #[doc(alias = "NSProgressIndicatorPreferredSmallThickness")]
269    #[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
270    pub const PreferredSmallThickness: Self = Self(10);
271    #[doc(alias = "NSProgressIndicatorPreferredLargeThickness")]
272    #[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
273    pub const PreferredLargeThickness: Self = Self(18);
274    #[doc(alias = "NSProgressIndicatorPreferredAquaThickness")]
275    #[deprecated = "These constants do not accurately represent the geometry of NSProgressIndicator.  Use `controlSize` and `sizeToFit` instead."]
276    pub const PreferredAquaThickness: Self = Self(12);
277}
278
279unsafe impl Encode for NSProgressIndicatorThickness {
280    const ENCODING: Encoding = NSUInteger::ENCODING;
281}
282
283unsafe impl RefEncode for NSProgressIndicatorThickness {
284    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
285}
286
287/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprogressindicatorbarstyle?language=objc)
288#[deprecated]
289pub static NSProgressIndicatorBarStyle: NSProgressIndicatorStyle =
290    NSProgressIndicatorStyle(NSProgressIndicatorStyle::Bar.0);
291
292/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprogressindicatorspinningstyle?language=objc)
293#[deprecated]
294pub static NSProgressIndicatorSpinningStyle: NSProgressIndicatorStyle =
295    NSProgressIndicatorStyle(NSProgressIndicatorStyle::Spinning.0);
296
297/// NSProgressIndicatorDeprecated.
298#[cfg(all(feature = "NSResponder", feature = "NSView"))]
299impl NSProgressIndicator {
300    extern_methods!(
301        #[deprecated = "The animationDelay property does nothing."]
302        #[unsafe(method(animationDelay))]
303        #[unsafe(method_family = none)]
304        pub fn animationDelay(&self) -> NSTimeInterval;
305
306        #[deprecated = "The animationDelay property does nothing."]
307        #[unsafe(method(setAnimationDelay:))]
308        #[unsafe(method_family = none)]
309        pub fn setAnimationDelay(&self, delay: NSTimeInterval);
310
311        /// # Safety
312        ///
313        /// `sender` should be of the correct type.
314        #[deprecated = "Use -startAnimation and -stopAnimation instead."]
315        #[unsafe(method(animate:))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn animate(&self, sender: Option<&AnyObject>);
318
319        #[deprecated = "The bezeled property is not respected on 10.15 and later"]
320        #[unsafe(method(isBezeled))]
321        #[unsafe(method_family = none)]
322        pub fn isBezeled(&self) -> bool;
323
324        /// Setter for [`isBezeled`][Self::isBezeled].
325        #[deprecated = "The bezeled property is not respected on 10.15 and later"]
326        #[unsafe(method(setBezeled:))]
327        #[unsafe(method_family = none)]
328        pub fn setBezeled(&self, bezeled: bool);
329
330        #[cfg(feature = "NSCell")]
331        #[deprecated = "The controlTint property is not respected on 10.15 and later"]
332        #[unsafe(method(controlTint))]
333        #[unsafe(method_family = none)]
334        pub fn controlTint(&self) -> NSControlTint;
335
336        #[cfg(feature = "NSCell")]
337        /// Setter for [`controlTint`][Self::controlTint].
338        #[deprecated = "The controlTint property is not respected on 10.15 and later"]
339        #[unsafe(method(setControlTint:))]
340        #[unsafe(method_family = none)]
341        pub fn setControlTint(&self, control_tint: NSControlTint);
342    );
343}