objc2_app_kit/generated/
NSCustomImageRep.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscustomimagerep?language=objc)
11    #[unsafe(super(NSImageRep, NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    #[cfg(feature = "NSImageRep")]
14    pub struct NSCustomImageRep;
15);
16
17#[cfg(feature = "NSImageRep")]
18extern_conformance!(
19    unsafe impl NSCoding for NSCustomImageRep {}
20);
21
22#[cfg(feature = "NSImageRep")]
23extern_conformance!(
24    unsafe impl NSCopying for NSCustomImageRep {}
25);
26
27#[cfg(feature = "NSImageRep")]
28unsafe impl CopyingHelper for NSCustomImageRep {
29    type Result = Self;
30}
31
32#[cfg(feature = "NSImageRep")]
33extern_conformance!(
34    unsafe impl NSObjectProtocol for NSCustomImageRep {}
35);
36
37#[cfg(feature = "NSImageRep")]
38impl NSCustomImageRep {
39    extern_methods!(
40        #[cfg(feature = "block2")]
41        #[unsafe(method(initWithSize:flipped:drawingHandler:))]
42        #[unsafe(method_family = init)]
43        pub fn initWithSize_flipped_drawingHandler(
44            this: Allocated<Self>,
45            size: NSSize,
46            drawing_handler_should_be_called_with_flipped_context: bool,
47            drawing_handler: &block2::DynBlock<dyn Fn(NSRect) -> Bool>,
48        ) -> Retained<Self>;
49
50        #[cfg(feature = "block2")]
51        #[unsafe(method(drawingHandler))]
52        #[unsafe(method_family = none)]
53        pub fn drawingHandler(&self) -> *mut block2::DynBlock<dyn Fn(NSRect) -> Bool>;
54
55        /// # Safety
56        ///
57        /// - `selector` must be a valid selector.
58        /// - `delegate` should be of the correct type.
59        #[unsafe(method(initWithDrawSelector:delegate:))]
60        #[unsafe(method_family = init)]
61        pub unsafe fn initWithDrawSelector_delegate(
62            this: Allocated<Self>,
63            selector: Sel,
64            delegate: &AnyObject,
65        ) -> Retained<Self>;
66
67        #[unsafe(method(drawSelector))]
68        #[unsafe(method_family = none)]
69        pub fn drawSelector(&self) -> Option<Sel>;
70
71        #[unsafe(method(delegate))]
72        #[unsafe(method_family = none)]
73        pub fn delegate(&self) -> Option<Retained<AnyObject>>;
74    );
75}
76
77/// Methods declared on superclass `NSImageRep`.
78#[cfg(feature = "NSImageRep")]
79impl NSCustomImageRep {
80    extern_methods!(
81        #[unsafe(method(init))]
82        #[unsafe(method_family = init)]
83        pub fn init(this: Allocated<Self>) -> Retained<Self>;
84
85        /// # Safety
86        ///
87        /// `coder` possibly has further requirements.
88        #[unsafe(method(initWithCoder:))]
89        #[unsafe(method_family = init)]
90        pub unsafe fn initWithCoder(
91            this: Allocated<Self>,
92            coder: &NSCoder,
93        ) -> Option<Retained<Self>>;
94    );
95}
96
97/// Methods declared on superclass `NSObject`.
98#[cfg(feature = "NSImageRep")]
99impl NSCustomImageRep {
100    extern_methods!(
101        #[unsafe(method(new))]
102        #[unsafe(method_family = new)]
103        pub fn new() -> Retained<Self>;
104    );
105}
106
107#[cfg(feature = "NSImageRep")]
108impl DefaultRetained for NSCustomImageRep {
109    #[inline]
110    fn default_retained() -> Retained<Self> {
111        Self::new()
112    }
113}