objc2_quartz/generated/ImageKit/
IKImageView.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::*;
7#[cfg(feature = "objc2-core-foundation")]
8use objc2_core_foundation::*;
9#[cfg(feature = "objc2-core-graphics")]
10use objc2_core_graphics::*;
11#[cfg(feature = "objc2-core-image")]
12use objc2_core_image::*;
13use objc2_foundation::*;
14#[cfg(feature = "objc2-quartz-core")]
15use objc2_quartz_core::*;
16
17use crate::*;
18
19extern "C" {
20    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/iktoolmodenone?language=objc)
21    pub static IKToolModeNone: Option<&'static NSString>;
22}
23
24extern "C" {
25    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/iktoolmodemove?language=objc)
26    pub static IKToolModeMove: Option<&'static NSString>;
27}
28
29extern "C" {
30    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/iktoolmodeselect?language=objc)
31    pub static IKToolModeSelect: Option<&'static NSString>;
32}
33
34extern "C" {
35    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/iktoolmodeselectrect?language=objc)
36    pub static IKToolModeSelectRect: Option<&'static NSString>;
37}
38
39extern "C" {
40    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/iktoolmodeselectellipse?language=objc)
41    pub static IKToolModeSelectEllipse: Option<&'static NSString>;
42}
43
44extern "C" {
45    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/iktoolmodeselectlasso?language=objc)
46    pub static IKToolModeSelectLasso: Option<&'static NSString>;
47}
48
49extern "C" {
50    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/iktoolmodecrop?language=objc)
51    pub static IKToolModeCrop: Option<&'static NSString>;
52}
53
54extern "C" {
55    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/iktoolmoderotate?language=objc)
56    pub static IKToolModeRotate: Option<&'static NSString>;
57}
58
59extern "C" {
60    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/iktoolmodeannotate?language=objc)
61    pub static IKToolModeAnnotate: Option<&'static NSString>;
62}
63
64extern "C" {
65    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikoverlaytypebackground?language=objc)
66    pub static IKOverlayTypeBackground: Option<&'static NSString>;
67}
68
69extern "C" {
70    /// [Apple's documentation](https://developer.apple.com/documentation/quartz/ikoverlaytypeimage?language=objc)
71    pub static IKOverlayTypeImage: Option<&'static NSString>;
72}
73
74extern_class!(
75    /// The IKImageView class provides an efficient way to display images in a view while at the same time supporting a number of image editing operations.
76    ///
77    /// See also [Apple's documentation](https://developer.apple.com/documentation/quartz/ikimageview?language=objc)
78    #[unsafe(super(NSView, NSResponder, NSObject))]
79    #[derive(Debug, PartialEq, Eq, Hash)]
80    pub struct IKImageView;
81);
82
83extern_conformance!(
84    unsafe impl NSAccessibility for IKImageView {}
85);
86
87extern_conformance!(
88    unsafe impl NSAccessibilityElementProtocol for IKImageView {}
89);
90
91extern_conformance!(
92    unsafe impl NSAnimatablePropertyContainer for IKImageView {}
93);
94
95extern_conformance!(
96    unsafe impl NSAppearanceCustomization for IKImageView {}
97);
98
99extern_conformance!(
100    unsafe impl NSCoding for IKImageView {}
101);
102
103extern_conformance!(
104    unsafe impl NSDraggingDestination for IKImageView {}
105);
106
107extern_conformance!(
108    unsafe impl NSObjectProtocol for IKImageView {}
109);
110
111extern_conformance!(
112    unsafe impl NSUserInterfaceItemIdentification for IKImageView {}
113);
114
115impl IKImageView {
116    extern_methods!(
117        /// Specifies the delegate object of the receiver.
118        ///
119        /// # Safety
120        ///
121        /// This is not retained internally, you must ensure the object is still alive.
122        #[unsafe(method(delegate))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn delegate(&self) -> Option<Retained<AnyObject>>;
125
126        /// Setter for [`delegate`][Self::delegate].
127        ///
128        /// # Safety
129        ///
130        /// - `delegate` should be of the correct type.
131        /// - `delegate` might not allow `None`.
132        /// - This is unretained, you must ensure the object is kept alive while in use.
133        #[unsafe(method(setDelegate:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setDelegate(&self, delegate: Option<&AnyObject>);
136
137        #[cfg(feature = "objc2-core-foundation")]
138        /// Specifies the zoom factor for the image view.
139        #[unsafe(method(zoomFactor))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn zoomFactor(&self) -> CGFloat;
142
143        #[cfg(feature = "objc2-core-foundation")]
144        /// Setter for [`zoomFactor`][Self::zoomFactor].
145        #[unsafe(method(setZoomFactor:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn setZoomFactor(&self, zoom_factor: CGFloat);
148
149        #[cfg(feature = "objc2-core-foundation")]
150        /// Specifies the rotation angle for the image view.
151        #[unsafe(method(rotationAngle))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn rotationAngle(&self) -> CGFloat;
154
155        #[cfg(feature = "objc2-core-foundation")]
156        /// Setter for [`rotationAngle`][Self::rotationAngle].
157        #[unsafe(method(setRotationAngle:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn setRotationAngle(&self, rotation_angle: CGFloat);
160
161        /// Specifies the current tool mode for the image view.
162        #[unsafe(method(currentToolMode))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn currentToolMode(&self) -> Retained<NSString>;
165
166        /// Setter for [`currentToolMode`][Self::currentToolMode].
167        ///
168        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
169        #[unsafe(method(setCurrentToolMode:))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn setCurrentToolMode(&self, current_tool_mode: Option<&NSString>);
172
173        /// Specifies the automatic resizing state for the image view.
174        #[unsafe(method(autoresizes))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn autoresizes(&self) -> bool;
177
178        /// Setter for [`autoresizes`][Self::autoresizes].
179        #[unsafe(method(setAutoresizes:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setAutoresizes(&self, autoresizes: bool);
182
183        /// Specifies the horizontal scroll bar state for the image view.
184        #[unsafe(method(hasHorizontalScroller))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn hasHorizontalScroller(&self) -> bool;
187
188        /// Setter for [`hasHorizontalScroller`][Self::hasHorizontalScroller].
189        #[unsafe(method(setHasHorizontalScroller:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn setHasHorizontalScroller(&self, has_horizontal_scroller: bool);
192
193        /// Specifies the vertical scroll bar state for the image view.
194        #[unsafe(method(hasVerticalScroller))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn hasVerticalScroller(&self) -> bool;
197
198        /// Setter for [`hasVerticalScroller`][Self::hasVerticalScroller].
199        #[unsafe(method(setHasVerticalScroller:))]
200        #[unsafe(method_family = none)]
201        pub unsafe fn setHasVerticalScroller(&self, has_vertical_scroller: bool);
202
203        /// Specifies the automatic-hiding scroll bar state for the image view.
204        #[unsafe(method(autohidesScrollers))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn autohidesScrollers(&self) -> bool;
207
208        /// Setter for [`autohidesScrollers`][Self::autohidesScrollers].
209        #[unsafe(method(setAutohidesScrollers:))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn setAutohidesScrollers(&self, autohides_scrollers: bool);
212
213        /// Specifies the drag-and-drop support state for the image view.
214        #[unsafe(method(supportsDragAndDrop))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn supportsDragAndDrop(&self) -> bool;
217
218        /// Setter for [`supportsDragAndDrop`][Self::supportsDragAndDrop].
219        #[unsafe(method(setSupportsDragAndDrop:))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn setSupportsDragAndDrop(&self, supports_drag_and_drop: bool);
222
223        /// Specifies the editable state for the image view.
224        #[unsafe(method(editable))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn editable(&self) -> bool;
227
228        /// Setter for [`editable`][Self::editable].
229        #[unsafe(method(setEditable:))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn setEditable(&self, editable: bool);
232
233        /// Specifies the image-opening state of the editing pane in the image view.
234        #[unsafe(method(doubleClickOpensImageEditPanel))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn doubleClickOpensImageEditPanel(&self) -> bool;
237
238        /// Setter for [`doubleClickOpensImageEditPanel`][Self::doubleClickOpensImageEditPanel].
239        #[unsafe(method(setDoubleClickOpensImageEditPanel:))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn setDoubleClickOpensImageEditPanel(
242            &self,
243            double_click_opens_image_edit_panel: bool,
244        );
245
246        #[cfg(feature = "objc2-core-image")]
247        /// Specifies a Core Image filter for image correction.
248        ///
249        /// # Safety
250        ///
251        /// This is not retained internally, you must ensure the object is still alive.
252        #[unsafe(method(imageCorrection))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn imageCorrection(&self) -> Option<Retained<CIFilter>>;
255
256        #[cfg(feature = "objc2-core-image")]
257        /// Setter for [`imageCorrection`][Self::imageCorrection].
258        ///
259        /// # Safety
260        ///
261        /// - `image_correction` might not allow `None`.
262        /// - This is unretained, you must ensure the object is kept alive while in use.
263        #[unsafe(method(setImageCorrection:))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn setImageCorrection(&self, image_correction: Option<&CIFilter>);
266
267        /// Specifies the background color for the image view.
268        ///
269        /// # Safety
270        ///
271        /// This is not retained internally, you must ensure the object is still alive.
272        #[unsafe(method(backgroundColor))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;
275
276        /// Setter for [`backgroundColor`][Self::backgroundColor].
277        ///
278        /// # Safety
279        ///
280        /// - `background_color` might not allow `None`.
281        /// - This is unretained, you must ensure the object is kept alive while in use.
282        #[unsafe(method(setBackgroundColor:))]
283        #[unsafe(method_family = none)]
284        pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);
285
286        #[cfg(feature = "objc2-core-graphics")]
287        /// Sets the image
288        /// &
289        /// metadata (both retrieved from ImageIO).
290        ///
291        /// # Safety
292        ///
293        /// - `image` might not allow `None`.
294        /// - `meta_data` generic should be of the correct type.
295        /// - `meta_data` might not allow `None`.
296        #[unsafe(method(setImage:imageProperties:))]
297        #[unsafe(method_family = none)]
298        pub unsafe fn setImage_imageProperties(
299            &self,
300            image: Option<&CGImage>,
301            meta_data: Option<&NSDictionary>,
302        );
303
304        /// Initializes an image view with the image specified by a URL.
305        ///
306        /// # Safety
307        ///
308        /// `url` might not allow `None`.
309        #[unsafe(method(setImageWithURL:))]
310        #[unsafe(method_family = none)]
311        pub unsafe fn setImageWithURL(&self, url: Option<&NSURL>);
312
313        #[cfg(feature = "objc2-core-graphics")]
314        /// Returns the image associated with the view, after any image corrections.
315        #[unsafe(method(image))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn image(&self) -> Option<Retained<CGImage>>;
318
319        /// Returns the size of the image in the image view.
320        #[unsafe(method(imageSize))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn imageSize(&self) -> NSSize;
323
324        /// Returns the metadata for the image in the view.
325        #[unsafe(method(imageProperties))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn imageProperties(&self) -> Option<Retained<NSDictionary>>;
328
329        #[cfg(feature = "objc2-core-foundation")]
330        /// Sets the rotation angle at the provided origin.
331        #[unsafe(method(setRotationAngle:centerPoint:))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn setRotationAngle_centerPoint(
334            &self,
335            rotation_angle: CGFloat,
336            center_point: NSPoint,
337        );
338
339        /// Rotates the image left.
340        ///
341        /// # Safety
342        ///
343        /// - `sender` should be of the correct type.
344        /// - `sender` might not allow `None`.
345        #[unsafe(method(rotateImageLeft:))]
346        #[unsafe(method_family = none)]
347        pub unsafe fn rotateImageLeft(&self, sender: Option<&AnyObject>);
348
349        /// Rotates the image right.
350        ///
351        /// # Safety
352        ///
353        /// - `sender` should be of the correct type.
354        /// - `sender` might not allow `None`.
355        #[unsafe(method(rotateImageRight:))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn rotateImageRight(&self, sender: Option<&AnyObject>);
358
359        #[cfg(feature = "objc2-core-foundation")]
360        /// Sets the zoom factor at the provided origin.
361        #[unsafe(method(setImageZoomFactor:centerPoint:))]
362        #[unsafe(method_family = none)]
363        pub unsafe fn setImageZoomFactor_centerPoint(
364            &self,
365            zoom_factor: CGFloat,
366            center_point: NSPoint,
367        );
368
369        /// Zooms the image so that it fits in the specified rectangle.
370        #[unsafe(method(zoomImageToRect:))]
371        #[unsafe(method_family = none)]
372        pub unsafe fn zoomImageToRect(&self, rect: NSRect);
373
374        /// Zooms the image so that it fits in the image view.
375        ///
376        /// # Safety
377        ///
378        /// - `sender` should be of the correct type.
379        /// - `sender` might not allow `None`.
380        #[unsafe(method(zoomImageToFit:))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn zoomImageToFit(&self, sender: Option<&AnyObject>);
383
384        /// Zooms the image so that it is displayed using its true size.
385        ///
386        /// # Safety
387        ///
388        /// - `sender` should be of the correct type.
389        /// - `sender` might not allow `None`.
390        #[unsafe(method(zoomImageToActualSize:))]
391        #[unsafe(method_family = none)]
392        pub unsafe fn zoomImageToActualSize(&self, sender: Option<&AnyObject>);
393
394        /// Zooms the image in.
395        ///
396        /// # Safety
397        ///
398        /// - `sender` should be of the correct type.
399        /// - `sender` might not allow `None`.
400        #[unsafe(method(zoomIn:))]
401        #[unsafe(method_family = none)]
402        pub unsafe fn zoomIn(&self, sender: Option<&AnyObject>);
403
404        /// Zooms the image out.
405        ///
406        /// # Safety
407        ///
408        /// - `sender` should be of the correct type.
409        /// - `sender` might not allow `None`.
410        #[unsafe(method(zoomOut:))]
411        #[unsafe(method_family = none)]
412        pub unsafe fn zoomOut(&self, sender: Option<&AnyObject>);
413
414        /// Flips an image along the horizontal axis.
415        ///
416        /// # Safety
417        ///
418        /// - `sender` should be of the correct type.
419        /// - `sender` might not allow `None`.
420        #[unsafe(method(flipImageHorizontal:))]
421        #[unsafe(method_family = none)]
422        pub unsafe fn flipImageHorizontal(&self, sender: Option<&AnyObject>);
423
424        /// Flips an image along the vertical axis.
425        ///
426        /// # Safety
427        ///
428        /// - `sender` should be of the correct type.
429        /// - `sender` might not allow `None`.
430        #[unsafe(method(flipImageVertical:))]
431        #[unsafe(method_family = none)]
432        pub unsafe fn flipImageVertical(&self, sender: Option<&AnyObject>);
433
434        /// Crops the image using the current selection.
435        ///
436        /// # Safety
437        ///
438        /// - `sender` should be of the correct type.
439        /// - `sender` might not allow `None`.
440        #[unsafe(method(crop:))]
441        #[unsafe(method_family = none)]
442        pub unsafe fn crop(&self, sender: Option<&AnyObject>);
443
444        #[cfg(feature = "objc2-quartz-core")]
445        /// Sets an overlay (Core Animation layer) for the image or the image background.
446        ///
447        /// # Safety
448        ///
449        /// - `layer` might not allow `None`.
450        /// - `layer_type` might not allow `None`.
451        #[unsafe(method(setOverlay:forType:))]
452        #[unsafe(method_family = none)]
453        pub unsafe fn setOverlay_forType(
454            &self,
455            layer: Option<&CALayer>,
456            layer_type: Option<&NSString>,
457        );
458
459        #[cfg(feature = "objc2-quartz-core")]
460        /// Returns the overlay (Core Animation layer) for the image or the image background.
461        ///
462        /// # Safety
463        ///
464        /// `layer_type` might not allow `None`.
465        #[unsafe(method(overlayForType:))]
466        #[unsafe(method_family = none)]
467        pub unsafe fn overlayForType(
468            &self,
469            layer_type: Option<&NSString>,
470        ) -> Option<Retained<CALayer>>;
471
472        /// Scrolls the view to the specified point.
473        #[unsafe(method(scrollToPoint:))]
474        #[unsafe(method_family = none)]
475        pub unsafe fn scrollToPoint(&self, point: NSPoint);
476
477        /// Scrolls the view so that it includes the provided rectangular area.
478        #[unsafe(method(scrollToRect:))]
479        #[unsafe(method_family = none)]
480        pub unsafe fn scrollToRect(&self, rect: NSRect);
481
482        /// Converts an image view coordinate to an image coordinate.
483        #[unsafe(method(convertViewPointToImagePoint:))]
484        #[unsafe(method_family = none)]
485        pub unsafe fn convertViewPointToImagePoint(&self, view_point: NSPoint) -> NSPoint;
486
487        /// Converts an image view rectangle to an image rectangle.
488        #[unsafe(method(convertViewRectToImageRect:))]
489        #[unsafe(method_family = none)]
490        pub unsafe fn convertViewRectToImageRect(&self, view_rect: NSRect) -> NSRect;
491
492        /// Converts an image coordinate to an image view coordinate.
493        #[unsafe(method(convertImagePointToViewPoint:))]
494        #[unsafe(method_family = none)]
495        pub unsafe fn convertImagePointToViewPoint(&self, image_point: NSPoint) -> NSPoint;
496
497        /// Converts an image rectangle to an image view rectangle.
498        #[unsafe(method(convertImageRectToViewRect:))]
499        #[unsafe(method_family = none)]
500        pub unsafe fn convertImageRectToViewRect(&self, image_rect: NSRect) -> NSRect;
501    );
502}
503
504/// Methods declared on superclass `NSView`.
505impl IKImageView {
506    extern_methods!(
507        #[unsafe(method(initWithFrame:))]
508        #[unsafe(method_family = init)]
509        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
510
511        /// # Safety
512        ///
513        /// `coder` possibly has further requirements.
514        #[unsafe(method(initWithCoder:))]
515        #[unsafe(method_family = init)]
516        pub unsafe fn initWithCoder(
517            this: Allocated<Self>,
518            coder: &NSCoder,
519        ) -> Option<Retained<Self>>;
520    );
521}
522
523/// Methods declared on superclass `NSResponder`.
524impl IKImageView {
525    extern_methods!(
526        #[unsafe(method(init))]
527        #[unsafe(method_family = init)]
528        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
529    );
530}
531
532/// Methods declared on superclass `NSObject`.
533impl IKImageView {
534    extern_methods!(
535        #[unsafe(method(new))]
536        #[unsafe(method_family = new)]
537        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
538    );
539}