objc2_quartz/generated/ImageKit/IKPictureTaker.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
9use crate::*;
10
11extern_class!(
12 /// An IKPictureTaker object is a panel that allows users to choose and crop an image. It supports browsing of the file system and includes a recents popup-menu. The IKPictureTaker lets the user to crop a choosen image or to take snapshot from a camera like the built-in iSight.
13 ///
14 /// See also [Apple's documentation](https://developer.apple.com/documentation/quartz/ikpicturetaker?language=objc)
15 #[unsafe(super(NSPanel, NSWindow, NSResponder, NSObject))]
16 #[derive(Debug, PartialEq, Eq, Hash)]
17 pub struct IKPictureTaker;
18);
19
20extern_conformance!(
21 unsafe impl NSAccessibility for IKPictureTaker {}
22);
23
24extern_conformance!(
25 unsafe impl NSAccessibilityElementProtocol for IKPictureTaker {}
26);
27
28extern_conformance!(
29 unsafe impl NSAnimatablePropertyContainer for IKPictureTaker {}
30);
31
32extern_conformance!(
33 unsafe impl NSAppearanceCustomization for IKPictureTaker {}
34);
35
36extern_conformance!(
37 unsafe impl NSCoding for IKPictureTaker {}
38);
39
40extern_conformance!(
41 unsafe impl NSMenuItemValidation for IKPictureTaker {}
42);
43
44extern_conformance!(
45 unsafe impl NSObjectProtocol for IKPictureTaker {}
46);
47
48extern_conformance!(
49 unsafe impl NSUserInterfaceItemIdentification for IKPictureTaker {}
50);
51
52extern_conformance!(
53 unsafe impl NSUserInterfaceValidations for IKPictureTaker {}
54);
55
56impl IKPictureTaker {
57 extern_methods!(
58 /// Returns the shared IKPictureTaker instance, creating it if necessary.
59 #[unsafe(method(pictureTaker))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn pictureTaker(mtm: MainThreadMarker) -> Option<Retained<IKPictureTaker>>;
62
63 /// Launches a modal PictureTaker session.
64 ///
65 /// Returns: Returns NSOKButton if the user edits or chooses an image and confirm panel, NSCancelButton if the user canceled or didn't change the image.
66 #[unsafe(method(runModal))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn runModal(&self) -> NSInteger;
69
70 /// Launch the PictureTaker.
71 ///
72 /// Parameter `delegate`: the object to invoke didEndSelector when the PictureTaker terminates.
73 ///
74 /// Parameter `didEndSelector`: the selector to invoke when the PictureTaker terminates.
75 ///
76 /// Parameter `contextInfo`: Any data that will be passed as an argument to the delegate through didEndSelector after the session has ended.
77 ///
78 /// didEndSelector should have the following signature: - (void)pictureTakerDidEnd:(IKPictureTaker *)pictureTaker returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
79 /// returnCode value is set to NSOKButton if the user validate, or to NSCancelButton if the user cancel.
80 ///
81 /// # Safety
82 ///
83 /// - `delegate` should be of the correct type.
84 /// - `delegate` might not allow `None`.
85 /// - `did_end_selector` must be a valid selector.
86 /// - `context_info` must be a valid pointer.
87 #[unsafe(method(beginPictureTakerWithDelegate:didEndSelector:contextInfo:))]
88 #[unsafe(method_family = none)]
89 pub unsafe fn beginPictureTakerWithDelegate_didEndSelector_contextInfo(
90 &self,
91 delegate: Option<&AnyObject>,
92 did_end_selector: Option<Sel>,
93 context_info: *mut c_void,
94 );
95
96 /// Launch the PictureTaker as a sheet for aWindow
97 ///
98 /// Parameter `delegate`: the object to invoke didEndSelector when the PictureTaker terminates
99 ///
100 /// Parameter `didEndSelector`: the selector to invoke when the PictureTaker terminates
101 ///
102 /// Parameter `contextInfo`: Any data that will be passed as an argument to the delegate through didEndSelector after the session has ended
103 ///
104 /// didEndSelector should have the following signature: - (void)pictureTakerDidEnd:(IKPictureTaker *)pictureTaker returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
105 /// returnCode value is set to NSOKButton if the user validate, or to NSCancelButton if the user cancel.
106 ///
107 /// # Safety
108 ///
109 /// - `a_window` might not allow `None`.
110 /// - `delegate` should be of the correct type.
111 /// - `delegate` might not allow `None`.
112 /// - `did_end_selector` must be a valid selector.
113 /// - `context_info` must be a valid pointer.
114 #[unsafe(method(beginPictureTakerSheetForWindow:withDelegate:didEndSelector:contextInfo:))]
115 #[unsafe(method_family = none)]
116 pub unsafe fn beginPictureTakerSheetForWindow_withDelegate_didEndSelector_contextInfo(
117 &self,
118 a_window: Option<&NSWindow>,
119 delegate: Option<&AnyObject>,
120 did_end_selector: Option<Sel>,
121 context_info: *mut c_void,
122 );
123
124 /// Launch the PictureTaker's recent popup.
125 ///
126 /// Parameter `delegate`: the object to invoke didEndSelector when the PictureTaker terminates.
127 ///
128 /// Parameter `didEndSelector`: the selector to invoke when the PictureTaker terminates.
129 ///
130 /// Parameter `contextInfo`: Any data that will be passed as an argument to the delegate through didEndSelector after the session has ended.
131 ///
132 /// didEndSelector should have the following signature: - (void)pictureTakerDidEnd:(IKPictureTaker *)pictureTaker returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
133 /// returnCode value is set to NSOKButton if the user validate, or to NSCancelButton if the user cancel.
134 ///
135 /// # Safety
136 ///
137 /// - `a_view` might not allow `None`.
138 /// - `delegate` should be of the correct type.
139 /// - `delegate` might not allow `None`.
140 /// - `did_end_selector` must be a valid selector.
141 /// - `context_info` must be a valid pointer.
142 #[unsafe(method(popUpRecentsMenuForView:withDelegate:didEndSelector:contextInfo:))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn popUpRecentsMenuForView_withDelegate_didEndSelector_contextInfo(
145 &self,
146 a_view: Option<&NSView>,
147 delegate: Option<&AnyObject>,
148 did_end_selector: Option<Sel>,
149 context_info: *mut c_void,
150 );
151
152 /// Set the image input for the PictureTaker.
153 ///
154 /// Parameter `image`: A valid NSImage.
155 ///
156 /// The input image is never modified by the PictureTaker.
157 ///
158 /// # Safety
159 ///
160 /// `image` might not allow `None`.
161 #[unsafe(method(setInputImage:))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn setInputImage(&self, image: Option<&NSImage>);
164
165 /// return the original PictureTaker's input-image.
166 ///
167 /// The input image is never modified by the PictureTaker.
168 #[unsafe(method(inputImage))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn inputImage(&self) -> Option<Retained<NSImage>>;
171
172 /// return the edited image.
173 #[unsafe(method(outputImage))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn outputImage(&self) -> Option<Retained<NSImage>>;
176
177 /// Controls whether the receiver enable/disable video mirroring durring snapshots (default is YES).
178 #[unsafe(method(setMirroring:))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn setMirroring(&self, b: bool);
181
182 /// Returns YES if video mirroring is enabled, NO otherwise.
183 #[unsafe(method(mirroring))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn mirroring(&self) -> bool;
186 );
187}
188
189/// Methods declared on superclass `NSWindow`.
190impl IKPictureTaker {
191 extern_methods!(
192 #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
193 #[unsafe(method_family = init)]
194 pub unsafe fn initWithContentRect_styleMask_backing_defer(
195 this: Allocated<Self>,
196 content_rect: NSRect,
197 style: NSWindowStyleMask,
198 backing_store_type: NSBackingStoreType,
199 flag: bool,
200 ) -> Retained<Self>;
201
202 #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
203 #[unsafe(method_family = init)]
204 pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
205 this: Allocated<Self>,
206 content_rect: NSRect,
207 style: NSWindowStyleMask,
208 backing_store_type: NSBackingStoreType,
209 flag: bool,
210 screen: Option<&NSScreen>,
211 ) -> Retained<Self>;
212
213 /// # Safety
214 ///
215 /// `coder` possibly has further requirements.
216 #[unsafe(method(initWithCoder:))]
217 #[unsafe(method_family = init)]
218 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
219
220 /// Convenience method for creating an autoreleased titled window with the given contentViewController. A basic NSWindow with the following attributes is made: titled, closable, resizable, miniaturizable. The window's title is automatically bound to the contentViewController's title. The size of the window can easily be controlled by utilizing autolayout and applying size constraints to the view (or its subviews). The window has isReleasedWhenClosed set to NO, and it must be explicitly retained to keep the window instance alive. To have it automatically be freed when it is closed, do the following: [window retain] and [window setReleasedWhenClosed:YES].
221 #[unsafe(method(windowWithContentViewController:))]
222 #[unsafe(method_family = none)]
223 pub unsafe fn windowWithContentViewController(
224 content_view_controller: &NSViewController,
225 ) -> Retained<Self>;
226 );
227}
228
229/// Methods declared on superclass `NSResponder`.
230impl IKPictureTaker {
231 extern_methods!(
232 #[unsafe(method(init))]
233 #[unsafe(method_family = init)]
234 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
235 );
236}
237
238/// Methods declared on superclass `NSObject`.
239impl IKPictureTaker {
240 extern_methods!(
241 #[unsafe(method(new))]
242 #[unsafe(method_family = new)]
243 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
244 );
245}
246
247extern "C" {
248 /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikpicturetakerallowsvideocapturekey?language=objc)
249 pub static IKPictureTakerAllowsVideoCaptureKey: Option<&'static NSString>;
250}
251
252extern "C" {
253 /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikpicturetakerallowsfilechoosingkey?language=objc)
254 pub static IKPictureTakerAllowsFileChoosingKey: Option<&'static NSString>;
255}
256
257extern "C" {
258 /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikpicturetakershowrecentpicturekey?language=objc)
259 pub static IKPictureTakerShowRecentPictureKey: Option<&'static NSString>;
260}
261
262extern "C" {
263 /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikpicturetakerupdaterecentpicturekey?language=objc)
264 pub static IKPictureTakerUpdateRecentPictureKey: Option<&'static NSString>;
265}
266
267extern "C" {
268 /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikpicturetakerallowseditingkey?language=objc)
269 pub static IKPictureTakerAllowsEditingKey: Option<&'static NSString>;
270}
271
272extern "C" {
273 /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikpicturetakershoweffectskey?language=objc)
274 pub static IKPictureTakerShowEffectsKey: Option<&'static NSString>;
275}
276
277extern "C" {
278 /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikpicturetakerinformationaltextkey?language=objc)
279 pub static IKPictureTakerInformationalTextKey: Option<&'static NSString>;
280}
281
282extern "C" {
283 /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikpicturetakerimagetransformskey?language=objc)
284 pub static IKPictureTakerImageTransformsKey: Option<&'static NSString>;
285}
286
287extern "C" {
288 /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikpicturetakeroutputimagemaxsizekey?language=objc)
289 pub static IKPictureTakerOutputImageMaxSizeKey: Option<&'static NSString>;
290}
291
292extern "C" {
293 /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikpicturetakershowaddressbookpicturekey?language=objc)
294 pub static IKPictureTakerShowAddressBookPictureKey: Option<&'static NSString>;
295}
296
297extern "C" {
298 /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikpicturetakershowemptypicturekey?language=objc)
299 pub static IKPictureTakerShowEmptyPictureKey: Option<&'static NSString>;
300}
301
302extern "C" {
303 /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikpicturetakerremainopenaftervalidatekey?language=objc)
304 pub static IKPictureTakerRemainOpenAfterValidateKey: Option<&'static NSString>;
305}