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