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 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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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 #[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
355impl 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 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 #[cfg(feature = "NSString")]
380 pub static NSProgressEstimatedTimeRemainingKey: &'static NSProgressUserInfoKey;
381}
382
383extern "C" {
384 #[cfg(feature = "NSString")]
386 pub static NSProgressThroughputKey: &'static NSProgressUserInfoKey;
387}
388
389extern "C" {
390 #[cfg(feature = "NSString")]
392 pub static NSProgressKindFile: &'static NSProgressKind;
393}
394
395extern "C" {
396 #[cfg(feature = "NSString")]
398 pub static NSProgressFileOperationKindKey: &'static NSProgressUserInfoKey;
399}
400
401extern "C" {
402 #[cfg(feature = "NSString")]
404 pub static NSProgressFileOperationKindDownloading: &'static NSProgressFileOperationKind;
405}
406
407extern "C" {
408 #[cfg(feature = "NSString")]
410 pub static NSProgressFileOperationKindDecompressingAfterDownloading:
411 &'static NSProgressFileOperationKind;
412}
413
414extern "C" {
415 #[cfg(feature = "NSString")]
417 pub static NSProgressFileOperationKindReceiving: &'static NSProgressFileOperationKind;
418}
419
420extern "C" {
421 #[cfg(feature = "NSString")]
423 pub static NSProgressFileOperationKindCopying: &'static NSProgressFileOperationKind;
424}
425
426extern "C" {
427 #[cfg(feature = "NSString")]
429 pub static NSProgressFileOperationKindUploading: &'static NSProgressFileOperationKind;
430}
431
432extern "C" {
433 #[cfg(feature = "NSString")]
435 pub static NSProgressFileOperationKindDuplicating: &'static NSProgressFileOperationKind;
436}
437
438extern "C" {
439 #[cfg(feature = "NSString")]
441 pub static NSProgressFileURLKey: &'static NSProgressUserInfoKey;
442}
443
444extern "C" {
445 #[cfg(feature = "NSString")]
447 pub static NSProgressFileTotalCountKey: &'static NSProgressUserInfoKey;
448}
449
450extern "C" {
451 #[cfg(feature = "NSString")]
453 pub static NSProgressFileCompletedCountKey: &'static NSProgressUserInfoKey;
454}
455
456extern "C" {
457 #[cfg(feature = "NSString")]
459 pub static NSProgressFileAnimationImageKey: &'static NSProgressUserInfoKey;
460}
461
462extern "C" {
463 #[cfg(feature = "NSString")]
465 pub static NSProgressFileAnimationImageOriginalRectKey: &'static NSProgressUserInfoKey;
466}
467
468extern "C" {
469 #[cfg(feature = "NSString")]
471 pub static NSProgressFileIconKey: &'static NSProgressUserInfoKey;
472}