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        #[unsafe(method(delegate))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn delegate(&self) -> Option<Retained<AnyObject>>;
121
122        /// Setter for [`delegate`][Self::delegate].
123        #[unsafe(method(setDelegate:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setDelegate(&self, delegate: Option<&AnyObject>);
126
127        #[cfg(feature = "objc2-core-foundation")]
128        /// Specifies the zoom factor for the image view.
129        #[unsafe(method(zoomFactor))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn zoomFactor(&self) -> CGFloat;
132
133        #[cfg(feature = "objc2-core-foundation")]
134        /// Setter for [`zoomFactor`][Self::zoomFactor].
135        #[unsafe(method(setZoomFactor:))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn setZoomFactor(&self, zoom_factor: CGFloat);
138
139        #[cfg(feature = "objc2-core-foundation")]
140        /// Specifies the rotation angle for the image view.
141        #[unsafe(method(rotationAngle))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn rotationAngle(&self) -> CGFloat;
144
145        #[cfg(feature = "objc2-core-foundation")]
146        /// Setter for [`rotationAngle`][Self::rotationAngle].
147        #[unsafe(method(setRotationAngle:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn setRotationAngle(&self, rotation_angle: CGFloat);
150
151        /// Specifies the current tool mode for the image view.
152        #[unsafe(method(currentToolMode))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn currentToolMode(&self) -> Retained<NSString>;
155
156        /// Setter for [`currentToolMode`][Self::currentToolMode].
157        #[unsafe(method(setCurrentToolMode:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn setCurrentToolMode(&self, current_tool_mode: Option<&NSString>);
160
161        /// Specifies the automatic resizing state for the image view.
162        #[unsafe(method(autoresizes))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn autoresizes(&self) -> bool;
165
166        /// Setter for [`autoresizes`][Self::autoresizes].
167        #[unsafe(method(setAutoresizes:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn setAutoresizes(&self, autoresizes: bool);
170
171        /// Specifies the horizontal scroll bar state for the image view.
172        #[unsafe(method(hasHorizontalScroller))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn hasHorizontalScroller(&self) -> bool;
175
176        /// Setter for [`hasHorizontalScroller`][Self::hasHorizontalScroller].
177        #[unsafe(method(setHasHorizontalScroller:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setHasHorizontalScroller(&self, has_horizontal_scroller: bool);
180
181        /// Specifies the vertical scroll bar state for the image view.
182        #[unsafe(method(hasVerticalScroller))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn hasVerticalScroller(&self) -> bool;
185
186        /// Setter for [`hasVerticalScroller`][Self::hasVerticalScroller].
187        #[unsafe(method(setHasVerticalScroller:))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn setHasVerticalScroller(&self, has_vertical_scroller: bool);
190
191        /// Specifies the automatic-hiding scroll bar state for the image view.
192        #[unsafe(method(autohidesScrollers))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn autohidesScrollers(&self) -> bool;
195
196        /// Setter for [`autohidesScrollers`][Self::autohidesScrollers].
197        #[unsafe(method(setAutohidesScrollers:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setAutohidesScrollers(&self, autohides_scrollers: bool);
200
201        /// Specifies the drag-and-drop support state for the image view.
202        #[unsafe(method(supportsDragAndDrop))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn supportsDragAndDrop(&self) -> bool;
205
206        /// Setter for [`supportsDragAndDrop`][Self::supportsDragAndDrop].
207        #[unsafe(method(setSupportsDragAndDrop:))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn setSupportsDragAndDrop(&self, supports_drag_and_drop: bool);
210
211        /// Specifies the editable state for the image view.
212        #[unsafe(method(editable))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn editable(&self) -> bool;
215
216        /// Setter for [`editable`][Self::editable].
217        #[unsafe(method(setEditable:))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn setEditable(&self, editable: bool);
220
221        /// Specifies the image-opening state of the editing pane in the image view.
222        #[unsafe(method(doubleClickOpensImageEditPanel))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn doubleClickOpensImageEditPanel(&self) -> bool;
225
226        /// Setter for [`doubleClickOpensImageEditPanel`][Self::doubleClickOpensImageEditPanel].
227        #[unsafe(method(setDoubleClickOpensImageEditPanel:))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn setDoubleClickOpensImageEditPanel(
230            &self,
231            double_click_opens_image_edit_panel: bool,
232        );
233
234        #[cfg(feature = "objc2-core-image")]
235        /// Specifies a Core Image filter for image correction.
236        #[unsafe(method(imageCorrection))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn imageCorrection(&self) -> Option<Retained<CIFilter>>;
239
240        #[cfg(feature = "objc2-core-image")]
241        /// Setter for [`imageCorrection`][Self::imageCorrection].
242        #[unsafe(method(setImageCorrection:))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn setImageCorrection(&self, image_correction: Option<&CIFilter>);
245
246        /// Specifies the background color for the image view.
247        #[unsafe(method(backgroundColor))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;
250
251        /// Setter for [`backgroundColor`][Self::backgroundColor].
252        #[unsafe(method(setBackgroundColor:))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);
255
256        #[cfg(feature = "objc2-core-graphics")]
257        /// Sets the image
258        /// &
259        /// metadata (both retrieved from ImageIO).
260        #[unsafe(method(setImage:imageProperties:))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn setImage_imageProperties(
263            &self,
264            image: Option<&CGImage>,
265            meta_data: Option<&NSDictionary>,
266        );
267
268        /// Initializes an image view with the image specified by a URL.
269        #[unsafe(method(setImageWithURL:))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn setImageWithURL(&self, url: Option<&NSURL>);
272
273        #[cfg(feature = "objc2-core-graphics")]
274        /// Returns the image associated with the view, after any image corrections.
275        #[unsafe(method(image))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn image(&self) -> Option<Retained<CGImage>>;
278
279        /// Returns the size of the image in the image view.
280        #[unsafe(method(imageSize))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn imageSize(&self) -> NSSize;
283
284        /// Returns the metadata for the image in the view.
285        #[unsafe(method(imageProperties))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn imageProperties(&self) -> Option<Retained<NSDictionary>>;
288
289        #[cfg(feature = "objc2-core-foundation")]
290        /// Sets the rotation angle at the provided origin.
291        #[unsafe(method(setRotationAngle:centerPoint:))]
292        #[unsafe(method_family = none)]
293        pub unsafe fn setRotationAngle_centerPoint(
294            &self,
295            rotation_angle: CGFloat,
296            center_point: NSPoint,
297        );
298
299        /// Rotates the image left.
300        #[unsafe(method(rotateImageLeft:))]
301        #[unsafe(method_family = none)]
302        pub unsafe fn rotateImageLeft(&self, sender: Option<&AnyObject>);
303
304        /// Rotates the image right.
305        #[unsafe(method(rotateImageRight:))]
306        #[unsafe(method_family = none)]
307        pub unsafe fn rotateImageRight(&self, sender: Option<&AnyObject>);
308
309        #[cfg(feature = "objc2-core-foundation")]
310        /// Sets the zoom factor at the provided origin.
311        #[unsafe(method(setImageZoomFactor:centerPoint:))]
312        #[unsafe(method_family = none)]
313        pub unsafe fn setImageZoomFactor_centerPoint(
314            &self,
315            zoom_factor: CGFloat,
316            center_point: NSPoint,
317        );
318
319        /// Zooms the image so that it fits in the specified rectangle.
320        #[unsafe(method(zoomImageToRect:))]
321        #[unsafe(method_family = none)]
322        pub unsafe fn zoomImageToRect(&self, rect: NSRect);
323
324        /// Zooms the image so that it fits in the image view.
325        #[unsafe(method(zoomImageToFit:))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn zoomImageToFit(&self, sender: Option<&AnyObject>);
328
329        /// Zooms the image so that it is displayed using its true size.
330        #[unsafe(method(zoomImageToActualSize:))]
331        #[unsafe(method_family = none)]
332        pub unsafe fn zoomImageToActualSize(&self, sender: Option<&AnyObject>);
333
334        /// Zooms the image in.
335        #[unsafe(method(zoomIn:))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn zoomIn(&self, sender: Option<&AnyObject>);
338
339        /// Zooms the image out.
340        #[unsafe(method(zoomOut:))]
341        #[unsafe(method_family = none)]
342        pub unsafe fn zoomOut(&self, sender: Option<&AnyObject>);
343
344        /// Flips an image along the horizontal axis.
345        #[unsafe(method(flipImageHorizontal:))]
346        #[unsafe(method_family = none)]
347        pub unsafe fn flipImageHorizontal(&self, sender: Option<&AnyObject>);
348
349        /// Flips an image along the vertical axis.
350        #[unsafe(method(flipImageVertical:))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn flipImageVertical(&self, sender: Option<&AnyObject>);
353
354        /// Crops the image using the current selection.
355        #[unsafe(method(crop:))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn crop(&self, sender: Option<&AnyObject>);
358
359        #[cfg(feature = "objc2-quartz-core")]
360        /// Sets an overlay (Core Animation layer) for the image or the image background.
361        #[unsafe(method(setOverlay:forType:))]
362        #[unsafe(method_family = none)]
363        pub unsafe fn setOverlay_forType(
364            &self,
365            layer: Option<&CALayer>,
366            layer_type: Option<&NSString>,
367        );
368
369        #[cfg(feature = "objc2-quartz-core")]
370        /// Returns the overlay (Core Animation layer) for the image or the image background.
371        #[unsafe(method(overlayForType:))]
372        #[unsafe(method_family = none)]
373        pub unsafe fn overlayForType(
374            &self,
375            layer_type: Option<&NSString>,
376        ) -> Option<Retained<CALayer>>;
377
378        /// Scrolls the view to the specified point.
379        #[unsafe(method(scrollToPoint:))]
380        #[unsafe(method_family = none)]
381        pub unsafe fn scrollToPoint(&self, point: NSPoint);
382
383        /// Scrolls the view so that it includes the provided rectangular area.
384        #[unsafe(method(scrollToRect:))]
385        #[unsafe(method_family = none)]
386        pub unsafe fn scrollToRect(&self, rect: NSRect);
387
388        /// Converts an image view coordinate to an image coordinate.
389        #[unsafe(method(convertViewPointToImagePoint:))]
390        #[unsafe(method_family = none)]
391        pub unsafe fn convertViewPointToImagePoint(&self, view_point: NSPoint) -> NSPoint;
392
393        /// Converts an image view rectangle to an image rectangle.
394        #[unsafe(method(convertViewRectToImageRect:))]
395        #[unsafe(method_family = none)]
396        pub unsafe fn convertViewRectToImageRect(&self, view_rect: NSRect) -> NSRect;
397
398        /// Converts an image coordinate to an image view coordinate.
399        #[unsafe(method(convertImagePointToViewPoint:))]
400        #[unsafe(method_family = none)]
401        pub unsafe fn convertImagePointToViewPoint(&self, image_point: NSPoint) -> NSPoint;
402
403        /// Converts an image rectangle to an image view rectangle.
404        #[unsafe(method(convertImageRectToViewRect:))]
405        #[unsafe(method_family = none)]
406        pub unsafe fn convertImageRectToViewRect(&self, image_rect: NSRect) -> NSRect;
407    );
408}
409
410/// Methods declared on superclass `NSView`.
411impl IKImageView {
412    extern_methods!(
413        #[unsafe(method(initWithFrame:))]
414        #[unsafe(method_family = init)]
415        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
416
417        #[unsafe(method(initWithCoder:))]
418        #[unsafe(method_family = init)]
419        pub unsafe fn initWithCoder(
420            this: Allocated<Self>,
421            coder: &NSCoder,
422        ) -> Option<Retained<Self>>;
423    );
424}
425
426/// Methods declared on superclass `NSResponder`.
427impl IKImageView {
428    extern_methods!(
429        #[unsafe(method(init))]
430        #[unsafe(method_family = init)]
431        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
432    );
433}
434
435/// Methods declared on superclass `NSObject`.
436impl IKImageView {
437    extern_methods!(
438        #[unsafe(method(new))]
439        #[unsafe(method_family = new)]
440        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
441    );
442}