objc2_foundation/generated/
NSProgress.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::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogresskind?language=objc)
10// NS_TYPED_EXTENSIBLE_ENUM
11#[cfg(feature = "NSString")]
12pub type NSProgressKind = NSString;
13
14/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressuserinfokey?language=objc)
15// NS_TYPED_EXTENSIBLE_ENUM
16#[cfg(feature = "NSString")]
17pub type NSProgressUserInfoKey = NSString;
18
19/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfileoperationkind?language=objc)
20// NS_TYPED_EXTENSIBLE_ENUM
21#[cfg(feature = "NSString")]
22pub type NSProgressFileOperationKind = NSString;
23
24/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressunpublishinghandler?language=objc)
25#[cfg(feature = "block2")]
26pub type NSProgressUnpublishingHandler = *mut block2::Block<dyn Fn()>;
27
28/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogresspublishinghandler?language=objc)
29#[cfg(feature = "block2")]
30pub type NSProgressPublishingHandler =
31    *mut block2::Block<dyn Fn(NonNull<NSProgress>) -> NSProgressUnpublishingHandler>;
32
33extern_class!(
34    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogress?language=objc)
35    #[unsafe(super(NSObject))]
36    #[derive(Debug, PartialEq, Eq, Hash)]
37    pub struct NSProgress;
38);
39
40unsafe impl Send for NSProgress {}
41
42unsafe impl Sync for NSProgress {}
43
44unsafe impl NSObjectProtocol for NSProgress {}
45
46impl NSProgress {
47    extern_methods!(
48        #[unsafe(method(currentProgress))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn currentProgress() -> Option<Retained<NSProgress>>;
51
52        #[unsafe(method(progressWithTotalUnitCount:))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn progressWithTotalUnitCount(unit_count: i64) -> Retained<NSProgress>;
55
56        #[unsafe(method(discreteProgressWithTotalUnitCount:))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn discreteProgressWithTotalUnitCount(unit_count: i64) -> Retained<NSProgress>;
59
60        #[unsafe(method(progressWithTotalUnitCount:parent:pendingUnitCount:))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn progressWithTotalUnitCount_parent_pendingUnitCount(
63            unit_count: i64,
64            parent: &NSProgress,
65            portion_of_parent_total_unit_count: i64,
66        ) -> Retained<NSProgress>;
67
68        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
69        #[unsafe(method(initWithParent:userInfo:))]
70        #[unsafe(method_family = init)]
71        pub unsafe fn initWithParent_userInfo(
72            this: Allocated<Self>,
73            parent_progress_or_nil: Option<&NSProgress>,
74            user_info_or_nil: Option<&NSDictionary<NSProgressUserInfoKey, AnyObject>>,
75        ) -> Retained<Self>;
76
77        #[unsafe(method(becomeCurrentWithPendingUnitCount:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn becomeCurrentWithPendingUnitCount(&self, unit_count: i64);
80
81        #[cfg(feature = "block2")]
82        #[unsafe(method(performAsCurrentWithPendingUnitCount:usingBlock:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn performAsCurrentWithPendingUnitCount_usingBlock(
85            &self,
86            unit_count: i64,
87            work: &block2::Block<dyn Fn() + '_>,
88        );
89
90        #[unsafe(method(resignCurrent))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn resignCurrent(&self);
93
94        #[unsafe(method(addChild:withPendingUnitCount:))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn addChild_withPendingUnitCount(&self, child: &NSProgress, in_unit_count: i64);
97
98        #[unsafe(method(totalUnitCount))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn totalUnitCount(&self) -> i64;
101
102        /// Setter for [`totalUnitCount`][Self::totalUnitCount].
103        #[unsafe(method(setTotalUnitCount:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn setTotalUnitCount(&self, total_unit_count: i64);
106
107        #[unsafe(method(completedUnitCount))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn completedUnitCount(&self) -> i64;
110
111        /// Setter for [`completedUnitCount`][Self::completedUnitCount].
112        #[unsafe(method(setCompletedUnitCount:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn setCompletedUnitCount(&self, completed_unit_count: i64);
115
116        #[cfg(feature = "NSString")]
117        #[unsafe(method(localizedDescription))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn localizedDescription(&self) -> Retained<NSString>;
120
121        #[cfg(feature = "NSString")]
122        /// Setter for [`localizedDescription`][Self::localizedDescription].
123        #[unsafe(method(setLocalizedDescription:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
126
127        #[cfg(feature = "NSString")]
128        #[unsafe(method(localizedAdditionalDescription))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn localizedAdditionalDescription(&self) -> Retained<NSString>;
131
132        #[cfg(feature = "NSString")]
133        /// Setter for [`localizedAdditionalDescription`][Self::localizedAdditionalDescription].
134        #[unsafe(method(setLocalizedAdditionalDescription:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn setLocalizedAdditionalDescription(
137            &self,
138            localized_additional_description: Option<&NSString>,
139        );
140
141        #[unsafe(method(isCancellable))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn isCancellable(&self) -> bool;
144
145        /// Setter for [`isCancellable`][Self::isCancellable].
146        #[unsafe(method(setCancellable:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn setCancellable(&self, cancellable: bool);
149
150        #[unsafe(method(isPausable))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn isPausable(&self) -> bool;
153
154        /// Setter for [`isPausable`][Self::isPausable].
155        #[unsafe(method(setPausable:))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn setPausable(&self, pausable: bool);
158
159        #[unsafe(method(isCancelled))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn isCancelled(&self) -> bool;
162
163        #[unsafe(method(isPaused))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn isPaused(&self) -> bool;
166
167        #[cfg(feature = "block2")]
168        #[unsafe(method(cancellationHandler))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn cancellationHandler(&self) -> *mut block2::Block<dyn Fn()>;
171
172        #[cfg(feature = "block2")]
173        /// Setter for [`cancellationHandler`][Self::cancellationHandler].
174        #[unsafe(method(setCancellationHandler:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn setCancellationHandler(
177            &self,
178            cancellation_handler: Option<&block2::Block<dyn Fn()>>,
179        );
180
181        #[cfg(feature = "block2")]
182        #[unsafe(method(pausingHandler))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn pausingHandler(&self) -> *mut block2::Block<dyn Fn()>;
185
186        #[cfg(feature = "block2")]
187        /// Setter for [`pausingHandler`][Self::pausingHandler].
188        #[unsafe(method(setPausingHandler:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn setPausingHandler(&self, pausing_handler: Option<&block2::Block<dyn Fn()>>);
191
192        #[cfg(feature = "block2")]
193        #[unsafe(method(resumingHandler))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn resumingHandler(&self) -> *mut block2::Block<dyn Fn()>;
196
197        #[cfg(feature = "block2")]
198        /// Setter for [`resumingHandler`][Self::resumingHandler].
199        #[unsafe(method(setResumingHandler:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn setResumingHandler(&self, resuming_handler: Option<&block2::Block<dyn Fn()>>);
202
203        #[cfg(feature = "NSString")]
204        #[unsafe(method(setUserInfoObject:forKey:))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn setUserInfoObject_forKey(
207            &self,
208            object_or_nil: Option<&AnyObject>,
209            key: &NSProgressUserInfoKey,
210        );
211
212        #[unsafe(method(isIndeterminate))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn isIndeterminate(&self) -> bool;
215
216        #[unsafe(method(fractionCompleted))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn fractionCompleted(&self) -> c_double;
219
220        #[unsafe(method(isFinished))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn isFinished(&self) -> bool;
223
224        #[unsafe(method(cancel))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn cancel(&self);
227
228        #[unsafe(method(pause))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn pause(&self);
231
232        #[unsafe(method(resume))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn resume(&self);
235
236        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
237        #[unsafe(method(userInfo))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn userInfo(&self) -> Retained<NSDictionary<NSProgressUserInfoKey, AnyObject>>;
240
241        #[cfg(feature = "NSString")]
242        #[unsafe(method(kind))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn kind(&self) -> Option<Retained<NSProgressKind>>;
245
246        #[cfg(feature = "NSString")]
247        /// Setter for [`kind`][Self::kind].
248        #[unsafe(method(setKind:))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn setKind(&self, kind: Option<&NSProgressKind>);
251
252        #[cfg(feature = "NSValue")]
253        #[unsafe(method(estimatedTimeRemaining))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn estimatedTimeRemaining(&self) -> Option<Retained<NSNumber>>;
256
257        #[cfg(feature = "NSValue")]
258        /// Setter for [`estimatedTimeRemaining`][Self::estimatedTimeRemaining].
259        #[unsafe(method(setEstimatedTimeRemaining:))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn setEstimatedTimeRemaining(&self, estimated_time_remaining: Option<&NSNumber>);
262
263        #[cfg(feature = "NSValue")]
264        #[unsafe(method(throughput))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn throughput(&self) -> Option<Retained<NSNumber>>;
267
268        #[cfg(feature = "NSValue")]
269        /// Setter for [`throughput`][Self::throughput].
270        #[unsafe(method(setThroughput:))]
271        #[unsafe(method_family = none)]
272        pub unsafe fn setThroughput(&self, throughput: Option<&NSNumber>);
273
274        #[cfg(feature = "NSString")]
275        #[unsafe(method(fileOperationKind))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn fileOperationKind(&self) -> Option<Retained<NSProgressFileOperationKind>>;
278
279        #[cfg(feature = "NSString")]
280        /// Setter for [`fileOperationKind`][Self::fileOperationKind].
281        #[unsafe(method(setFileOperationKind:))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn setFileOperationKind(
284            &self,
285            file_operation_kind: Option<&NSProgressFileOperationKind>,
286        );
287
288        #[cfg(feature = "NSURL")]
289        #[unsafe(method(fileURL))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn fileURL(&self) -> Option<Retained<NSURL>>;
292
293        #[cfg(feature = "NSURL")]
294        /// Setter for [`fileURL`][Self::fileURL].
295        #[unsafe(method(setFileURL:))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn setFileURL(&self, file_url: Option<&NSURL>);
298
299        #[cfg(feature = "NSValue")]
300        #[unsafe(method(fileTotalCount))]
301        #[unsafe(method_family = none)]
302        pub unsafe fn fileTotalCount(&self) -> Option<Retained<NSNumber>>;
303
304        #[cfg(feature = "NSValue")]
305        /// Setter for [`fileTotalCount`][Self::fileTotalCount].
306        #[unsafe(method(setFileTotalCount:))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn setFileTotalCount(&self, file_total_count: Option<&NSNumber>);
309
310        #[cfg(feature = "NSValue")]
311        #[unsafe(method(fileCompletedCount))]
312        #[unsafe(method_family = none)]
313        pub unsafe fn fileCompletedCount(&self) -> Option<Retained<NSNumber>>;
314
315        #[cfg(feature = "NSValue")]
316        /// Setter for [`fileCompletedCount`][Self::fileCompletedCount].
317        #[unsafe(method(setFileCompletedCount:))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn setFileCompletedCount(&self, file_completed_count: Option<&NSNumber>);
320
321        #[unsafe(method(publish))]
322        #[unsafe(method_family = none)]
323        pub unsafe fn publish(&self);
324
325        #[unsafe(method(unpublish))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn unpublish(&self);
328
329        #[cfg(all(feature = "NSURL", feature = "block2"))]
330        #[unsafe(method(addSubscriberForFileURL:withPublishingHandler:))]
331        #[unsafe(method_family = none)]
332        pub unsafe fn addSubscriberForFileURL_withPublishingHandler(
333            url: &NSURL,
334            publishing_handler: NSProgressPublishingHandler,
335        ) -> Retained<AnyObject>;
336
337        #[unsafe(method(removeSubscriber:))]
338        #[unsafe(method_family = none)]
339        pub unsafe fn removeSubscriber(subscriber: &AnyObject);
340
341        #[unsafe(method(isOld))]
342        #[unsafe(method_family = none)]
343        pub unsafe fn isOld(&self) -> bool;
344    );
345}
346
347/// Methods declared on superclass `NSObject`.
348impl NSProgress {
349    extern_methods!(
350        #[unsafe(method(init))]
351        #[unsafe(method_family = init)]
352        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
353
354        #[unsafe(method(new))]
355        #[unsafe(method_family = new)]
356        pub unsafe fn new() -> Retained<Self>;
357    );
358}
359
360extern_protocol!(
361    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressreporting?language=objc)
362    pub unsafe trait NSProgressReporting: NSObjectProtocol {
363        #[unsafe(method(progress))]
364        #[unsafe(method_family = none)]
365        unsafe fn progress(&self) -> Retained<NSProgress>;
366    }
367);
368
369extern "C" {
370    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressestimatedtimeremainingkey?language=objc)
371    #[cfg(feature = "NSString")]
372    pub static NSProgressEstimatedTimeRemainingKey: &'static NSProgressUserInfoKey;
373}
374
375extern "C" {
376    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressthroughputkey?language=objc)
377    #[cfg(feature = "NSString")]
378    pub static NSProgressThroughputKey: &'static NSProgressUserInfoKey;
379}
380
381extern "C" {
382    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogresskindfile?language=objc)
383    #[cfg(feature = "NSString")]
384    pub static NSProgressKindFile: &'static NSProgressKind;
385}
386
387extern "C" {
388    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfileoperationkindkey?language=objc)
389    #[cfg(feature = "NSString")]
390    pub static NSProgressFileOperationKindKey: &'static NSProgressUserInfoKey;
391}
392
393extern "C" {
394    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfileoperationkinddownloading?language=objc)
395    #[cfg(feature = "NSString")]
396    pub static NSProgressFileOperationKindDownloading: &'static NSProgressFileOperationKind;
397}
398
399extern "C" {
400    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfileoperationkinddecompressingafterdownloading?language=objc)
401    #[cfg(feature = "NSString")]
402    pub static NSProgressFileOperationKindDecompressingAfterDownloading:
403        &'static NSProgressFileOperationKind;
404}
405
406extern "C" {
407    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfileoperationkindreceiving?language=objc)
408    #[cfg(feature = "NSString")]
409    pub static NSProgressFileOperationKindReceiving: &'static NSProgressFileOperationKind;
410}
411
412extern "C" {
413    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfileoperationkindcopying?language=objc)
414    #[cfg(feature = "NSString")]
415    pub static NSProgressFileOperationKindCopying: &'static NSProgressFileOperationKind;
416}
417
418extern "C" {
419    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfileoperationkinduploading?language=objc)
420    #[cfg(feature = "NSString")]
421    pub static NSProgressFileOperationKindUploading: &'static NSProgressFileOperationKind;
422}
423
424extern "C" {
425    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfileoperationkindduplicating?language=objc)
426    #[cfg(feature = "NSString")]
427    pub static NSProgressFileOperationKindDuplicating: &'static NSProgressFileOperationKind;
428}
429
430extern "C" {
431    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfileurlkey?language=objc)
432    #[cfg(feature = "NSString")]
433    pub static NSProgressFileURLKey: &'static NSProgressUserInfoKey;
434}
435
436extern "C" {
437    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfiletotalcountkey?language=objc)
438    #[cfg(feature = "NSString")]
439    pub static NSProgressFileTotalCountKey: &'static NSProgressUserInfoKey;
440}
441
442extern "C" {
443    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfilecompletedcountkey?language=objc)
444    #[cfg(feature = "NSString")]
445    pub static NSProgressFileCompletedCountKey: &'static NSProgressUserInfoKey;
446}
447
448extern "C" {
449    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfileanimationimagekey?language=objc)
450    #[cfg(feature = "NSString")]
451    pub static NSProgressFileAnimationImageKey: &'static NSProgressUserInfoKey;
452}
453
454extern "C" {
455    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfileanimationimageoriginalrectkey?language=objc)
456    #[cfg(feature = "NSString")]
457    pub static NSProgressFileAnimationImageOriginalRectKey: &'static NSProgressUserInfoKey;
458}
459
460extern "C" {
461    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsprogressfileiconkey?language=objc)
462    #[cfg(feature = "NSString")]
463    pub static NSProgressFileIconKey: &'static NSProgressUserInfoKey;
464}