objc2_app_kit/generated/
NSMenuItemCell.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::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmenuitemcell?language=objc)
14    #[unsafe(super(NSButtonCell, NSActionCell, NSCell, NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    #[cfg(all(feature = "NSActionCell", feature = "NSButtonCell", feature = "NSCell"))]
17    pub struct NSMenuItemCell;
18);
19
20#[cfg(all(
21    feature = "NSAccessibilityProtocols",
22    feature = "NSActionCell",
23    feature = "NSButtonCell",
24    feature = "NSCell"
25))]
26extern_conformance!(
27    unsafe impl NSAccessibility for NSMenuItemCell {}
28);
29
30#[cfg(all(
31    feature = "NSAccessibilityProtocols",
32    feature = "NSActionCell",
33    feature = "NSButtonCell",
34    feature = "NSCell"
35))]
36extern_conformance!(
37    unsafe impl NSAccessibilityElementProtocol for NSMenuItemCell {}
38);
39
40#[cfg(all(feature = "NSActionCell", feature = "NSButtonCell", feature = "NSCell"))]
41extern_conformance!(
42    unsafe impl NSCoding for NSMenuItemCell {}
43);
44
45#[cfg(all(feature = "NSActionCell", feature = "NSButtonCell", feature = "NSCell"))]
46extern_conformance!(
47    unsafe impl NSCopying for NSMenuItemCell {}
48);
49
50#[cfg(all(feature = "NSActionCell", feature = "NSButtonCell", feature = "NSCell"))]
51unsafe impl CopyingHelper for NSMenuItemCell {
52    type Result = Self;
53}
54
55#[cfg(all(feature = "NSActionCell", feature = "NSButtonCell", feature = "NSCell"))]
56extern_conformance!(
57    unsafe impl NSObjectProtocol for NSMenuItemCell {}
58);
59
60#[cfg(all(
61    feature = "NSActionCell",
62    feature = "NSButtonCell",
63    feature = "NSCell",
64    feature = "NSUserInterfaceItemIdentification"
65))]
66extern_conformance!(
67    unsafe impl NSUserInterfaceItemIdentification for NSMenuItemCell {}
68);
69
70#[cfg(all(feature = "NSActionCell", feature = "NSButtonCell", feature = "NSCell"))]
71impl NSMenuItemCell {
72    extern_methods!(
73        #[unsafe(method(initTextCell:))]
74        #[unsafe(method_family = init)]
75        pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
76
77        #[unsafe(method(initWithCoder:))]
78        #[unsafe(method_family = init)]
79        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
80
81        #[cfg(feature = "NSMenuItem")]
82        #[unsafe(method(menuItem))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn menuItem(&self) -> Option<Retained<NSMenuItem>>;
85
86        #[cfg(feature = "NSMenuItem")]
87        /// Setter for [`menuItem`][Self::menuItem].
88        #[unsafe(method(setMenuItem:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn setMenuItem(&self, menu_item: Option<&NSMenuItem>);
91
92        #[unsafe(method(needsSizing))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn needsSizing(&self) -> bool;
95
96        /// Setter for [`needsSizing`][Self::needsSizing].
97        #[unsafe(method(setNeedsSizing:))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn setNeedsSizing(&self, needs_sizing: bool);
100
101        #[unsafe(method(calcSize))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn calcSize(&self);
104
105        #[unsafe(method(needsDisplay))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn needsDisplay(&self) -> bool;
108
109        /// Setter for [`needsDisplay`][Self::needsDisplay].
110        #[unsafe(method(setNeedsDisplay:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn setNeedsDisplay(&self, needs_display: bool);
113
114        #[cfg(feature = "objc2-core-foundation")]
115        #[unsafe(method(stateImageWidth))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn stateImageWidth(&self) -> CGFloat;
118
119        #[cfg(feature = "objc2-core-foundation")]
120        #[unsafe(method(imageWidth))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn imageWidth(&self) -> CGFloat;
123
124        #[cfg(feature = "objc2-core-foundation")]
125        #[unsafe(method(titleWidth))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn titleWidth(&self) -> CGFloat;
128
129        #[cfg(feature = "objc2-core-foundation")]
130        #[unsafe(method(keyEquivalentWidth))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn keyEquivalentWidth(&self) -> CGFloat;
133
134        #[unsafe(method(stateImageRectForBounds:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn stateImageRectForBounds(&self, cell_frame: NSRect) -> NSRect;
137
138        #[unsafe(method(titleRectForBounds:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn titleRectForBounds(&self, cell_frame: NSRect) -> NSRect;
141
142        #[unsafe(method(keyEquivalentRectForBounds:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn keyEquivalentRectForBounds(&self, cell_frame: NSRect) -> NSRect;
145
146        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
147        #[unsafe(method(drawSeparatorItemWithFrame:inView:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn drawSeparatorItemWithFrame_inView(
150            &self,
151            cell_frame: NSRect,
152            control_view: &NSView,
153        );
154
155        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
156        #[unsafe(method(drawStateImageWithFrame:inView:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn drawStateImageWithFrame_inView(
159            &self,
160            cell_frame: NSRect,
161            control_view: &NSView,
162        );
163
164        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
165        #[unsafe(method(drawImageWithFrame:inView:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn drawImageWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);
168
169        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
170        #[unsafe(method(drawTitleWithFrame:inView:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn drawTitleWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);
173
174        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
175        #[unsafe(method(drawKeyEquivalentWithFrame:inView:))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn drawKeyEquivalentWithFrame_inView(
178            &self,
179            cell_frame: NSRect,
180            control_view: &NSView,
181        );
182
183        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
184        #[unsafe(method(drawBorderAndBackgroundWithFrame:inView:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn drawBorderAndBackgroundWithFrame_inView(
187            &self,
188            cell_frame: NSRect,
189            control_view: &NSView,
190        );
191
192        #[unsafe(method(tag))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn tag(&self) -> NSInteger;
195
196        /// Setter for [`tag`][Self::tag].
197        #[unsafe(method(setTag:))]
198        #[unsafe(method_family = none)]
199        pub unsafe fn setTag(&self, tag: NSInteger);
200    );
201}
202
203/// Methods declared on superclass `NSButtonCell`.
204#[cfg(all(feature = "NSActionCell", feature = "NSButtonCell", feature = "NSCell"))]
205impl NSMenuItemCell {
206    extern_methods!(
207        #[cfg(feature = "NSImage")]
208        #[unsafe(method(initImageCell:))]
209        #[unsafe(method_family = init)]
210        pub unsafe fn initImageCell(
211            this: Allocated<Self>,
212            image: Option<&NSImage>,
213        ) -> Retained<Self>;
214    );
215}
216
217/// Methods declared on superclass `NSCell`.
218#[cfg(all(feature = "NSActionCell", feature = "NSButtonCell", feature = "NSCell"))]
219impl NSMenuItemCell {
220    extern_methods!(
221        #[unsafe(method(init))]
222        #[unsafe(method_family = init)]
223        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
224    );
225}
226
227/// Methods declared on superclass `NSObject`.
228#[cfg(all(feature = "NSActionCell", feature = "NSButtonCell", feature = "NSCell"))]
229impl NSMenuItemCell {
230    extern_methods!(
231        #[unsafe(method(new))]
232        #[unsafe(method_family = new)]
233        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
234    );
235}