objc2_foundation/generated/
NSProgress.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[cfg(feature = "NSString")]
12pub type NSProgressKind = NSString;
13
14#[cfg(feature = "NSString")]
17pub type NSProgressUserInfoKey = NSString;
18
19#[cfg(feature = "NSString")]
22pub type NSProgressFileOperationKind = NSString;
23
24#[cfg(feature = "block2")]
26pub type NSProgressUnpublishingHandler = *mut block2::DynBlock<dyn Fn()>;
27
28#[cfg(feature = "block2")]
30pub type NSProgressPublishingHandler =
31 *mut block2::DynBlock<dyn Fn(NonNull<NSProgress>) -> NSProgressUnpublishingHandler>;
32
33extern_class!(
34 #[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 fn currentProgress() -> Option<Retained<NSProgress>>;
53
54 #[unsafe(method(progressWithTotalUnitCount:))]
55 #[unsafe(method_family = none)]
56 pub fn progressWithTotalUnitCount(unit_count: i64) -> Retained<NSProgress>;
57
58 #[unsafe(method(discreteProgressWithTotalUnitCount:))]
59 #[unsafe(method_family = none)]
60 pub fn discreteProgressWithTotalUnitCount(unit_count: i64) -> Retained<NSProgress>;
61
62 #[unsafe(method(progressWithTotalUnitCount:parent:pendingUnitCount:))]
63 #[unsafe(method_family = none)]
64 pub 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:))]
75 #[unsafe(method_family = init)]
76 pub unsafe fn initWithParent_userInfo(
77 this: Allocated<Self>,
78 parent_progress_or_nil: Option<&NSProgress>,
79 user_info_or_nil: Option<&NSDictionary<NSProgressUserInfoKey, AnyObject>>,
80 ) -> Retained<Self>;
81
82 #[unsafe(method(becomeCurrentWithPendingUnitCount:))]
83 #[unsafe(method_family = none)]
84 pub fn becomeCurrentWithPendingUnitCount(&self, unit_count: i64);
85
86 #[cfg(feature = "block2")]
87 #[unsafe(method(performAsCurrentWithPendingUnitCount:usingBlock:))]
88 #[unsafe(method_family = none)]
89 pub fn performAsCurrentWithPendingUnitCount_usingBlock(
90 &self,
91 unit_count: i64,
92 work: &block2::DynBlock<dyn Fn() + '_>,
93 );
94
95 #[unsafe(method(resignCurrent))]
96 #[unsafe(method_family = none)]
97 pub fn resignCurrent(&self);
98
99 #[unsafe(method(addChild:withPendingUnitCount:))]
100 #[unsafe(method_family = none)]
101 pub fn addChild_withPendingUnitCount(&self, child: &NSProgress, in_unit_count: i64);
102
103 #[unsafe(method(totalUnitCount))]
104 #[unsafe(method_family = none)]
105 pub fn totalUnitCount(&self) -> i64;
106
107 #[unsafe(method(setTotalUnitCount:))]
109 #[unsafe(method_family = none)]
110 pub fn setTotalUnitCount(&self, total_unit_count: i64);
111
112 #[unsafe(method(completedUnitCount))]
113 #[unsafe(method_family = none)]
114 pub fn completedUnitCount(&self) -> i64;
115
116 #[unsafe(method(setCompletedUnitCount:))]
118 #[unsafe(method_family = none)]
119 pub fn setCompletedUnitCount(&self, completed_unit_count: i64);
120
121 #[cfg(feature = "NSString")]
122 #[unsafe(method(localizedDescription))]
123 #[unsafe(method_family = none)]
124 pub fn localizedDescription(&self) -> Retained<NSString>;
125
126 #[cfg(feature = "NSString")]
127 #[unsafe(method(setLocalizedDescription:))]
131 #[unsafe(method_family = none)]
132 pub fn setLocalizedDescription(&self, localized_description: Option<&NSString>);
133
134 #[cfg(feature = "NSString")]
135 #[unsafe(method(localizedAdditionalDescription))]
136 #[unsafe(method_family = none)]
137 pub fn localizedAdditionalDescription(&self) -> Retained<NSString>;
138
139 #[cfg(feature = "NSString")]
140 #[unsafe(method(setLocalizedAdditionalDescription:))]
144 #[unsafe(method_family = none)]
145 pub fn setLocalizedAdditionalDescription(
146 &self,
147 localized_additional_description: Option<&NSString>,
148 );
149
150 #[unsafe(method(isCancellable))]
151 #[unsafe(method_family = none)]
152 pub fn isCancellable(&self) -> bool;
153
154 #[unsafe(method(setCancellable:))]
156 #[unsafe(method_family = none)]
157 pub fn setCancellable(&self, cancellable: bool);
158
159 #[unsafe(method(isPausable))]
160 #[unsafe(method_family = none)]
161 pub fn isPausable(&self) -> bool;
162
163 #[unsafe(method(setPausable:))]
165 #[unsafe(method_family = none)]
166 pub fn setPausable(&self, pausable: bool);
167
168 #[unsafe(method(isCancelled))]
169 #[unsafe(method_family = none)]
170 pub fn isCancelled(&self) -> bool;
171
172 #[unsafe(method(isPaused))]
173 #[unsafe(method_family = none)]
174 pub fn isPaused(&self) -> bool;
175
176 #[cfg(feature = "block2")]
177 #[unsafe(method(cancellationHandler))]
181 #[unsafe(method_family = none)]
182 pub unsafe fn cancellationHandler(&self) -> *mut block2::DynBlock<dyn Fn()>;
183
184 #[cfg(feature = "block2")]
185 #[unsafe(method(setCancellationHandler:))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn setCancellationHandler(
195 &self,
196 cancellation_handler: Option<&block2::DynBlock<dyn Fn()>>,
197 );
198
199 #[cfg(feature = "block2")]
200 #[unsafe(method(pausingHandler))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn pausingHandler(&self) -> *mut block2::DynBlock<dyn Fn()>;
206
207 #[cfg(feature = "block2")]
208 #[unsafe(method(setPausingHandler:))]
216 #[unsafe(method_family = none)]
217 pub unsafe fn setPausingHandler(
218 &self,
219 pausing_handler: Option<&block2::DynBlock<dyn Fn()>>,
220 );
221
222 #[cfg(feature = "block2")]
223 #[unsafe(method(resumingHandler))]
227 #[unsafe(method_family = none)]
228 pub unsafe fn resumingHandler(&self) -> *mut block2::DynBlock<dyn Fn()>;
229
230 #[cfg(feature = "block2")]
231 #[unsafe(method(setResumingHandler:))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn setResumingHandler(
241 &self,
242 resuming_handler: Option<&block2::DynBlock<dyn Fn()>>,
243 );
244
245 #[cfg(feature = "NSString")]
246 #[unsafe(method(setUserInfoObject:forKey:))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn setUserInfoObject_forKey(
252 &self,
253 object_or_nil: Option<&AnyObject>,
254 key: &NSProgressUserInfoKey,
255 );
256
257 #[unsafe(method(isIndeterminate))]
258 #[unsafe(method_family = none)]
259 pub fn isIndeterminate(&self) -> bool;
260
261 #[unsafe(method(fractionCompleted))]
262 #[unsafe(method_family = none)]
263 pub fn fractionCompleted(&self) -> c_double;
264
265 #[unsafe(method(isFinished))]
266 #[unsafe(method_family = none)]
267 pub fn isFinished(&self) -> bool;
268
269 #[unsafe(method(cancel))]
270 #[unsafe(method_family = none)]
271 pub fn cancel(&self);
272
273 #[unsafe(method(pause))]
274 #[unsafe(method_family = none)]
275 pub fn pause(&self);
276
277 #[unsafe(method(resume))]
278 #[unsafe(method_family = none)]
279 pub fn resume(&self);
280
281 #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
282 #[unsafe(method(userInfo))]
283 #[unsafe(method_family = none)]
284 pub fn userInfo(&self) -> Retained<NSDictionary<NSProgressUserInfoKey, AnyObject>>;
285
286 #[cfg(feature = "NSString")]
287 #[unsafe(method(kind))]
288 #[unsafe(method_family = none)]
289 pub fn kind(&self) -> Option<Retained<NSProgressKind>>;
290
291 #[cfg(feature = "NSString")]
292 #[unsafe(method(setKind:))]
296 #[unsafe(method_family = none)]
297 pub fn setKind(&self, kind: Option<&NSProgressKind>);
298
299 #[cfg(feature = "NSValue")]
300 #[unsafe(method(estimatedTimeRemaining))]
301 #[unsafe(method_family = none)]
302 pub fn estimatedTimeRemaining(&self) -> Option<Retained<NSNumber>>;
303
304 #[cfg(feature = "NSValue")]
305 #[unsafe(method(setEstimatedTimeRemaining:))]
309 #[unsafe(method_family = none)]
310 pub fn setEstimatedTimeRemaining(&self, estimated_time_remaining: Option<&NSNumber>);
311
312 #[cfg(feature = "NSValue")]
313 #[unsafe(method(throughput))]
314 #[unsafe(method_family = none)]
315 pub fn throughput(&self) -> Option<Retained<NSNumber>>;
316
317 #[cfg(feature = "NSValue")]
318 #[unsafe(method(setThroughput:))]
322 #[unsafe(method_family = none)]
323 pub fn setThroughput(&self, throughput: Option<&NSNumber>);
324
325 #[cfg(feature = "NSString")]
326 #[unsafe(method(fileOperationKind))]
327 #[unsafe(method_family = none)]
328 pub fn fileOperationKind(&self) -> Option<Retained<NSProgressFileOperationKind>>;
329
330 #[cfg(feature = "NSString")]
331 #[unsafe(method(setFileOperationKind:))]
335 #[unsafe(method_family = none)]
336 pub fn setFileOperationKind(
337 &self,
338 file_operation_kind: Option<&NSProgressFileOperationKind>,
339 );
340
341 #[cfg(feature = "NSURL")]
342 #[unsafe(method(fileURL))]
343 #[unsafe(method_family = none)]
344 pub fn fileURL(&self) -> Option<Retained<NSURL>>;
345
346 #[cfg(feature = "NSURL")]
347 #[unsafe(method(setFileURL:))]
351 #[unsafe(method_family = none)]
352 pub fn setFileURL(&self, file_url: Option<&NSURL>);
353
354 #[cfg(feature = "NSValue")]
355 #[unsafe(method(fileTotalCount))]
356 #[unsafe(method_family = none)]
357 pub fn fileTotalCount(&self) -> Option<Retained<NSNumber>>;
358
359 #[cfg(feature = "NSValue")]
360 #[unsafe(method(setFileTotalCount:))]
364 #[unsafe(method_family = none)]
365 pub fn setFileTotalCount(&self, file_total_count: Option<&NSNumber>);
366
367 #[cfg(feature = "NSValue")]
368 #[unsafe(method(fileCompletedCount))]
369 #[unsafe(method_family = none)]
370 pub fn fileCompletedCount(&self) -> Option<Retained<NSNumber>>;
371
372 #[cfg(feature = "NSValue")]
373 #[unsafe(method(setFileCompletedCount:))]
377 #[unsafe(method_family = none)]
378 pub fn setFileCompletedCount(&self, file_completed_count: Option<&NSNumber>);
379
380 #[unsafe(method(publish))]
381 #[unsafe(method_family = none)]
382 pub fn publish(&self);
383
384 #[unsafe(method(unpublish))]
385 #[unsafe(method_family = none)]
386 pub fn unpublish(&self);
387
388 #[cfg(all(feature = "NSURL", feature = "block2"))]
389 #[unsafe(method(addSubscriberForFileURL:withPublishingHandler:))]
393 #[unsafe(method_family = none)]
394 pub unsafe fn addSubscriberForFileURL_withPublishingHandler(
395 url: &NSURL,
396 publishing_handler: NSProgressPublishingHandler,
397 ) -> Retained<AnyObject>;
398
399 #[unsafe(method(removeSubscriber:))]
403 #[unsafe(method_family = none)]
404 pub unsafe fn removeSubscriber(subscriber: &AnyObject);
405
406 #[unsafe(method(isOld))]
407 #[unsafe(method_family = none)]
408 pub fn isOld(&self) -> bool;
409 );
410}
411
412impl NSProgress {
414 extern_methods!(
415 #[unsafe(method(init))]
416 #[unsafe(method_family = init)]
417 pub fn init(this: Allocated<Self>) -> Retained<Self>;
418
419 #[unsafe(method(new))]
420 #[unsafe(method_family = new)]
421 pub fn new() -> Retained<Self>;
422 );
423}
424
425impl DefaultRetained for NSProgress {
426 #[inline]
427 fn default_retained() -> Retained<Self> {
428 Self::new()
429 }
430}
431
432extern_protocol!(
433 pub unsafe trait NSProgressReporting: NSObjectProtocol {
435 #[unsafe(method(progress))]
436 #[unsafe(method_family = none)]
437 fn progress(&self) -> Retained<NSProgress>;
438 }
439);
440
441extern "C" {
442 #[cfg(feature = "NSString")]
444 pub static NSProgressEstimatedTimeRemainingKey: &'static NSProgressUserInfoKey;
445}
446
447extern "C" {
448 #[cfg(feature = "NSString")]
450 pub static NSProgressThroughputKey: &'static NSProgressUserInfoKey;
451}
452
453extern "C" {
454 #[cfg(feature = "NSString")]
456 pub static NSProgressKindFile: &'static NSProgressKind;
457}
458
459extern "C" {
460 #[cfg(feature = "NSString")]
462 pub static NSProgressFileOperationKindKey: &'static NSProgressUserInfoKey;
463}
464
465extern "C" {
466 #[cfg(feature = "NSString")]
468 pub static NSProgressFileOperationKindDownloading: &'static NSProgressFileOperationKind;
469}
470
471extern "C" {
472 #[cfg(feature = "NSString")]
474 pub static NSProgressFileOperationKindDecompressingAfterDownloading:
475 &'static NSProgressFileOperationKind;
476}
477
478extern "C" {
479 #[cfg(feature = "NSString")]
481 pub static NSProgressFileOperationKindReceiving: &'static NSProgressFileOperationKind;
482}
483
484extern "C" {
485 #[cfg(feature = "NSString")]
487 pub static NSProgressFileOperationKindCopying: &'static NSProgressFileOperationKind;
488}
489
490extern "C" {
491 #[cfg(feature = "NSString")]
493 pub static NSProgressFileOperationKindUploading: &'static NSProgressFileOperationKind;
494}
495
496extern "C" {
497 #[cfg(feature = "NSString")]
499 pub static NSProgressFileOperationKindDuplicating: &'static NSProgressFileOperationKind;
500}
501
502extern "C" {
503 #[cfg(feature = "NSString")]
505 pub static NSProgressFileURLKey: &'static NSProgressUserInfoKey;
506}
507
508extern "C" {
509 #[cfg(feature = "NSString")]
511 pub static NSProgressFileTotalCountKey: &'static NSProgressUserInfoKey;
512}
513
514extern "C" {
515 #[cfg(feature = "NSString")]
517 pub static NSProgressFileCompletedCountKey: &'static NSProgressUserInfoKey;
518}
519
520extern "C" {
521 #[cfg(feature = "NSString")]
523 pub static NSProgressFileAnimationImageKey: &'static NSProgressUserInfoKey;
524}
525
526extern "C" {
527 #[cfg(feature = "NSString")]
529 pub static NSProgressFileAnimationImageOriginalRectKey: &'static NSProgressUserInfoKey;
530}
531
532extern "C" {
533 #[cfg(feature = "NSString")]
535 pub static NSProgressFileIconKey: &'static NSProgressUserInfoKey;
536}