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 fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
76
77        /// # Safety
78        ///
79        /// `coder` possibly has further requirements.
80        #[unsafe(method(initWithCoder:))]
81        #[unsafe(method_family = init)]
82        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
83
84        #[cfg(feature = "NSMenuItem")]
85        #[unsafe(method(menuItem))]
86        #[unsafe(method_family = none)]
87        pub fn menuItem(&self) -> Option<Retained<NSMenuItem>>;
88
89        #[cfg(feature = "NSMenuItem")]
90        /// Setter for [`menuItem`][Self::menuItem].
91        #[unsafe(method(setMenuItem:))]
92        #[unsafe(method_family = none)]
93        pub fn setMenuItem(&self, menu_item: Option<&NSMenuItem>);
94
95        #[unsafe(method(needsSizing))]
96        #[unsafe(method_family = none)]
97        pub fn needsSizing(&self) -> bool;
98
99        /// Setter for [`needsSizing`][Self::needsSizing].
100        #[unsafe(method(setNeedsSizing:))]
101        #[unsafe(method_family = none)]
102        pub fn setNeedsSizing(&self, needs_sizing: bool);
103
104        #[unsafe(method(calcSize))]
105        #[unsafe(method_family = none)]
106        pub fn calcSize(&self);
107
108        #[unsafe(method(needsDisplay))]
109        #[unsafe(method_family = none)]
110        pub fn needsDisplay(&self) -> bool;
111
112        /// Setter for [`needsDisplay`][Self::needsDisplay].
113        #[unsafe(method(setNeedsDisplay:))]
114        #[unsafe(method_family = none)]
115        pub fn setNeedsDisplay(&self, needs_display: bool);
116
117        #[cfg(feature = "objc2-core-foundation")]
118        #[unsafe(method(stateImageWidth))]
119        #[unsafe(method_family = none)]
120        pub fn stateImageWidth(&self) -> CGFloat;
121
122        #[cfg(feature = "objc2-core-foundation")]
123        #[unsafe(method(imageWidth))]
124        #[unsafe(method_family = none)]
125        pub fn imageWidth(&self) -> CGFloat;
126
127        #[cfg(feature = "objc2-core-foundation")]
128        #[unsafe(method(titleWidth))]
129        #[unsafe(method_family = none)]
130        pub fn titleWidth(&self) -> CGFloat;
131
132        #[cfg(feature = "objc2-core-foundation")]
133        #[unsafe(method(keyEquivalentWidth))]
134        #[unsafe(method_family = none)]
135        pub fn keyEquivalentWidth(&self) -> CGFloat;
136
137        #[unsafe(method(stateImageRectForBounds:))]
138        #[unsafe(method_family = none)]
139        pub fn stateImageRectForBounds(&self, cell_frame: NSRect) -> NSRect;
140
141        #[unsafe(method(titleRectForBounds:))]
142        #[unsafe(method_family = none)]
143        pub fn titleRectForBounds(&self, cell_frame: NSRect) -> NSRect;
144
145        #[unsafe(method(keyEquivalentRectForBounds:))]
146        #[unsafe(method_family = none)]
147        pub fn keyEquivalentRectForBounds(&self, cell_frame: NSRect) -> NSRect;
148
149        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
150        #[unsafe(method(drawSeparatorItemWithFrame:inView:))]
151        #[unsafe(method_family = none)]
152        pub fn drawSeparatorItemWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);
153
154        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
155        #[unsafe(method(drawStateImageWithFrame:inView:))]
156        #[unsafe(method_family = none)]
157        pub fn drawStateImageWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);
158
159        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
160        #[unsafe(method(drawImageWithFrame:inView:))]
161        #[unsafe(method_family = none)]
162        pub fn drawImageWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);
163
164        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
165        #[unsafe(method(drawTitleWithFrame:inView:))]
166        #[unsafe(method_family = none)]
167        pub fn drawTitleWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);
168
169        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
170        #[unsafe(method(drawKeyEquivalentWithFrame:inView:))]
171        #[unsafe(method_family = none)]
172        pub fn drawKeyEquivalentWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);
173
174        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
175        #[unsafe(method(drawBorderAndBackgroundWithFrame:inView:))]
176        #[unsafe(method_family = none)]
177        pub fn drawBorderAndBackgroundWithFrame_inView(
178            &self,
179            cell_frame: NSRect,
180            control_view: &NSView,
181        );
182
183        #[unsafe(method(tag))]
184        #[unsafe(method_family = none)]
185        pub fn tag(&self) -> NSInteger;
186
187        /// Setter for [`tag`][Self::tag].
188        #[unsafe(method(setTag:))]
189        #[unsafe(method_family = none)]
190        pub fn setTag(&self, tag: NSInteger);
191    );
192}
193
194/// Methods declared on superclass `NSButtonCell`.
195#[cfg(all(feature = "NSActionCell", feature = "NSButtonCell", feature = "NSCell"))]
196impl NSMenuItemCell {
197    extern_methods!(
198        #[cfg(feature = "NSImage")]
199        #[unsafe(method(initImageCell:))]
200        #[unsafe(method_family = init)]
201        pub fn initImageCell(this: Allocated<Self>, image: Option<&NSImage>) -> 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 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 fn new(mtm: MainThreadMarker) -> Retained<Self>;
222    );
223}