objc2_app_kit/generated/
NSBox.rs1use 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
12#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSTitlePosition(pub NSUInteger);
17impl NSTitlePosition {
18 #[doc(alias = "NSNoTitle")]
19 pub const NoTitle: Self = Self(0);
20 #[doc(alias = "NSAboveTop")]
21 pub const AboveTop: Self = Self(1);
22 #[doc(alias = "NSAtTop")]
23 pub const AtTop: Self = Self(2);
24 #[doc(alias = "NSBelowTop")]
25 pub const BelowTop: Self = Self(3);
26 #[doc(alias = "NSAboveBottom")]
27 pub const AboveBottom: Self = Self(4);
28 #[doc(alias = "NSAtBottom")]
29 pub const AtBottom: Self = Self(5);
30 #[doc(alias = "NSBelowBottom")]
31 pub const BelowBottom: Self = Self(6);
32}
33
34unsafe impl Encode for NSTitlePosition {
35 const ENCODING: Encoding = NSUInteger::ENCODING;
36}
37
38unsafe impl RefEncode for NSTitlePosition {
39 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
40}
41
42#[repr(transparent)]
45#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
46pub struct NSBoxType(pub NSUInteger);
47impl NSBoxType {
48 #[doc(alias = "NSBoxPrimary")]
49 pub const Primary: Self = Self(0);
50 #[doc(alias = "NSBoxSeparator")]
51 pub const Separator: Self = Self(2);
52 #[doc(alias = "NSBoxCustom")]
53 pub const Custom: Self = Self(4);
54}
55
56unsafe impl Encode for NSBoxType {
57 const ENCODING: Encoding = NSUInteger::ENCODING;
58}
59
60unsafe impl RefEncode for NSBoxType {
61 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
62}
63
64extern_class!(
65 #[unsafe(super(NSView, NSResponder, NSObject))]
67 #[derive(Debug, PartialEq, Eq, Hash)]
68 #[cfg(all(feature = "NSResponder", feature = "NSView"))]
69 pub struct NSBox;
70);
71
72#[cfg(all(
73 feature = "NSAccessibilityProtocols",
74 feature = "NSResponder",
75 feature = "NSView"
76))]
77unsafe impl NSAccessibility for NSBox {}
78
79#[cfg(all(
80 feature = "NSAccessibilityProtocols",
81 feature = "NSResponder",
82 feature = "NSView"
83))]
84unsafe impl NSAccessibilityElementProtocol for NSBox {}
85
86#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
87unsafe impl NSAnimatablePropertyContainer for NSBox {}
88
89#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
90unsafe impl NSAppearanceCustomization for NSBox {}
91
92#[cfg(all(feature = "NSResponder", feature = "NSView"))]
93unsafe impl NSCoding for NSBox {}
94
95#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
96unsafe impl NSDraggingDestination for NSBox {}
97
98#[cfg(all(feature = "NSResponder", feature = "NSView"))]
99unsafe impl NSObjectProtocol for NSBox {}
100
101#[cfg(all(
102 feature = "NSResponder",
103 feature = "NSUserInterfaceItemIdentification",
104 feature = "NSView"
105))]
106unsafe impl NSUserInterfaceItemIdentification for NSBox {}
107
108#[cfg(all(feature = "NSResponder", feature = "NSView"))]
109impl NSBox {
110 extern_methods!(
111 #[unsafe(method(boxType))]
112 #[unsafe(method_family = none)]
113 pub unsafe fn boxType(&self) -> NSBoxType;
114
115 #[unsafe(method(setBoxType:))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn setBoxType(&self, box_type: NSBoxType);
119
120 #[unsafe(method(titlePosition))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn titlePosition(&self) -> NSTitlePosition;
123
124 #[unsafe(method(setTitlePosition:))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn setTitlePosition(&self, title_position: NSTitlePosition);
128
129 #[unsafe(method(title))]
130 #[unsafe(method_family = none)]
131 pub unsafe fn title(&self) -> Retained<NSString>;
132
133 #[unsafe(method(setTitle:))]
135 #[unsafe(method_family = none)]
136 pub unsafe fn setTitle(&self, title: &NSString);
137
138 #[cfg(feature = "NSFont")]
139 #[unsafe(method(titleFont))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn titleFont(&self) -> Retained<NSFont>;
142
143 #[cfg(feature = "NSFont")]
144 #[unsafe(method(setTitleFont:))]
146 #[unsafe(method_family = none)]
147 pub unsafe fn setTitleFont(&self, title_font: &NSFont);
148
149 #[unsafe(method(borderRect))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn borderRect(&self) -> NSRect;
152
153 #[unsafe(method(titleRect))]
154 #[unsafe(method_family = none)]
155 pub unsafe fn titleRect(&self) -> NSRect;
156
157 #[unsafe(method(titleCell))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn titleCell(&self) -> Retained<AnyObject>;
160
161 #[unsafe(method(contentViewMargins))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn contentViewMargins(&self) -> NSSize;
164
165 #[unsafe(method(setContentViewMargins:))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn setContentViewMargins(&self, content_view_margins: NSSize);
169
170 #[unsafe(method(sizeToFit))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn sizeToFit(&self);
173
174 #[unsafe(method(setFrameFromContentFrame:))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn setFrameFromContentFrame(&self, content_frame: NSRect);
177
178 #[unsafe(method(contentView))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn contentView(&self) -> Option<Retained<NSView>>;
181
182 #[unsafe(method(setContentView:))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn setContentView(&self, content_view: Option<&NSView>);
186
187 #[unsafe(method(isTransparent))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn isTransparent(&self) -> bool;
190
191 #[unsafe(method(setTransparent:))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn setTransparent(&self, transparent: bool);
195
196 #[cfg(feature = "objc2-core-foundation")]
197 #[unsafe(method(borderWidth))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn borderWidth(&self) -> CGFloat;
200
201 #[cfg(feature = "objc2-core-foundation")]
202 #[unsafe(method(setBorderWidth:))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn setBorderWidth(&self, border_width: CGFloat);
206
207 #[cfg(feature = "objc2-core-foundation")]
208 #[unsafe(method(cornerRadius))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn cornerRadius(&self) -> CGFloat;
211
212 #[cfg(feature = "objc2-core-foundation")]
213 #[unsafe(method(setCornerRadius:))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn setCornerRadius(&self, corner_radius: CGFloat);
217
218 #[cfg(feature = "NSColor")]
219 #[unsafe(method(borderColor))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn borderColor(&self) -> Retained<NSColor>;
222
223 #[cfg(feature = "NSColor")]
224 #[unsafe(method(setBorderColor:))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn setBorderColor(&self, border_color: &NSColor);
228
229 #[cfg(feature = "NSColor")]
230 #[unsafe(method(fillColor))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn fillColor(&self) -> Retained<NSColor>;
233
234 #[cfg(feature = "NSColor")]
235 #[unsafe(method(setFillColor:))]
237 #[unsafe(method_family = none)]
238 pub unsafe fn setFillColor(&self, fill_color: &NSColor);
239 );
240}
241
242#[cfg(all(feature = "NSResponder", feature = "NSView"))]
244impl NSBox {
245 extern_methods!(
246 #[unsafe(method(initWithFrame:))]
247 #[unsafe(method_family = init)]
248 pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
249
250 #[unsafe(method(initWithCoder:))]
251 #[unsafe(method_family = init)]
252 pub unsafe fn initWithCoder(
253 this: Allocated<Self>,
254 coder: &NSCoder,
255 ) -> Option<Retained<Self>>;
256 );
257}
258
259#[cfg(all(feature = "NSResponder", feature = "NSView"))]
261impl NSBox {
262 extern_methods!(
263 #[unsafe(method(init))]
264 #[unsafe(method_family = init)]
265 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
266 );
267}
268
269#[cfg(all(feature = "NSResponder", feature = "NSView"))]
271impl NSBox {
272 extern_methods!(
273 #[unsafe(method(new))]
274 #[unsafe(method_family = new)]
275 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
276 );
277}
278
279#[cfg(all(feature = "NSResponder", feature = "NSView"))]
281impl NSBox {
282 extern_methods!(
283 #[deprecated = "borderType is only applicable to NSBoxOldStyle, which is deprecated. To replace a borderType of NSNoBorder, use the `transparent` property."]
284 #[unsafe(method(borderType))]
285 #[unsafe(method_family = none)]
286 pub unsafe fn borderType(&self) -> NSBorderType;
287
288 #[deprecated = "borderType is only applicable to NSBoxOldStyle, which is deprecated. To replace a borderType of NSNoBorder, use the `transparent` property."]
290 #[unsafe(method(setBorderType:))]
291 #[unsafe(method_family = none)]
292 pub unsafe fn setBorderType(&self, border_type: NSBorderType);
293
294 #[deprecated]
295 #[unsafe(method(setTitleWithMnemonic:))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
298 );
299}
300
301pub static NSBoxSecondary: NSBoxType = NSBoxType(1);
303
304pub static NSBoxOldStyle: NSBoxType = NSBoxType(3);