objc2_app_kit/generated/
NSTextAttachmentCell.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_foundation::*;
7
8use crate::*;
9
10extern_protocol!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextattachmentcellprotocol?language=objc)
12    #[doc(alias = "NSTextAttachmentCell")]
13    #[name = "NSTextAttachmentCell"]
14    pub unsafe trait NSTextAttachmentCellProtocol: NSObjectProtocol {
15        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
16        #[unsafe(method(drawWithFrame:inView:))]
17        #[unsafe(method_family = none)]
18        fn drawWithFrame_inView(
19            &self,
20            cell_frame: NSRect,
21            control_view: Option<&NSView>,
22            mtm: MainThreadMarker,
23        );
24
25        #[unsafe(method(wantsToTrackMouse))]
26        #[unsafe(method_family = none)]
27        fn wantsToTrackMouse(&self, mtm: MainThreadMarker) -> bool;
28
29        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
30        #[unsafe(method(highlight:withFrame:inView:))]
31        #[unsafe(method_family = none)]
32        fn highlight_withFrame_inView(
33            &self,
34            flag: bool,
35            cell_frame: NSRect,
36            control_view: Option<&NSView>,
37            mtm: MainThreadMarker,
38        );
39
40        #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
41        #[unsafe(method(trackMouse:inRect:ofView:untilMouseUp:))]
42        #[unsafe(method_family = none)]
43        fn trackMouse_inRect_ofView_untilMouseUp(
44            &self,
45            the_event: &NSEvent,
46            cell_frame: NSRect,
47            control_view: Option<&NSView>,
48            flag: bool,
49            mtm: MainThreadMarker,
50        ) -> bool;
51
52        #[unsafe(method(cellSize))]
53        #[unsafe(method_family = none)]
54        fn cellSize(&self) -> NSSize;
55
56        #[unsafe(method(cellBaselineOffset))]
57        #[unsafe(method_family = none)]
58        fn cellBaselineOffset(&self) -> NSPoint;
59
60        #[cfg(feature = "NSTextAttachment")]
61        /// # Safety
62        ///
63        /// This is not retained internally, you must ensure the object is still alive.
64        #[unsafe(method(attachment))]
65        #[unsafe(method_family = none)]
66        unsafe fn attachment(&self) -> Option<Retained<NSTextAttachment>>;
67
68        #[cfg(feature = "NSTextAttachment")]
69        /// Setter for [`attachment`][Self::attachment].
70        ///
71        /// # Safety
72        ///
73        /// This is unretained, you must ensure the object is kept alive while in use.
74        #[unsafe(method(setAttachment:))]
75        #[unsafe(method_family = none)]
76        unsafe fn setAttachment(&self, attachment: Option<&NSTextAttachment>);
77
78        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
79        #[unsafe(method(drawWithFrame:inView:characterIndex:))]
80        #[unsafe(method_family = none)]
81        fn drawWithFrame_inView_characterIndex(
82            &self,
83            cell_frame: NSRect,
84            control_view: Option<&NSView>,
85            char_index: NSUInteger,
86            mtm: MainThreadMarker,
87        );
88
89        #[cfg(all(
90            feature = "NSLayoutManager",
91            feature = "NSResponder",
92            feature = "NSView"
93        ))]
94        #[unsafe(method(drawWithFrame:inView:characterIndex:layoutManager:))]
95        #[unsafe(method_family = none)]
96        fn drawWithFrame_inView_characterIndex_layoutManager(
97            &self,
98            cell_frame: NSRect,
99            control_view: Option<&NSView>,
100            char_index: NSUInteger,
101            layout_manager: &NSLayoutManager,
102            mtm: MainThreadMarker,
103        );
104
105        #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
106        #[unsafe(method(wantsToTrackMouseForEvent:inRect:ofView:atCharacterIndex:))]
107        #[unsafe(method_family = none)]
108        fn wantsToTrackMouseForEvent_inRect_ofView_atCharacterIndex(
109            &self,
110            the_event: &NSEvent,
111            cell_frame: NSRect,
112            control_view: Option<&NSView>,
113            char_index: NSUInteger,
114            mtm: MainThreadMarker,
115        ) -> bool;
116
117        #[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
118        #[unsafe(method(trackMouse:inRect:ofView:atCharacterIndex:untilMouseUp:))]
119        #[unsafe(method_family = none)]
120        fn trackMouse_inRect_ofView_atCharacterIndex_untilMouseUp(
121            &self,
122            the_event: &NSEvent,
123            cell_frame: NSRect,
124            control_view: Option<&NSView>,
125            char_index: NSUInteger,
126            flag: bool,
127            mtm: MainThreadMarker,
128        ) -> bool;
129
130        #[cfg(feature = "NSTextContainer")]
131        #[unsafe(method(cellFrameForTextContainer:proposedLineFragment:glyphPosition:characterIndex:))]
132        #[unsafe(method_family = none)]
133        fn cellFrameForTextContainer_proposedLineFragment_glyphPosition_characterIndex(
134            &self,
135            text_container: &NSTextContainer,
136            line_frag: NSRect,
137            position: NSPoint,
138            char_index: NSUInteger,
139        ) -> NSRect;
140    }
141);
142
143extern_class!(
144    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextattachmentcell?language=objc)
145    #[unsafe(super(NSCell, NSObject))]
146    #[derive(Debug, PartialEq, Eq, Hash)]
147    #[cfg(feature = "NSCell")]
148    pub struct NSTextAttachmentCell;
149);
150
151#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSCell"))]
152extern_conformance!(
153    unsafe impl NSAccessibility for NSTextAttachmentCell {}
154);
155
156#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSCell"))]
157extern_conformance!(
158    unsafe impl NSAccessibilityElementProtocol for NSTextAttachmentCell {}
159);
160
161#[cfg(feature = "NSCell")]
162extern_conformance!(
163    unsafe impl NSCoding for NSTextAttachmentCell {}
164);
165
166#[cfg(feature = "NSCell")]
167extern_conformance!(
168    unsafe impl NSCopying for NSTextAttachmentCell {}
169);
170
171#[cfg(feature = "NSCell")]
172unsafe impl CopyingHelper for NSTextAttachmentCell {
173    type Result = Self;
174}
175
176#[cfg(feature = "NSCell")]
177extern_conformance!(
178    unsafe impl NSObjectProtocol for NSTextAttachmentCell {}
179);
180
181#[cfg(feature = "NSCell")]
182extern_conformance!(
183    unsafe impl NSTextAttachmentCellProtocol for NSTextAttachmentCell {}
184);
185
186#[cfg(all(feature = "NSCell", feature = "NSUserInterfaceItemIdentification"))]
187extern_conformance!(
188    unsafe impl NSUserInterfaceItemIdentification for NSTextAttachmentCell {}
189);
190
191#[cfg(feature = "NSCell")]
192impl NSTextAttachmentCell {
193    extern_methods!();
194}
195
196/// Methods declared on superclass `NSCell`.
197#[cfg(feature = "NSCell")]
198impl NSTextAttachmentCell {
199    extern_methods!(
200        #[unsafe(method(init))]
201        #[unsafe(method_family = init)]
202        pub fn init(this: Allocated<Self>) -> Retained<Self>;
203
204        #[unsafe(method(initTextCell:))]
205        #[unsafe(method_family = init)]
206        pub fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
207
208        #[cfg(feature = "NSImage")]
209        #[unsafe(method(initImageCell:))]
210        #[unsafe(method_family = init)]
211        pub fn initImageCell(this: Allocated<Self>, image: Option<&NSImage>) -> 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}
221
222/// Methods declared on superclass `NSObject`.
223#[cfg(feature = "NSCell")]
224impl NSTextAttachmentCell {
225    extern_methods!(
226        #[unsafe(method(new))]
227        #[unsafe(method_family = new)]
228        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
229    );
230}