objc2_quartz/generated/ImageKit/
IKCameraDeviceView.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_app_kit::*;
7use objc2_foundation::*;
8#[cfg(feature = "objc2-image-capture-core")]
9use objc2_image_capture_core::*;
10
11use crate::*;
12
13extern_protocol!(
14    /// A delegate of IKCameraDeviceView must conform to IKCameraDeviceViewDelegate protocol.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/quartz/ikcameradeviceviewdelegate?language=objc)
17    pub unsafe trait IKCameraDeviceViewDelegate {
18        /// This message is sent when the user selection did change.
19        ///
20        /// # Safety
21        ///
22        /// `camera_device_view` might not allow `None`.
23        #[optional]
24        #[unsafe(method(cameraDeviceViewSelectionDidChange:))]
25        #[unsafe(method_family = none)]
26        unsafe fn cameraDeviceViewSelectionDidChange(
27            &self,
28            camera_device_view: Option<&IKCameraDeviceView>,
29        );
30
31        #[cfg(feature = "objc2-image-capture-core")]
32        /// This message is sent for each file that gets downloaded.
33        ///
34        /// Based on the IKCameraDeviceViewDisplayMode the downloaded file will be saved on disk using the 'url', or returned in memory as NSData
35        ///
36        /// # Safety
37        ///
38        /// - `camera_device_view` might not allow `None`.
39        /// - `file` might not allow `None`.
40        /// - `url` might not allow `None`.
41        /// - `data` might not allow `None`.
42        /// - `error` might not allow `None`.
43        #[optional]
44        #[unsafe(method(cameraDeviceView:didDownloadFile:location:fileData:error:))]
45        #[unsafe(method_family = none)]
46        unsafe fn cameraDeviceView_didDownloadFile_location_fileData_error(
47            &self,
48            camera_device_view: Option<&IKCameraDeviceView>,
49            file: Option<&ICCameraFile>,
50            url: Option<&NSURL>,
51            data: Option<&NSData>,
52            error: Option<&NSError>,
53        );
54
55        /// This message is sent every time the camera device reports an error.
56        ///
57        /// # Safety
58        ///
59        /// - `camera_device_view` might not allow `None`.
60        /// - `error` might not allow `None`.
61        #[optional]
62        #[unsafe(method(cameraDeviceView:didEncounterError:))]
63        #[unsafe(method_family = none)]
64        unsafe fn cameraDeviceView_didEncounterError(
65            &self,
66            camera_device_view: Option<&IKCameraDeviceView>,
67            error: Option<&NSError>,
68        );
69    }
70);
71
72/// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikcameradeviceviewdisplaymode?language=objc)
73// NS_CLOSED_ENUM
74#[repr(isize)] // NSInteger
75#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
76pub enum IKCameraDeviceViewDisplayMode {
77    #[doc(alias = "IKCameraDeviceViewDisplayModeNone")]
78    None = -1,
79    #[doc(alias = "IKCameraDeviceViewDisplayModeTable")]
80    Table = 0,
81    #[doc(alias = "IKCameraDeviceViewDisplayModeIcon")]
82    Icon = 1,
83}
84
85unsafe impl Encode for IKCameraDeviceViewDisplayMode {
86    const ENCODING: Encoding = NSInteger::ENCODING;
87}
88
89unsafe impl RefEncode for IKCameraDeviceViewDisplayMode {
90    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
91}
92
93/// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikcameradeviceviewtransfermode?language=objc)
94// NS_CLOSED_ENUM
95#[repr(isize)] // NSInteger
96#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
97pub enum IKCameraDeviceViewTransferMode {
98    #[doc(alias = "IKCameraDeviceViewTransferModeFileBased")]
99    FileBased = 0,
100    #[doc(alias = "IKCameraDeviceViewTransferModeMemoryBased")]
101    MemoryBased = 1,
102}
103
104unsafe impl Encode for IKCameraDeviceViewTransferMode {
105    const ENCODING: Encoding = NSInteger::ENCODING;
106}
107
108unsafe impl RefEncode for IKCameraDeviceViewTransferMode {
109    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
110}
111
112extern_class!(
113    /// IKCameraDeviceView displays content of a Image Capture supported camera.
114    ///
115    /// See also [Apple's documentation](https://developer.apple.com/documentation/quartz/ikcameradeviceview?language=objc)
116    #[unsafe(super(NSView, NSResponder, NSObject))]
117    #[derive(Debug, PartialEq, Eq, Hash)]
118    pub struct IKCameraDeviceView;
119);
120
121extern_conformance!(
122    unsafe impl NSAccessibility for IKCameraDeviceView {}
123);
124
125extern_conformance!(
126    unsafe impl NSAccessibilityElementProtocol for IKCameraDeviceView {}
127);
128
129extern_conformance!(
130    unsafe impl NSAnimatablePropertyContainer for IKCameraDeviceView {}
131);
132
133extern_conformance!(
134    unsafe impl NSAppearanceCustomization for IKCameraDeviceView {}
135);
136
137extern_conformance!(
138    unsafe impl NSCoding for IKCameraDeviceView {}
139);
140
141extern_conformance!(
142    unsafe impl NSDraggingDestination for IKCameraDeviceView {}
143);
144
145extern_conformance!(
146    unsafe impl NSObjectProtocol for IKCameraDeviceView {}
147);
148
149extern_conformance!(
150    unsafe impl NSUserInterfaceItemIdentification for IKCameraDeviceView {}
151);
152
153impl IKCameraDeviceView {
154    extern_methods!(
155        /// Delegate of the IKCameraDeviceView.
156        ///
157        /// # Safety
158        ///
159        /// This is not retained internally, you must ensure the object is still alive.
160        #[unsafe(method(delegate))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn delegate(
163            &self,
164        ) -> Option<Retained<ProtocolObject<dyn IKCameraDeviceViewDelegate>>>;
165
166        /// Setter for [`delegate`][Self::delegate].
167        ///
168        /// # Safety
169        ///
170        /// - `delegate` might not allow `None`.
171        /// - This is unretained, you must ensure the object is kept alive while in use.
172        #[unsafe(method(setDelegate:))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn setDelegate(
175            &self,
176            delegate: Option<&ProtocolObject<dyn IKCameraDeviceViewDelegate>>,
177        );
178
179        #[cfg(feature = "objc2-image-capture-core")]
180        /// the camera device.
181        ///
182        /// # Safety
183        ///
184        /// This is not retained internally, you must ensure the object is still alive.
185        #[unsafe(method(cameraDevice))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn cameraDevice(&self) -> Option<Retained<ICCameraDevice>>;
188
189        #[cfg(feature = "objc2-image-capture-core")]
190        /// Setter for [`cameraDevice`][Self::cameraDevice].
191        ///
192        /// # Safety
193        ///
194        /// - `camera_device` might not allow `None`.
195        /// - This is unretained, you must ensure the object is kept alive while in use.
196        #[unsafe(method(setCameraDevice:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn setCameraDevice(&self, camera_device: Option<&ICCameraDevice>);
199
200        /// current display mode.
201        #[unsafe(method(mode))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn mode(&self) -> IKCameraDeviceViewDisplayMode;
204
205        /// Setter for [`mode`][Self::mode].
206        #[unsafe(method(setMode:))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn setMode(&self, mode: IKCameraDeviceViewDisplayMode);
209
210        /// support table view display mode.
211        #[unsafe(method(hasDisplayModeTable))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn hasDisplayModeTable(&self) -> bool;
214
215        /// Setter for [`hasDisplayModeTable`][Self::hasDisplayModeTable].
216        #[unsafe(method(setHasDisplayModeTable:))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn setHasDisplayModeTable(&self, has_display_mode_table: bool);
219
220        /// support icon view display mode.
221        #[unsafe(method(hasDisplayModeIcon))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn hasDisplayModeIcon(&self) -> bool;
224
225        /// Setter for [`hasDisplayModeIcon`][Self::hasDisplayModeIcon].
226        #[unsafe(method(setHasDisplayModeIcon:))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn setHasDisplayModeIcon(&self, has_display_mode_icon: bool);
229
230        /// label for the 'Download All' control - allows for example renaming to 'Import All'.
231        #[unsafe(method(downloadAllControlLabel))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn downloadAllControlLabel(&self) -> Retained<NSString>;
234
235        /// Setter for [`downloadAllControlLabel`][Self::downloadAllControlLabel].
236        ///
237        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
238        #[unsafe(method(setDownloadAllControlLabel:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn setDownloadAllControlLabel(
241            &self,
242            download_all_control_label: Option<&NSString>,
243        );
244
245        /// label for the 'Download Selected' control.
246        #[unsafe(method(downloadSelectedControlLabel))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn downloadSelectedControlLabel(&self) -> Retained<NSString>;
249
250        /// Setter for [`downloadSelectedControlLabel`][Self::downloadSelectedControlLabel].
251        ///
252        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
253        #[unsafe(method(setDownloadSelectedControlLabel:))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn setDownloadSelectedControlLabel(
256            &self,
257            download_selected_control_label: Option<&NSString>,
258        );
259
260        /// in icon mode: size of the image thumbnails.
261        #[unsafe(method(iconSize))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn iconSize(&self) -> NSUInteger;
264
265        /// Setter for [`iconSize`][Self::iconSize].
266        #[unsafe(method(setIconSize:))]
267        #[unsafe(method_family = none)]
268        pub unsafe fn setIconSize(&self, icon_size: NSUInteger);
269
270        /// transfer mode either file based - or - in memory.
271        #[unsafe(method(transferMode))]
272        #[unsafe(method_family = none)]
273        pub unsafe fn transferMode(&self) -> IKCameraDeviceViewTransferMode;
274
275        /// Setter for [`transferMode`][Self::transferMode].
276        #[unsafe(method(setTransferMode:))]
277        #[unsafe(method_family = none)]
278        pub unsafe fn setTransferMode(&self, transfer_mode: IKCameraDeviceViewTransferMode);
279
280        /// show a downloads directory control.
281        #[unsafe(method(displaysDownloadsDirectoryControl))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn displaysDownloadsDirectoryControl(&self) -> bool;
284
285        /// Setter for [`displaysDownloadsDirectoryControl`][Self::displaysDownloadsDirectoryControl].
286        #[unsafe(method(setDisplaysDownloadsDirectoryControl:))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn setDisplaysDownloadsDirectoryControl(
289            &self,
290            displays_downloads_directory_control: bool,
291        );
292
293        /// downloads directory.
294        #[unsafe(method(downloadsDirectory))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn downloadsDirectory(&self) -> Option<Retained<NSURL>>;
297
298        /// Setter for [`downloadsDirectory`][Self::downloadsDirectory].
299        ///
300        /// # Safety
301        ///
302        /// `downloads_directory` might not allow `None`.
303        #[unsafe(method(setDownloadsDirectory:))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn setDownloadsDirectory(&self, downloads_directory: Option<&NSURL>);
306
307        /// show a postprocessing application control.
308        #[unsafe(method(displaysPostProcessApplicationControl))]
309        #[unsafe(method_family = none)]
310        pub unsafe fn displaysPostProcessApplicationControl(&self) -> bool;
311
312        /// Setter for [`displaysPostProcessApplicationControl`][Self::displaysPostProcessApplicationControl].
313        #[unsafe(method(setDisplaysPostProcessApplicationControl:))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn setDisplaysPostProcessApplicationControl(
316            &self,
317            displays_post_process_application_control: bool,
318        );
319
320        /// postprocessing application.
321        #[unsafe(method(postProcessApplication))]
322        #[unsafe(method_family = none)]
323        pub unsafe fn postProcessApplication(&self) -> Option<Retained<NSURL>>;
324
325        /// Setter for [`postProcessApplication`][Self::postProcessApplication].
326        ///
327        /// # Safety
328        ///
329        /// `post_process_application` might not allow `None`.
330        #[unsafe(method(setPostProcessApplication:))]
331        #[unsafe(method_family = none)]
332        pub unsafe fn setPostProcessApplication(&self, post_process_application: Option<&NSURL>);
333
334        /// indicates if the user selected items can be rotated left.
335        #[unsafe(method(canRotateSelectedItemsLeft))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn canRotateSelectedItemsLeft(&self) -> bool;
338
339        /// indicates if the user selected items can be rotated right.
340        #[unsafe(method(canRotateSelectedItemsRight))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn canRotateSelectedItemsRight(&self) -> bool;
343
344        /// indicates if the user selected items can be deleted.
345        #[unsafe(method(canDeleteSelectedItems))]
346        #[unsafe(method_family = none)]
347        pub unsafe fn canDeleteSelectedItems(&self) -> bool;
348
349        /// indicates if the user selected items can be downloaded.
350        #[unsafe(method(canDownloadSelectedItems))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn canDownloadSelectedItems(&self) -> bool;
353
354        /// current user selection.
355        #[unsafe(method(selectedIndexes))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn selectedIndexes(&self) -> Option<Retained<NSIndexSet>>;
358
359        /// setting current user selection.
360        ///
361        /// # Safety
362        ///
363        /// `indexes` might not allow `None`.
364        #[unsafe(method(selectIndexes:byExtendingSelection:))]
365        #[unsafe(method_family = none)]
366        pub unsafe fn selectIndexes_byExtendingSelection(
367            &self,
368            indexes: Option<&NSIndexSet>,
369            extend: bool,
370        );
371
372        /// rotate selected items left.
373        ///
374        /// # Safety
375        ///
376        /// - `sender` should be of the correct type.
377        /// - `sender` might not allow `None`.
378        #[unsafe(method(rotateLeft:))]
379        #[unsafe(method_family = none)]
380        pub unsafe fn rotateLeft(&self, sender: Option<&AnyObject>);
381
382        /// rotate selected items right.
383        ///
384        /// # Safety
385        ///
386        /// - `sender` should be of the correct type.
387        /// - `sender` might not allow `None`.
388        #[unsafe(method(rotateRight:))]
389        #[unsafe(method_family = none)]
390        pub unsafe fn rotateRight(&self, sender: Option<&AnyObject>);
391
392        /// delete selected items.
393        ///
394        /// # Safety
395        ///
396        /// - `sender` should be of the correct type.
397        /// - `sender` might not allow `None`.
398        #[unsafe(method(deleteSelectedItems:))]
399        #[unsafe(method_family = none)]
400        pub unsafe fn deleteSelectedItems(&self, sender: Option<&AnyObject>);
401
402        /// download selected items.
403        ///
404        /// # Safety
405        ///
406        /// - `sender` should be of the correct type.
407        /// - `sender` might not allow `None`.
408        #[unsafe(method(downloadSelectedItems:))]
409        #[unsafe(method_family = none)]
410        pub unsafe fn downloadSelectedItems(&self, sender: Option<&AnyObject>);
411
412        /// download all items.
413        ///
414        /// # Safety
415        ///
416        /// - `sender` should be of the correct type.
417        /// - `sender` might not allow `None`.
418        #[unsafe(method(downloadAllItems:))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn downloadAllItems(&self, sender: Option<&AnyObject>);
421
422        /// provide your own NSSlider to resize item thumbnails
423        ///
424        /// # Safety
425        ///
426        /// `slider` might not allow `None`.
427        #[unsafe(method(setCustomIconSizeSlider:))]
428        #[unsafe(method_family = none)]
429        pub unsafe fn setCustomIconSizeSlider(&self, slider: Option<&NSSlider>);
430
431        /// provide your own control to toggle between IKCameraDeviceViewDisplayMode table / icon
432        ///
433        /// # Safety
434        ///
435        /// `control` might not allow `None`.
436        #[unsafe(method(setCustomModeControl:))]
437        #[unsafe(method_family = none)]
438        pub unsafe fn setCustomModeControl(&self, control: Option<&NSSegmentedControl>);
439
440        /// provide your own control to toggle between IKCameraDeviceViewDisplayMode table / icon
441        ///
442        /// # Safety
443        ///
444        /// `control` might not allow `None`.
445        #[unsafe(method(setCustomActionControl:))]
446        #[unsafe(method_family = none)]
447        pub unsafe fn setCustomActionControl(&self, control: Option<&NSSegmentedControl>);
448
449        /// provide your own control to rotate items (multiple of 90ยบ)
450        ///
451        /// # Safety
452        ///
453        /// `control` might not allow `None`.
454        #[unsafe(method(setCustomRotateControl:))]
455        #[unsafe(method_family = none)]
456        pub unsafe fn setCustomRotateControl(&self, control: Option<&NSSegmentedControl>);
457
458        /// provide your own control to delete selected items
459        ///
460        /// # Safety
461        ///
462        /// `control` might not allow `None`.
463        #[unsafe(method(setCustomDeleteControl:))]
464        #[unsafe(method_family = none)]
465        pub unsafe fn setCustomDeleteControl(&self, control: Option<&NSSegmentedControl>);
466
467        /// display status info as window subtitle
468        #[unsafe(method(setShowStatusInfoAsWindowSubtitle:))]
469        #[unsafe(method_family = none)]
470        pub unsafe fn setShowStatusInfoAsWindowSubtitle(&self, value: bool);
471    );
472}
473
474/// Methods declared on superclass `NSView`.
475impl IKCameraDeviceView {
476    extern_methods!(
477        #[unsafe(method(initWithFrame:))]
478        #[unsafe(method_family = init)]
479        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
480
481        /// # Safety
482        ///
483        /// `coder` possibly has further requirements.
484        #[unsafe(method(initWithCoder:))]
485        #[unsafe(method_family = init)]
486        pub unsafe fn initWithCoder(
487            this: Allocated<Self>,
488            coder: &NSCoder,
489        ) -> Option<Retained<Self>>;
490    );
491}
492
493/// Methods declared on superclass `NSResponder`.
494impl IKCameraDeviceView {
495    extern_methods!(
496        #[unsafe(method(init))]
497        #[unsafe(method_family = init)]
498        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
499    );
500}
501
502/// Methods declared on superclass `NSObject`.
503impl IKCameraDeviceView {
504    extern_methods!(
505        #[unsafe(method(new))]
506        #[unsafe(method_family = new)]
507        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
508    );
509}