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